Open KrypticChewie opened 5 years ago
One method found to do this is to check if Net Session throws an error. The assumption being if it throws an error it's because access is denied and access is denied because there is no administrator access.
Batch script: how to check for admin rights https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
The script can catch the USMT executable throwing an error for no admin access in commit https://github.com/KrypticChewie/USMTScripts/commit/992ba29b7765af633b2aa677670f0edc806e4032
This is not the required behaviour though. I would like to script to do the detection itself before the user has to do anything else. I would also like it to exit and run itself with administrative privilege.
USMT requires administrator privileges. Right now, if the scripts are not being run with administrator privileges, after using the script you will get an error when ScanState or LoadState actually run. It would be more convenient if the script could detect that it does not have administrator privileges as it is run.