Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use psexec to run a batch script on remote machines.The batch script is used to setup my web application and starts and stops IIS during setup.

The script works fine but it fails while stopping and starting IIS.The account I use for remote connection is an admin on that box.

Could someone tell me how to start to start the script as an administrtor using psexec?

share|improve this question
up vote 0 down vote accepted

If you have Windows 7 clients and or Windows Server 2008, another option to explore is WinRM (Windows Remote Management) and WinRS (Windows Remote Shell).

They do need configuring however. I know you've settled on psexec already, I'm just offering additional info. :)

Really quickly you need to execute winrm quickconfig on the machine that you wish to control. This quickstart command alters a number of settings throughout the system so it's worth investigating if your security policies allow this before you run it.

Once run, you can use WinRS like this:

WinRS -r:Computername ipconfig

You can, if you don't already have permissions on the target system, run the command with other credentials.

WinRS -r:Computername -u:Username -p:Password ipconfig

You can also use PowerShell commands on remote machines configured for remote management. From within Powershell management

Invoke-Command hostname {powershell-command} or icm hostname {powershell-command}

If you have the right infrastructure, WinRM and WinRS can replace the need for psexec.

Cheers Lewis

share|improve this answer


If I want to run myprog.bat as Administrator on REMOTECLIENT, I'd issue the following command:

psexec \\REMOTECLIENT -u Administrator myprog.bat

It will prompt you for the password entry. Similarly, you can provide it on the initial call using the -p parameter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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