IT tutorials
 
Windows
 

Using Windows Home Server’s Command-Line Tools : Working with the Command-Line Tools (part 4) - Shutting Down or Restarting a Computer

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
5/29/2013 7:38:11 PM
SHUTDOWN: Shutting Down or Restarting a Computer

You can use the SHUTDOWN command to restart or shut down either the Windows Home Server computer or a remote computer on your network. Here’s the syntax:

SHUTDOWN [[/R] | [/S] | [/L] | [/H] | [/I] | [/P] | [/E] | [/A]] [/F| [/T seconds]
 [/D [P:]xx:yy] [/M \\ComputerName] [/C "comment"]

/RRestarts the computer.
/SShuts down the computer.
/LLogs off the current user immediately.
/HPuts the computer into hibernation, if the computer supports hibernation mode.
/IDisplays the Remote Shutdown dialog box, which enables you to specify many of the options provided by these switches.
/PTurns off the local computer immediately (that is, without the usual warning interval).
/EEnables you to document the reason for an unexpected shutdown. (Note that this switch does not work in Windows Home Server.)
/ACancels the pending restart or shutdown.
/FForces all running programs on the target computer to shut down without warning. This, obviously, is dangerous and should only be used as a last resort.
/D [P:]major:minor]Specifies the reason for the shutdown. Include P: to indicate the shutdown is planned. Use values between 0 and 255 for major and between 0 and 65535 for minor. Windows Home Server also defines a number of predefined values for the major and minor parameters:
 majorminorReason
 00Other (Planned)
 05Other Failure: System Unresponsive
 11Hardware: Maintenance (Unplanned)
 11Hardware: Maintenance (Planned)
 12Hardware: Installation (Unplanned)
 12Hardware: Installation (Planned)
 23Operating System: Upgrade (Planned)
 24Operating System: Reconfiguration (Unplanned)
 24Operating System: Reconfiguration (Planned)
 216Operating System: Service Pack (Planned)
 217Operating System: Hot Fix (Unplanned)
 217Operating System: Hot Fix (Planned)
 218Operating System: Security Fix (Unplanned)
 218Operating System: Security Fix (Planned)
 41Application: Maintenance (Unplanned)
 41Application: Maintenance (Planned)
 42Application: Installation (Planned)
 45Application: Unresponsive
 46Application: Unstable
 515System Failure: Stop Error
 519Security Issue
 519Security Issue
 519Security Issue
 520Loss of Network Connectivity (Unplanned)
 611Power Failure: Cord Unplugged
 612Power Failure: Environment
 70Legacy API Shutdown
/M \\ComputerNameSpecifies the remote computer you want to shut down.
/T secondsSpecifies the number of seconds after which the computer is shut down. The default is 30 seconds, and you can specify any number up to 600.
/C "comment"The comment text (which can be a maximum of 127 characters) appears in the dialog box and warns the user of the pending shutdown. This comment text also appears in the shutdown event that is added to the System log in Event Viewer. (Look for an Event ID of 1074.)

For example, to restart the local computer in 60 seconds, use the following command:

shutdown /r /t 60

When you enter the SHUTDOWN command, a System Shutdown dialog box appears and counts down to the shutdown time (see Figure 19.4, later in this section).

To document the shutdown, add the /D and /C switches, as in this example:

shutdown /s /d p:1:2 /c "Installing internal hard drive"

The reason code given by the /D switch and the comment specified by the /C switch appear in the event that Windows Home Server generates for the shutdown. You can see this event by launching Event Viewer (select Start, Administrative Tools, Event Viewer), opening the System log, and looking for a recent item with Event ID of 1074. Figure 1 shows an example.

Figure 1. A shutdown event records the reason and comment that you specified with the SHUTDOWN command’s /P and /C switches.

To shut down or restart a remote computer, you must run SHUTDOWN using the remote computer’s Administrator account. This requires you to use the RUNAS command-line tool:

RUNAS /user:ComputerName\UserName cmd

ComputerNameThe name of the remote computer.
UserNameThe name of the account under which you want to run cmd.
cmdThe command you want to run.

For running SHUTDOWN with the /M switch, UserName will be Administrator and cmd will be the SHUTDOWN command, enclosed in quotation marks. Here’s an example that shuts down a remote computer named OFFICEPC in 120 seconds:

runas /user:officepc\administrator "shutdown /s /m \\officepc /t 120"

When you enter the RUNAS command, Windows Home Server prompts you for the account password:

Enter the password for officepc\administrator:

Type the password (it doesn’t appear onscreen), and press Enter.

Tip

If you need to embed a quotation mark in the cmd portion of RUNAS, precede it with a backslash (\). Here’s an example:

runas /user:officepc\administrator "shutdown /s /m \\officepc /c \"Comment\""

					  


This works fine on XP machines but not on Windows 7 and Vista PCs, because the Administrator account is disabled by default on Windows 7 and Vista systems. Here are the steps to follow to enable this account and set its password:

1.
On the Windows 7 or Vista machine, press Windows Logo+R (or select Start, All Programs, Accessories, Run) to open the Run dialog box, type lusrmgr.msc, and click OK.

2.
If you see the User Account Control dialog box, enter your credentials to continue.

3.
In the Local User and Groups snap-in, click Users.

4.
Double-click the Administrator account to open its property sheet.

5.
Deactivate the Account Is Disabled check box, and then click OK.

6.
Right-click the Administrator account, and then click Set Password. Windows warns you that changing an account password can cause problems.

7.
You can ignore the warning in this case, so click Proceed to open the Set Password for Administrator dialog box.

8.
Type the password in the New Password and Confirm Password text boxes, and then click OK.

Figure 2 shows an example of the dialog box that Windows 7 users see when the shutdown event is launched. Figure 3 shows the XP dialog box, which is also what the dialog box looks like on Windows Home Server.

Figure 2. This is what a Windows 7 user sees when you start the shutdown process from a remote computer.


Figure 3. This is what a Windows XP user sees when you start the shutdown process from a remote computer.


If you need to cancel a pending shutdown on a remote computer, run SHUTDOWN with the /A switch before the timeout interval is over:

runas /user:officepc\administrator "shutdown /a /m \\officepc"
 
Others
 
- Using Windows Home Server’s Command-Line Tools : Working with the Command-Line Tools (part 3)
- Using Windows Home Server’s Command-Line Tools : Working with the Command-Line Tools (part 2) - Working with File and Folder Management Tools
- Using Windows Home Server’s Command-Line Tools : Working with the Command-Line Tools (part 1) - Working with Disk Management Tools
- Windows 8 : Security - Action Center
- Windows 8 : Security - Windows Defender
- Windows Vista : Exploring Expert File and Folder Techniques - Customizing Windows Explorer
- Windows Vista : Exploring Expert File and Folder Techniques - Shadow Copies and Transactional NTFS
- Windows Vista : Exploring Expert File and Folder Techniques - Grouping, Stacking, and Filtering with Metadata
- Windows 7 : Troubleshooting Your Internet Connection (part 5)
- Windows 7 : Troubleshooting Your Internet Connection (part 4) - Identifying Network Hardware Problems
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us