Restart-Pcsv
Device
Syntax
Restart-PcsvDevice
[-TimeoutSec <UInt32>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Restart-PcsvDevice
[-TargetAddress] <String>
[-Credential] <PSCredential>
[-ManagementProtocol] <ManagementProtocol>
[[-Port] <UInt16>]
[-Authentication <Authentication>]
[-UseSSL]
[-SkipCACheck]
[-SkipCNCheck]
[-SkipRevocationCheck]
[-TimeoutSec <UInt32>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Restart-PcsvDevice
-InputObject <CimInstance[]>
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-PassThru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Restart-PcsvDevice cmdlet restarts a device remotely by using Web Services for Management (WS-Management) or Intelligent Platform Management Interface (IPMI). The cmdlet restarts the device if the current state of the device is enabled, or starts the device if the current state is other than enabled. If you specify a device that is a Baseboard Management Controller (BMC), the cmdlet restarts the system that the BMC manages, and not the BMC.
Examples
Example 1: Restart a remote IPMI hardware device
PS C:\> $Credential = Get-Credential Admin
PS C:\> Restart-PCSVDevice -TargetAddress 10.0.0.29 -ManagementProtocol IPMI -Credential $Credential
Confirm
Are you sure you want to perform this action?
Performing operation 'Changing state of machine' on Target '10.10.0.29'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
This example restarts an IPMI device remotely.
The first command uses the
Get-Credential
cmdlet to create a credential, and then stores it in the
$Credential
variable.
The cmdlet prompts you for a user name and password.
For more information, type
Get-Help Get-Credential
.
The second command connects with the target computer that has the IP address 10.0.0.29 by using the IPMI management protocol The command specifies the credential object stored in the $Credential variable. The command prompts the user for confirmation because restarting the system can cause a loss of unsaved state.
Example 2: Restart an IPMI device remotely by using an object variable
PS C:\> $Credential = Get-Credential Admin
PS C:\> Get-PcsvDevice -TargetAddress 10.0.0.29 -ManagementProtocol IPMI -Credential $Credential | Restart-PcsvDevice -Confirm $False
This example restarts an IPMI device remotely by using an object variable to specify the device.
The first command uses the
Get-Credential
cmdlet to create a credential, and then stores it in the
$Credential
variable.
The cmdlet prompts you for a user name and password.
For more information, type
Get-Help Get-Credential
.
The second command uses the Get-PcsvDevice cmdlet to connect with the target computer that has the IP address 10.0.0.29 by using the IPMI management protocol and the credential object stored in the $Credential variable. The command gets the remote device object and passes the object to the Restart-PcsvDevice cmdlet by using the pipeline operator. The Restart-PcsvDevice cmdlet restarts the remote device. The command sets the Confirm parameter to $False so the cmdlet does not prompt the user for confirmation to restart the device.
Required Parameters
Specifies a
PSCredential
object based on a user name and password.
To obtain a
PSCredential
object, use the
Get-Credential
cmdlet.
For more information, type
Get-Help Get-Credential
.
This parameter specifies the credential for the remote hardware device.
Type: | PSCredential |
Position: | 2 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the input object that is used in a pipeline command.
Type: | CimInstance[] |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByValue) |
Accept wildcard characters: | False |
Specifies a management protocol used to communicate with a device. The acceptable values for this parameter are:
- WSMAN
- IPMI
Specify WSMAN for WS-Management devices that represent information by using Systems Management Architecture for Server Hardware (SMASH), Desktop and mobile Architecture for System Hardware (DASH) or Physical Computer System View profiles. Refer to your hardware documentation for supported management protocols.
Type: | ManagementProtocol |
Aliases: | MP |
Parameter Sets: | WSMan, IPMI |
Position: | 3 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the name or IP address of the management port on the remote hardware device. For server hardware, this is typically a dedicated Baseboard Management Controller (BMC) IP address. For other devices, like network switches, this is the IP address of their management port. For desktop and mobile devices, the BMC sometimes shares the same IP address as the computer.
Type: | String |
Aliases: | CN, ComputerName, IpAddress |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Optional Parameters
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies an authentication method to use for devices managed by WS-Management. Do not specify this parameter for devices managed by using IPMI. The acceptable values for this parameter are:
- Basic
- Digest
-
Default
If you specify Default for this parameter and a value of WSMAN for the ManagementProtocol parameter, the cmdlet uses Basic authentication.
Type: | Authentication |
Parameter Sets: | Default, Basic, Digest |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
Type: | CimSession[] |
Aliases: | Session |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies a port on the remote computer to use for the management connection. If you do not specify a port, the cmdlet uses the following default ports:
- IPMI and WSMAN over HTTP. Port 623.
- WSMAN over HTTPS. Port 664
Type: | UInt16 |
Position: | 4 |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Indicates that the client connects by using HTTPS without validating that a trusted CA signed the server certificate.
Do not specify this parameter unless you can establish trust in another way, such as if the remote computer is part of a network that is physically secure and isolated, or if the remote computer is a trusted host in a Windows Remote Management (WinRM) configuration. Do not specify this parameter if you specify a value of IPMI for the ManagementProtocol parameter.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Indicates that the certificate common name of the server does not need to match the host name of the server.
Specify this parameter only for managing devices by using WS-Management over HTTPS. Be sure to specify this parameter only for trusted computers. Do not specify this parameter if you specify a value of IPMI for the ManagmentProtocol parameter.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Indicates that the cmdlet skips the revocation check of server certificates. Do not specify this parameter if you specify a value of IPMI for the ManagmentProtocol parameter.
Be sure to specify this parameter only for trusted computers.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
If this parameter is omitted or a value of
0
is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies how long to wait, in seconds, for a response from the remote hardware device. After this period, the cmdlet abandons the connection attempt.
Type: | UInt32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Indicates that the server connects to the target computer by using SSL. WS-Management encrypts all content transmitted over the network. Specify this parameter to use the additional protection of HTTPS instead of HTTP. If you specify this parameter and SSL is not available on the connection port, the command fails.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Outputs
Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/HardwareManagement/MSFT_PCSVDevice
The cmdlet only returns an MSFT_PCSVDevice object if you specify the PassThru parameter.