The Get-WURebootStatus cmdlet in PowerShell is used to get Windows update reboot status. This command checks if a reboot is required.
The Get-WURebootStatus command checks
- If a restart is necessary
- If a restart is necessary. If yes, then schedule it.
In this article, we will discuss how to use the PowerShell command Get-WURebootStatus to get Windows update reboot status on the local and remote computer.
How to Check If a Restart is Necessary using Get-WURebootStatus
Use the following PowerShell command to get the Windows update status and check if a reboot is required on the local computer.
Get-WURebootStatus
The output of the above PowerShell script gets the Windows reboot required status. It has a property RebootRequired
that holds the value as True or False based on reboot status.
You can use the Get-WURebootStatus
command to check if a reboot is necessary on the remote computer after Windows updates.
Run the following command that takes the remote computer name and returns the RebootRequired
status.
Get-WURebootStatus -ComputerName "INCORP-EU-DB01"
Get-WURebootStatus – Check if Restart is Required and Schedule
To check if a restart is required, use the Get-WURebootStatus
command. If it returns the RebootRequired
True, then you can schedule it using the -ScheduleReboot
parameter.
Get-WURebootStatus -ScheduleReboot (Get-Date -Hour 10 -Minute 0 -Second 0)
In the above PowerShell script, the Get-WUReboot cmdlet of the PSWindowsUpdate module checks if a reboot is required. If yes, then schedule reboot using -ScheduleReboot parameter. You can use the Get-Date cmdlet to provide the scheduled datetime.
The output of the above PowerShell script will schedule a reboot at 10 am in the morning for the current date.
Conclusion
I hope the above article on how to get the Windows update reboot status in PowerShell using the Get-WURebootStatus command is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.