There's a slightly easier way now to add VMs to the vCenter inventory if you have the .VMX file location.
The New-VM cmdlet now has a new parameter -VMFilePath which allows you to specify a path to the virtual machine you want to register.
This is in the format: [mydatastore] SERVER01/SERVER01.vmx
Have a look at my blog post for more info:
Inspired by your script I created a pure PowerCLI function.
Have a look at VMX Raiders Revisited
This version will also check if there are .vmx files that are already registered.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What a fantastic addition!
Good job publicizing the parameter -VMFilePath, JulianWood. Hopefully it comes in handy for people.
Not to detract, but, for the record, it has been around for a while. We have used it in some other threads (http://communities.vmware.com/message/1737466#1737466 for example).
In trying to pinpoint when it was introduced, I did not find a definitive "Release Notes" entry. But, the first reference that I did find with that parameter available was in the PowerCLI 4.0U1 release (http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/New-VM.html).
Anyway, that is just some historical info to add, nothing to do with the usefulness that you pointed out.