How to find VMware ESX(i) servers that need a reboot using PowerCLI

If you install patches to your ESX(i) servers you will probably have to reboot them. But if you don’t reboot them right after installing the patches, how can you find the servers that are patched and waiting for a reboot?

VMWare ESX(i) servers that are waiting for a reboot have the “Reboot Required” message in the Summary tab in the VMware vSphere Client. But if you have hundreds of ESX(i) servers, you don’t want to click through all your ESX(i) servers Summary tabs. You need to automate this task.

The PowerCLI one-liner from listing 1 will show you the names of all the ESX(i) servers that need a reboot.

Get-View -ViewType HostSystem -Property Name,Summary.Rebootrequired -Filter @{"Summary.RebootRequired"="True"} | Select-Object -Property Name

Listing 1. PowerCLI script to list the names of the ESX(i) servers that need a reboot

Advertisements

About Robert van den Nieuwendijk
Robert van den Nieuwendijk is a freelance senior systems engineer with over 30 years of experience in the IT industry. He focusses on VMware vCloud Suite and Microsoft Windows Server. He tries to automate as much of his work as possible using Microsoft PowerShell. Robert is the author of the books “Learning PowerCLI” and “Learning PowerCLI – Second Edition.” Robert is a frequent contributor and moderator at the VMware VMTN Communities. He has a bachelor degree in software engineering and holds the following IT certifications and accreditations: VSP 2016, VTSP 2016, VCP4-DCV, VCP5-DCV, VCP6-Cloud, VCP6-CMA, VCA-Cloud, VCA-WM, VCA-NV, VMSP, VMTSP, ZCS, ZCP, ZCP-Cloud, MCSE, MCSA, MCP, MCP+I, PRINCE2 Foundation and ITIL Foundation. In 2012, 2013, 2014, 2015, 2016 and 2017 Robert received the VMware vExpert award for his contribution to the community of VMware users over the past year. PernixData made him in 2015 a member of the PernixPro.

3 Responses to How to find VMware ESX(i) servers that need a reboot using PowerCLI

  1. Pingback: The Need To Reboot ESXi Hosts After vCenter Upgrade | Long White Virtual Clouds

  2. Pingback: vCoffee Links #13 – Lots of good vStuff!!! » vHersey - VCDX Two to the Seventh Power (#128)

  3. Pingback: PowerShell/PowerCLI to Find ESX Hosts Needing a Reboot – Phasmid LLC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: