PowerCLI: Report every VM added to vCenter in the last 30 days
At seemingly random intervals I get requests from management to report every Virtual Machine that was added/removed in the last x days. This has traditionally been a manual process, and one that I loath.
While deploying a VM this morning I set up my normal tell me when your done one-liner…
Get-Task|?{$_.Name -eq "CloneVM_Task"}|Wait-Task; `a`a`a
As I was typing I wondered how long a task’s history was kept, and if I could query it via the SDK? Low and behold not only can I but it’s too easy!