I have an MSBuild script. It is required to run in administrative mode to complete the build. I have a couple of command line utilities that are required to run in user-mode (i.e. non-admins) that I need to put in as part of the script. These are triggered quite simply by passing the command and the parameters. The only problem is, I can't get them to run in non-administrative mode. Is there a way from within a command prompt that has been run with administrative privileges to call a command and run in the context of the regular user?

Unsure if the specifics of my problem are relevant or if my abstract above is enough, but below is the specific problem I'm trying to resolve:

The particular applications that I'm trying to run as part of the msbuild script that require elevated permissions are installers for websites and endpoints on IIS to name just a few... there are many.

There is one application in particular that I'm failing to get to run under elevated permissions is a script to tell me if a specific VirtualBox Virtual Machine is running. We're using Vagrant to script the install of the VM, I've got a batch script that uses Vagrant Status to tell if the machine is running, but if I run this in elevated mode, Vagrant borks. I guess I could get around this by querying VirtualBox directly, but I don't know if that will work under elevated permissions either. The Vagrant script works just fine if I run it in a non-elevated console.

The result of all this needs to run on approximately 150 developer machines without any intervention... so reconfiguring machines to not use UAC or having to enter user passwords to run as different users is not an option.

  • Can you list some of the applications scripts? Or are they home grown? You should be able to use Run as or CPAU to call the various things as different users, or is this a UAC issue? Disabling UAC resolve anything? – Austin T French Jul 20 '13 at 2:16

Can you run it via scheduler as immediate command ("at" command)? It is commonly used to invoke elevated tasks but it might be used to invoke a non-elevated command.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.