How to shut down Windows Server 2003 without using RDP

remote-accesswindows-server-2003

I'd like to know if it is possible to shut down a Windows Server 2003 box, without have to log into the machine via remote desktop.

The server is on my network, I know the IP address and host name, as well the Administrator password.

I want to shutdown by simply double clicking a shortcut or executing a script.

How do I do this?

Best Answer

Remote shutdown...

  • Using your domain account credentials (if your user account has local admin rights on the target machine):
    shutdown /s /f /t 30 /m \\SERVER-NAME
  • Using the remote machine's local administrator account (psexec will prompt you for the password):
    psexec \\SERVER-NAME -e -h -u SERVER-NAME\administrator shutdown /s /f /t 30
  • Using a different domain account:
    psexec \\SERVER-NAME -e -h -u DOMAIN-NAME\username shutdown /s /f /t 30

Shutdown parameters explained...

  • /s = shutdown (substitute /r if you want to reboot)
  • /f = force (don't let running programs or active user sessions interfere with the reboot)
  • /t 30 = give logged in users a 30-second warning (substitute any integer, 0 is an acceptable value)
  • /m \\SERVER-NAME = specify name of remote machine to reboot

PsExec parameters explained...

  • -e = do not load user profile (user profile is unnecessary for shutdown command)
  • -h = run task with elevated privileges (only makes a difference on Vista/Win7/Server2008)
  • -u SERVER-NAME\administrator = log in as local administrator on SERVER-NAME
  • shutdown /s /f /t 30 = i

Batch file example, using local admin account... (paste into Notepad as rsla.bat)

  • @echo off
    REM rsla.bat - remote shutdown as local administrator
    REM This script is freeware authored by Miles Erickson, 7/2010.
    REM Requires PsExec.exe to be available in %PATH% (c:\windows\system32 is one option)
    REM Cannot be used to restart a domain controller (domain controllers do not have local admin accounts)
    IF (%1)==() GOTO instructions
    IF (%1)==(/?) GOTO instructions
    psexec \\\\%1 -e -h -u %1\\administrator shutdown /s /f /t 30
    GOTO end
    :instructions
    ECHO Usage: rsla SERVER-NAME    (you will be prompted for a password)
    :end
    

Links...

Related Topic