Test‑PendingRestart - dsccommunity/DscResource.Common GitHub Wiki
SYNOPSIS
Tests if the computer is pending a restart.
SYNTAX
Test-PendingRestart [[-Check] <PendingRestartCheck>] [<CommonParameters>]
DESCRIPTION
This function checks various registry locations, the Component-Based Servicing, Windows Update, Pending File Rename Operations, Pending Computer Rename, Pending Domain Join, and SCCM Client to determine if the computer is pending a restart.
EXAMPLES
EXAMPLE 1
Test-PendingRestart
Returns $true if the computer is pending a restart, otherwise returns $false.
EXAMPLE 2
Test-PendingRestart -Check WindowsUpdate, ComponentBasedServicing
Checks only Windows Update and Component-Based Servicing for pending restarts. Returns $true if either condition requires a restart, otherwise returns $false.
PARAMETERS
-Check
Specifies which pending restart checks to perform. Multiple values can be specified by using the bitwise OR operator. By default, all checks are performed.
Available options are:
- ComponentBasedServicing: Checks Component-Based Servicing registry key
- WindowsUpdate: Checks Windows Update Auto Update registry key
- PendingFileRename: Checks PendingFileRenameOperations registry key
- PendingComputerRename: Checks for pending computer rename
- PendingDomainJoin: Checks for pending domain join
- ConfigurationManagerClient: Checks Configuration Manager client for pending reboots
- All: Performs all checks (default)
Type: PendingRestartCheck
Parameter Sets: (All)
Aliases:
Accepted values: ComponentBasedServicing, WindowsUpdate, PendingFileRename, PendingComputerRename, PendingDomainJoin, ConfigurationManagerClient, All
Required: False
Position: 1
Default value: All
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
[System.Boolean]
NOTES
This command checks for the following conditions:
- Windows Update Auto Update (RebootRequired)
- Component-Based Servicing (RebootPending)
- Pending File Rename Operations
- Pending Computer Rename
- Pending Domain Join
- Pending SCCM Client Reboot