K
Kyle G
Guest
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?
More...
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?
More...