404 Tech Support

Using RunAs With Active Directory Users And Computers and Group Policy Management Console

Best practice has us not logging in with Administrator-level accounts for everyday activities. One way to ease the burden of having to log off and log on with an admin account when duty calls is to use the Run As… process that I refer to frequently. Running an executable, like Setup.exe, as an administrator is easy. You can right-click on it (or hold down Shift and right-click on it) and choose ‘Run as…’. There is also a way to script opening an Explorer window with your admin account or a command line, and both of those make for convenient shortcuts on the desktop. Accessing the Active Directory and the Group Policy Management Console are not so convenient because they’re inside the Microsoft Console.

With the Windows Server 2003 Administrators Pack installed, you can run the following command to get a prompt for your administrator account password which will then run the Active Directory Users and Computers Microsoft Console module:

runas.exe /user:domainUserName “mmc %windir%system32dsa.msc”

Obviously, substitute your domain and username in where appropriate in the command. You can put that inside a batch script to make your Active Directory just a double-click & password away.

The Group Policy Management Console is my preferred way of interacting with the Group Policies in place on the domain and knowing about the GPMC is one of the basics for working with Group Policies. With it installed, things are just a bit more convenient but it has the same problem as the Active Directory module if you have to access it with a different account. Here’s the command to run it as your administrator:

runas.exe /user:domainUserName “mmc %windir%system32gpmc.msc”

Again, substitute ‘domain’ and ‘UserName’ for what is relevant in your environment.

The trick as you can see is to run the Microsoft Management Console and then pass it the Microsoft Console module that you want. I put these two commands into their own separate scripts and then put shortcuts to them where they’re convenient (on the Desktop, Quick Launch bar, or in ObjectDock).