Create an Elevated Command Prompt Running Under a Different User Context

User Account Control (UAC) is a security mechanism that is available in most modern versions of Windows. It restricts the ability to make changes to a computer environment without the explicit consent of an administrator. And as is with most production environments, it is very likely that this feature is already enabled. And just as likely, is the need to execute applications and commands under a different user within an elevated context during application deployment or maintenance.

This is achieved by using the runas command with the /noprofile flag. The command below creates an elevated command line running under the wunder\admin user:

runas /noprofile /user:wunder\admin cmd 

Now, all commands executed within this new command prompt would be in the same elevated status.

References

comments powered by Disqus