Can anyone tell me how I can just add 1 VM to inventory in vCenter?
I found a bunch of big scripts, but they just seem excessive.
Thanks,
Scott
Do you mean creating a new VM ?
That can be done with the New-VM cmdlet.
Or do you mean registering a VM from the .vmx file ?
My Raiders of the Lost VMX post has a script for that.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Do you mean creating a new VM ?
That can be done with the New-VM cmdlet.
Or do you mean registering a VM from the .vmx file ?
My Raiders of the Lost VMX post has a script for that.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I do mean registering a VM with the .vmx file.
Thanks that's an impressive script. But is there an easy way to do this for just 1 VM and point to the location of the vmx file?
Not that I know of.
The only method I know is the RegisterVM_Task (which is used in the script)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK. Thanks for your help.
Hey, guys-
There _is_ another way. There is a "RegisterVM" ParameterSet on the New-VM cmdlet that allows for registering VMs via their .vmx file. Specifically, the "-VMFilePath" parameter allows you to register a VM by specifying a datastore path to a valid .vmx file. So, something like:
## add VM to inventory on given random host in given folder
New-VM -VMFilePath "[datastore0] myVM01/myVM01.vmx" -VMHost (Get-Cluster MyCluster | Get-VMHost | Get-Random) -Location (Get-Folder MyFolder) -RunAsync
I have not been able to pinpoint just when that parameter was added to the New-VM cmdlet, but from what I can tell, it was within the last few releases -- looks like it was there in PowerCLI v4.0u1. Could not find much (anything) about it in the release notes, though.
We posted about it over at vNugglets a bit ago: http://vnugglets.com/2011/01/re-registering-vms-removed-from.html. It definitely comes in handy now and again.
How does that do for you, scotty p?
This is great!!! Excactly what I was looking for.
Thanks a lot!
Hi,
is it possible to read a *.VMX file and determine if the VM is linux? then add the VM to inventory on linux-cluster?
KR
extremely curious
Not really.
You can specify whatever you want for GuestId.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference