Windows: How to Run with Alternate Credentials and Open Elevated Command Prompts

Windows: How to Run with Alternate Credentials and Open Elevated Command Prompts

Launching Tools Using Alternate Credentials from a Command Prompt Window

One of the easiest ways to launch tools using alternate credentials is to first launch a Command Prompt with the credentials you want to use. Once the Command Prompt is launched using the alternate credentials, all subsequent commands and tools run from that Command Prompt start using the elevated credentials you provided.

If you are starting from the Desktop in Windows Vista, Windows 7, or Windows Server 2008 and Windows Server 2008 R2, you can do the following:

  1. Click Start (also shown as the circular Windows logo in the Start menu).
  2. Type Command Prompt and right-click Command Prompt when it appears in the Start menu. From the resulting context menu, click Run as administrator.

As another example, assume that you are logged on as a typical domain user to a workstation in the domain, but you needed to run several tools using a more privileged account. You could do the following:

  1. Open a Command Prompt window. Click Start, click Run, type cmd and press ENTER.
  2. In the Command Prompt window you just opened, type runas /user:<domain\username> cmd and press ENTER to open another Command Prompt using alternate credentials. Substitute the actual domain and username of the account you want to use for <domain\username>. For example, assume that the administrator account name is cgreen in the domain cpandl.com, the command would look like this runas /user:cpandl\cgreen.

Note: Instead of opening two different Command Prompt windows, you could run the following command from the Run dialog box cmd /k runas /user:<domain\username> cmd. For example, to open a Command Prompt as cgreen from the domain cpandl.com, you could run the following command: cmd /k runas /user:cpandl\cgreen cmd. The snap-ins only exist when the specific role, administrative tool, or Remote Server Administration Tools (RSAT) have first been installed. If you try to run snap-in that is not installed, you will see a "cannot find" error message appear.

From here a new Command Prompt window opens with the credentials of the user account provided and you are prompted to type the password for the account. Once you enter the password for the account, you can run commands and launch additional tools from that Command Prompt window that will run using the credentials that you used to launch the window. For example, to run the Registry Editor, you could type regedit and press ENTER. To make use of the Command Prompt window to open graphical tools and snap-ins, you must know the name of the tools or their respective snap-ins.



The following list provides the tool’s full name followed by the name to type from the Command Prompt to launch the tool:

  • Active Directory Federation Services – adfs.msc
  • Active Directory Rights Management Services – adrms.msc
  • Active Directory Sites and Services – dssite.msc
  • Active Directory Users and Computers – dsa.msc
  • Add Hardware – hdwwiz.cpl
  • ADSI Edit – adsiedit.msc
  • Authorization Manager – azman.msc
  • Certificates [Current User] – certmgr.msc
  • Certificate Templates - certtmpl.msc
  • Certification Authority - certsrv.msc 
  • Component Services – comexp.msc
  • Computer Management – compmgmt.msc
  • Control Panel Network Connections – ncpa.cpl
  • Date and Time – timedate.cpl
  • Device Manager – devmgmt.msc
  • DFS Management – dfsmgmt.msc
  • DHCP – dhcpmgmt.msc
  • Disk Management – diskmgmt.msc
  • Display Settings – desk.cpl
  • DNS Manager – dnsmgmt.msc
  • Enterprise PKI – pkiview.msc
  • Event Viewer – eventvwr.msc
  • Failover Cluster Management – CluAdmin.msc
  • File Server Resource Manager – fsrm.msc
  • Hyper-V Manager – virtmgmt.msc
  • Indexing Service – ciadv.msc
  • Internet Information Services (IIS) 6.0 Manager – iis6.msc
  • Internet Information Services (IIS) Manager – iis.msc
  • Internet Properties – inetcpl.cpl
  • Local Group Policy Editor – gpedit.msc
  • Local Security Policy – secpol.msc
  • Local Users and Groups – lusrmgr.msc
  • Microsoft Fax Service Manager – fxadmin.msc
  • Mouse Properties – main.cpl
  • NAP Client Configuration – napclcfg.msc
  • Network Policy Server – nps.msc
  • Network Properties - ncpa.cpl
  • Power Options – powercfg.cpl
  • Print Management – printmanagement.msc
  • Programs and Features - appwiz.cpl
  • Reliability and Performance Monitor – perfmon.msc
  • Remote Desktops – tsmmc.msc
  • Removable Storage – ntmsmgr.msc
  • Removable Storage Operator Requests – ntmsoprq.msc
  • Resultant Set of Policy – rsop.msc
  • Routing and Remote Access Management – rrasmgmt.msc
  • Server Manager – servermanager.msc
  • Services – services.msc
  • Share and Storage Management – storagemgmt.msc
  • Shared Folders – fsmgmt.msc
  • Sound – mmsys.cpl
  • Storage Explorer – storexpl.msc
  • System Properties – sysdm.cpl
  • Task Scheduler – taskschd.msc
  • Telephony – tapimgmt.msc
  • Terminal Services Configuration - tsconfig.msc
  • Terminal Services Manager - tsadmin.msc
  • Trusted Platform Module (TPM) Management – tpm.msc
  • TS Gateway Manager - tsgateway.msc
  • TS RemoteApp Manager – remoteprograms.msc
  • UDDI Services Console – uddi.msc
  • Windows Deployment Services – wdsmgmt.msc
  • Windows Firewall – firewall.cpl
  • Windows Firewall – ws.msc
  • Windows Server Backup – wbadmin.msc
  • Windows System Resource Manager – wsrm.msc
  • WINS – winsmgmt.msc
  • WMI Control – wmimgmt.msc
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Interesting, but the real issue is running explorer.exe.

    The old iexplore.exe hack no longewr works in Win 7.

    --------------

    I think you have them confused. To run Windows Explorer, you can type Explorer. To run Internet Explorer, you type iexplore. If you are at a Command Prompt, or even a Windows PowerShell prompt, you type Start iexplore and you are there.

  • I am really missing the ability to run a command prompt as an admin and then running "explorer /separate". Made it soooo easy to do administrative work without logging off the user. It sucks that Win7 seems to lack this ability. Using runas for every individual process isn't viable most of the time, like when you're trying to install software.

  • >I think you have them confused.

    >To run Windows Explorer, you can type Explorer.

    >To run Internet Explorer, you type iexplore.

    I think that you are the confused one.

    I am refering to the old hack where you could run iexplore .exe under a different security context.

    This has always worked well with XP et al, but was blocked in Vista/Win 7.

    There is another workaround, look for a utility called Explorer++

    It has many nice features, like tabs, but the best is that you can right-click and "Run as administrator".

    It works.

Page 1 of 1 (3 items)