How to run a batch file with its contents being run with Administrator rights
Posted on 2014-07-31
To automatically report the technical specification of older PCs and laptops, I'm using Astra32 software in batch mode, loaded on a memory stick. This runs the program and outputs a CSV file to the memory stick. So just plug in the stick, wait for the contents to list, and click on the batch file name. Job done.
This worked fine on XP machines, but now the older PCs are increasingly having Vista and even Win7 loaded, the operation has become much longer as I'm having to manually update the properties of the Astra EXE file to tick the "run as administrator" box under the Advanced tab each time, and then right clicking the batch file itself to select the "run as administrator" option, and then answering the UCA permission too. It works, but pretty time-consuming when there's a pile to do.
I've tried automating it again by changing the batch file to contain: runas /noprofile /user:\machinename\administrator "astra32.exe", but this trips up on either not knowing the machinename or the administrator password, or because the password is a blank.
So any ideas on making this simple again please?