PSTools

how to get the PSTools?

from here:http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

After download the PSToos, you can extra teh PSToos, thenk you will get a set of PC tools. that cotains PSshutdow,PSExec etc.

 

http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

Introduction

The Windows NT and Windows 2000 Resource Kits come with a number of command-line tools that help you administer your Windows NT/2K systems. Over time, I've grown a collection of similar tools, including some not included in the Resource Kits. What sets these tools apart is that they all allow you to manage remote systems as well as the local one. The first tool in the suite was PsList, a tool that lets you view detailed information about processes, and the suite is continually growing. The "Ps" prefix in PsList relates to the fact that the standard UNIX process listing command-line tool is named "ps", so I've adopted this prefix for all the tools in order to tie them together into a suite of tools namedPsTools.

Note: some anti-virus scanners report that one or more of the tools are infected with a "remote admin" virus. None of the PsTools contain viruses, but they have been used by viruses, which is why they trigger virus notifications.

The tools included in the PsTools suite, which are downloadable as a package, are:

  • PsExec - execute processes remotely
  • PsFile - shows files opened remotely
  • PsGetSid - display the SID of a computer or a user
  • PsInfo - list information about a system
  • PsPing - measure network performance
  • PsKill - kill processes by name or process ID
  • PsList - list detailed information about processes
  • PsLoggedOn - see who's logged on locally and via resource sharing (full source is included)
  • PsLogList - dump event log records
  • PsPasswd - changes account passwords
  • PsService - view and control services
  • PsShutdown - shuts down and optionally reboots a computer
  • PsSuspend - suspends processes
  • PsUptime - shows you how long a system has been running since its last reboot (PsUptime's functionality has been incorporated intoPsInfo)

The PsTools download package includes an HTML help file with complete usage information for all the tools.

 

========================================

The folloiwng content is about how to use PSShutdow of PSTools to reboot a PC(local or remote which you have full amdin)

PsShutdown (PsTools)

Initiate a shutdown/reboot of a local or remote computer, logoff a user, lock a system.

Syntax
      psshutdown [[\\computer[,computer[,..] | @file [-u user [-p passwd]]]
         -s|-r|-h|-d|-k|-a|-l|-o 
            [-f] [-c] [-t nn|h:m] [-n s] [-v nn]
               [-e [u|p]:xx:yy] [-m "message"]
Options:

   computer   The computer on which the user account resides. Default=local system 
              a wildcard (\\*), will affect all computers in the current domain.

   -p passwd  Specify a password for user (optional). Passed as clear text.
              If omitted, you will be prompted to enter a hidden password.

   -u user    Specify a user name for login to remote computer(optional).

   @file      Execute the command on each of the computers listed in the file.

   -a         Abort a shutdown (only possible while a countdown is in progress)

   -c         Allow the shutdown to be aborted by the interactive user

   -d         Suspend the computer

  -e [u|p]:xx:yy 
              Shutdown reason code, 'u' = user, 'p'= planned shutdown.
              xx is the major reason code (must be less than 256)
              yy is the minor reason code (must be less than 65536)

   -f         Force all running applications to exit during the shutdown
              instead of giving them a chance to gracefully save their data.

   -h         Hibernate the computer

   -k         Poweroff the computer (reboot if poweroff is not supported)

   -l         Lock the computer

  -m "message" Specify a message to logged-on users when a shutdown countdown commences

   -n         Timeout in seconds connecting to remote computers

   -o         Logoff the console user

   -r         Reboot after shutdown

   -s         Shutdown without poweroff

   -t         Countdown in seconds until the shutdown (default: 20 seconds)
              or the time of shutdown (in 24 hour notation)

   -v         Display message for the specified number of seconds before the shutdown. 
              default= display a shutdown notification dialog,
              specifying a value of 0 results in no dialog.

   -          Help, display the supported options.

This tool allows administrators to create a batch file that will run against multiple computers to perform a mass change of the administrator password.

Examples:

Reboot \\workstation64 as part of an OS upgrade

psshutdown \\workstation64 -r -e p:2:3

“I shall go the way of the open sea, To the lands I knew before you came,
And the cool ocean breezes shall blow from me, The memory of your name” ~ Laurence Hope

Related:

SHUTDOWN - With full list of reason codes
TSSHUTDN - Remotely shut down or reboot a terminal server
Powershell:
$os = (Get-WmiObject Win32_OperatingSystem -ComputerName MyServer64)
$os.psbase.Scope.Options.EnablePrivileges = $true
$os.reboot()

Equivalent bash command (Linux): shutdown - Shutdown or restart linux

 

 

 

你可能感兴趣的:(PSTools)