I have a build script which runs within visual studio. As part of the script i need to register a DLL with regsrv32, however this needs to be done with elevated privileges.
When we did this under XP, since all users on our domain are local administrators, regsrv32 always succedded, however under Windows 7 it fails as the script runs with the standard user privileges.
I looked at using RunAs, however this doesn't seem to work correctly, and only runs as the account specified, not the current user with elevated privileges.
Does anybody know of a way of elevating a single command within a script?
Did you get an answer off-line? RunAs doesn't work in Win7 either, even if you create another user as a member of Administrators, because he still needs to be "elevated". Sysinternals ShellRunAs has an "enumerate priviledges" option which only lists one "Basic User", even in an elevated command window - useless!
PS The only workaround I could find was to set the batch-file's shortcut to "Run as Administrator" though the resultant elevation dialog is annoying.