UtilPowerRestart Method

Restarts the specified computer.

Definition

Namespace: DevCase.Core.IO.Devices.Power
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static bool Restart(
	string computer = "",
	int timeout = 0,
	string message = "",
	ShutdownMode mode = ShutdownMode.Wait,
	ShutdownReason reason = ShutdownReason.Other,
	ShutdownPlanning planning = ShutdownPlanning.Unplanned,
	bool ignoreErrors = true
)

Parameters

computer  String  (Optional)
The name of the computer to restart.

If the value of this parameter is an empty string, the local computer is shut down.

This parameter can be an addres, for example: 127.0.0.1

timeout  Int32  (Optional)
The number of seconds to wait before restarting the computer.

If the value of this parameter is zero, the computer is restarted immediately.

This value is limited to MaxShutdownTimeout.

message  String  (Optional)
The message to be displayed in the interactive restart dialog box.
mode  ShutdownMode  (Optional)
Indicates whether to force the restart.
reason  ShutdownReason  (Optional)
The reason for initiating the restart. By default, it is also an 'unplanned' restart.

If this parameter is zero, the default is an undefined restart that is logged as "No title for this reason could be found".

planning  ShutdownPlanning  (Optional)
Indicates whether it's a planned or unplanned restart operation.
ignoreErrors  Boolean  (Optional)
If , a Win32Exception exception will be thrown if error found.

Return Value

Boolean
if the restart operation is initiated correctlly, otherwise.

Example

This is a code example that tries to restart the operating system, then abort the restart operation.
C#
No code example is currently available or this language may not be supported.

Exceptions

ArgumentException Timeout should be zero or greater than zero.;timeout
Win32Exception

See Also