PowerCLI: Get 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…

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!


6 thoughts on “PowerCLI: Get every VM added to vCenter in the last 30 Days!”

  1. Hi,

    I suppose it was you who made the correction on the page linking to your script here?
    If so, thanks for it.

    It was not my intention to make it look like it was me who was the author (which is why there was a read more and a link to this page) I will be careful to NOT copy the first few sentences of a blogs content anymore and write in my own words what the script is about. I should have corrected it, but it slipped through.

    Beginners mistake. Hope you forgive me. If you want me to remove links to your scripts, then that’s possible as well, just drop me a line.



  2. Hi Wil,

    I edited the page on your wiki. It wasn’t meant to be a “slap” or anything, I am very sorry if it came across that way. (Glenn scolded me this morning for being rude about it…)

    I was actually hoping to get a response from you…mostly I wanted to make sure that there is an actual person doing the editing and not a “bot” doing RSS poaching.

    You are most certainly forgiven, and I don’t think either Glenn or I mind you posting anything we have here, it’s just good to know that it’s actually looked at instead of blindly copied.

    Sorry again for any hurt feelings, it was not my intention.


  3. Brilliant! No hurt feelings here and thanks for adding such a nice description of your script. I was just about to do that only to find out that you already did so. 😀

    BTW, also added your opening oneliner to the list of oneliners 😉


  4. Can you please tell me how to actually use this script? Trying it ‘as is’ generates an error around parameter declarations. Cheers.

    • Doug,
      Sorry about that, I was using some V2 enhancements. I’ve updated the script to be backwards compatible with PowerShell V1.



Leave a Reply