This afternoon news of a new (and interesting) blog post from Julian Wood hit the Twitter-verse.
He took part from the logic of my Raiders of the Lost VMX script and used the relatively new VMFilePath parameter of the New-VM cmdlet, to shorten my script considerable. Well done, great job !
But I was intrigued by a remark in Julian’s post. He was obviously not too fond of using MoRefs in a script. But in Julian’s final script I still saw a Get-View cmdlet and the use of the HostDatastoreBrowser. Remembering a remark from one of my co-authors on the PowerCLI book, that the Get-View cmdlet would disappear, once the PowerCLI snapin would be sufficiently evolved, I decided to tackle Julian’s script and give it another simplification treatment and make it more PowerCLI 😀
One of the more popular post in the VMTN PowerCLI community is this one HowTo search for all VMX files in all datastores and register them into VC ?
The original script that I provided in the thread is now more than one year old and there seem to be some issues with clusters in a vSphere environment.
Time to re-write the script and make it a bit more userfriendly.
Update 1: there was an issue when scanning empty datastores
Update 2: added the option to find and register Templates
Update 3 – April 29th 2010: added the option to ignore specific folders
Update 4 – April 30th 2010: fixed parent datacenter lookup problem + added -checkNFS and -whatif option
Update 5 – May 2nd 2010: fixed a bug with nested folders and the -ignore parameter
Update 6 – August 6th 2010: minor changes to the parameter testing and the Get-Usage function
Update 7 – August 17th 2010: fixed a bug with the -dsNames option. Thanks to goonzie for reporting the bug
Continue reading Raiders of the Lost VMX