Need to run batch file on start-up as Administrator
I have a batch file that runs on start-up that prompts the user for the name of the laptop (each laptop has a unique ID). The WMIC command is called to rename the computer and user account to whatever the name of the laptop happens to be. It then maps a network drive to read from a text file which looks up which Win7 CD Key it should use, and then runs slmgr.vbs -ipk and -ato. The current user account is an "Administrator" but when running the WMIC or SLMGR.VBS commands, it fails because it's not the Administrator. I have tried placing the script into the Logon/Logoff policy but the script didn't even run when doing that. I've tried using Schedule Tasks, but because of the username and computer name changes, that causes errors. I've tried adding the script to HKEY_CU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\ and setting the RUNASADMIN flag but that also didn't work. How do I force the command prompt window to run as an administrator and then execute the script?
August 17th, 2011 9:29am

Right click on Shortcut>Properties>Shortcut Tab>Advanced>Check 'Run as administrator' worked good enough for me.
Free Windows Admin Tool Kit Click here and download it now
August 17th, 2011 10:28am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics