# Platform Set Power State Subcommand

access: Administrators, Managers

Provides the ability to turn the platform power on or off from within a script. However, there are equivalent, less destructive commands available. (If the platform drivers are installed, use platform set os state shutdown to gracefully shut down the system.) This command does not notify the platform operating system of the request via the provided channels. The platform set power state command either abruptly removes power, or forces the platform into a panic shutdown. This command is equivalent to pressing the power button for less than 1 second or for more than 5 seconds (-f argument).

> platform set power state [{-W|--nowait}] [{-f|--forced}]
> [{-t|--timeout} TIME] {off|on|cycle}

Arguments | Description
--- | ---
{-W | --nowait} | If specified, the command returns immediately instead of waiting for the operation to complete.
{-f | --forced} | Results in a hard power off. Forces the power off or resets the system after a timeout (several minutes) if the platform has not responded, or immediately if the platform is not in the running os state (no drivers are installed or system has crashed).
{-t | --timeout} | Specifies the maximum time to wait for the operation to complete (in seconds).
`{off | on | cycle}` | Specifies whether to turn the platform power on or off or to cycle. Specifying the cycle argument causes platform power to be turned off, then on.

The platform set os state command waits for the platform to boot; the platform set power state command only waits for the power to come on.

Return Codes

Following are the return values for this command:

Code | Numeric Code | Description
--- | --- | ---
NWSE_Success | 0 | Command successfully completed.
NWSE_InvalidUsage | 1 | Invalid usage: bad parameter usage, conflicting options specified.
NWSE_RPCTimeout | 2 | Request was issued, but was not serviced by the server. RPC procedure timed out and the request may or may not have been serviced by the server.
NWSE_RPCNotConnected | 3 | Unable to connect to the RPC server.
NWSE_NoPermission | 6 | Not authorized to perform this operation.
NWSE_MissingArgument | 7 | Missing argument(s).
NWSE_TimedOut | 23 | Operation timed out.

Related Topics

System Management Commands

Platform Command