Hi Guys,
I am migrating some hosts between 2 different virtual centers and will have all incoming vm's on the new virtual center added to the "Discovered virtual machine" folder by default. I am trying to use powercli to move the linux vm's to a specific folder and windows vm's to another folder. However, I have been unable to do this and was hoping someone on here can help. I am new to using powercli. Here is what I have been trying:
Get-Datacenter "XXX" | Get-Folder "Discovered virtual machine" | get-vm | Where-Object {$_.PowerState -eq "PoweredOn"} | get-vmguest | Where-Object {$_.OSFullName -like "*Linux*"} | Move-VM -Destination "Linux"
Looks like move-vm does not like the input it is getting from get-vmguest. However, it does like the input from get-vm but I can't seem to get a list of just linux vm's using the get-vm command. Any help would be appreciated.
Thanks,
-Simran
Get-Datacenter "XXX" | Get-Folder "Discovered virtual machine" | get-vm | Where-Object {$_.PowerState -eq "PoweredOn" -and $_.ExtensionData.Config.GuestFullName -like "*Linux*"} | Move-VM -Destination "Linux"
Get-Datacenter "XXX" | Get-Folder "Discovered virtual machine" | get-vm | Where-Object {$_.PowerState -eq "PoweredOn" -and $_.ExtensionData.Config.GuestFullName -like "*Linux*"} | Move-VM -Destination "Linux"
Thanks for your response. That worked and was exactly what I was looking for. Much appreciated!
Regards,
-Simran