Implementing Remote Shutdown in Windows XP

  
In Windows XP, a new command-line tool "shutdown" has been added, which is used to "shut down or restart a local or remote computer." With it, we can not only log off the user, shut down or restart the computer, but also realize the timed shutdown and remote shutdown.

The syntax of the command is as follows:

shutdown [-i | -l| -s | -r | -a] [-f] [-m [\\\\ComputerName]] [-t xx] [-c "message"] [-d[u][p]:xx:yy]

where, The meaning of each parameter is:

-i The dialog box for displaying the graphical interface.
-l Log out of the current user, this is the default setting.
-m ComputerName takes precedence.
-s Turn off your computer.
-r Restart after rebooting.
-a Aborting is closed. Except for -l and ComputerName, the system ignores other parameters. You can only use -a during the timeout period.
-f Forces the application to be shut down.
-m [\\\\ComputerName] Specifies the computer to shut down.
-t xx Set the timer for system shutdown to xx seconds. The default is 20 seconds.
-c "message" Specifies the message that will be displayed in the "Messages" area of ​​the "System Shutdown" window. You can use up to 127 characters. The message must be included in quotes.
-d [u][p]:xx:yy Lists the reason codes for system shutdown.

First, let's look at some of the basic usage of this command:

1, log off the current user
shutdown - l
This command can only log out users of the machine, remote The computer does not work.

2, shut down the local computer
shutdown - s

3, restart the local computer
shutdown - r

4, time off
shutdown - s -t 30
Specifies to automatically shut down the computer after 30 seconds.


5, to suspend the computer shut down

sometimes we set the computer time off, if for some reason want to cancel the shutdown operation, you can use shutdown - a to stop. For example:

shutdown -s – t 300 Set the computer to turn off after 5 minutes.
Shutdown – a Cancel the above shutdown operation.

These are some basic application shutdown command in this machine. As we mentioned earlier, in addition to shutting down and restarting the local computer, the command is more important to operate the remote computer, but how can it be achieved?

In the format of the command, there is a parameter [-m [\\\\ComputerName], which can be used to specify the name of the computer to be shut down or restarted. If omitted, the default is to operate on this machine. You can try it with the following command:

shutdown –s –m \\\\sunbird -t 30

Shut down the machine named sunbird in 30 seconds; Note: sunbird is in LAN A computer that also has Windows XP.

but the command is executed, the computer sunbird little reaction at all, but on the screen prompts "Access is denIEd (Access Denied)."

Why is this happening? In the default security policy of Windows XP, only the users of the administrator group have the right to shut down the computer from the remote end. In general, when we access the computer from other computers in the LAN, only the guest user authority, so when When we execute the above command, we will see "Access Denied". After

found the root of the problem, the solution is very simple, as long as your guest user permissions to the remote shutdown gives the client computer (the remote computer can be turned off, as described above sunbird). This can be done using the "Local Security Policy" in Windows XP's "Group Policy" or "Administrative Tools". The following takes "Group Policy" as an example:

1. Click the "Start" button, select "Run", enter "gpedit.msc" in the dialog box, and then click "OK", ie The Group Policy Editor can be opened.

2. In the left pane of the Group Policy window, expand Computer Configuration→Windows Settings→Security Settings→Local Policies→User Rights Assignment.

3. In the right pane of the Group Policy window, select Force Shutdown from Remote System and open it by double-clicking it.
4, in the pop-up dialog box, it is displayed that only members of the "Administrators" group have the right to shut down from the remote; click the "Add User or Group" button at the bottom of the dialog box, and then enter in the new pop-up dialog box "guest", then click the "OK" button. As shown in Figure 9.

5, when the "force shutdown from a remote system," the property will add a "guest" user, click "OK".

6, close the "Group Policy" window. After

Through the above operations, we would give the guest computer sunbird user granted permission to the remote shutdown. In the future, if you want to remotely shut down the computer sunbird, just enter the following command on another computer with Windows XP on the network:

shutdown -s –m \\\\sunbird -t 30 (Other parameters are the same as above) )

Figure 9

time, displayed on the screen of a computer sunbird "system shutdown" dialog box that prompts "system will shut down. Please save all running work, then Logout. Unsaved changes will be lost. Shutdown is initiated by sunbird\\guest.” There is also a timer at the bottom of the dialog that shows how much time is left from shutdown. While waiting for the shutdown, the user can also perform other tasks, such as closing the program, opening the file, etc., but cannot close the dialog unless you use the shutdown –a command to abort the shutdown task.
Copyright © Windows knowledge All Rights Reserved