We recently noticed some hosts in our environment that show an alert triggered by ‘Status of other host hardware objects’. Upon further investigation it turned out that this was caused by the system event log (SEL) that is about to run out of space.

Now if you don’t mind not having a bit of history of your hardware-related events you can easily clear it and there’s even a function in vCenter that lets you do that. However it turns out that – at least in vCenter 6.7 U2 – the reset function doesn’t actually perform a reset but a refresh instead.

Using the code capture shows this behavior. And this clearly NOT what we intended.

Luckily the vSphere Web Services API documentation clearly shows that there’s a ClearSystemEventLog method. So what’s to stop us from writing a simple PowerCLI function? Well……. actually nothing.

Once you enter this function in a powershell session and log on to your vCenter you can pass a list of ESXi hosts to this function with Get-VMHost and it will clear the system event log. Just like this.



    1. Hi, the code capture functionality is a button that you can enable in the Development Center settings on the vCenter to allow you to capture code for anything you are doing in the UI. I hope this helps. For more information have a look at: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vcenterhost.doc/GUID-0E74A054-4E4C-45E7-B0F2-0320834C9DAB.html#:~:text=Code%20Capture%20gives%20you%20the,vCenter%20Server%20calls%20are%20recorded.

  1. In the function call why are we passing ‘-Name SomeHost’ ? By default, Get-VMhost return all the hosts, the same is piped to the function and the loop inside would take care of each hosts right?


Leave a Reply

Your email address will not be published. Required fields are marked *