PowerCLI Command to Reload a VMX
Have you ever been in a situation where you've needed to reload a VM's VMX file? It's not very common, but it does happen occasionally. VMware has a KB Article about how to do it, but it requires vim-cmd, which means that you need access to the host's CLI. This isn't that big of a deal, unless you need to reload a lot of VMs that are scattered across many ESXi hosts. Fortunately, Techazine has posted an article about a technique that reloads all invalid VMs via PowerCLI. In my use case, I only needed to target a small set of VMs, so I just used that technique as follows:
@("VM1","VM2","VM3") | % {(get-vm $_ | get-view).reload()}
@("VM1","VM2","VM3") | % {(get-vm $_ | get-view).reload()}
Nice! Works well, VMWare should document this method, very useful for multiple ESXi hosts or quickly targeting a single VM
ReplyDelete