Hi,
I am trying to write a PowerCli script to move a VM to a chosen folder/resource pool. I found "move-vm" is working fine against a old vCenter 6.0 instance, but doesn't work with new 6.7 VCSA for resource pool.
My code is like :
C:\>$rp=get-resourcepool "a-unique-resource-pool" -location "my-cluster"
C:\>$folder=get-Folder "a-unique-folder"
C:\>$vm=get-vm "one-vm-name"
C:\>move-vm -vm $vm -InventoryLocation $folder
### all work as expected.
C:\>move-vm -vm $vm -destination $rp
The above code works fine for vCenter 6.0, but failed on VCSA 6.7 with following error:
move-vm : 1/30/2019 5:08:43 PM Move-VM Object reference not set to an instance of an object.
At line:1 char:1
+ move-vm -vm $vm -destination $rp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-VM], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
I have tried to download the "PowerCLI 6.5 Release 1" from vmware website or directly install VMware.PowerCLI by "install-module VMware.PowerCLI", both have same problem.
"Get-InstalledModule" shows:
6.7.0.1... VMware.DeployAutomation PSGallery This Windows PowerShell module contains PowerCLI Auto Deploy cmdlets.
6.7.0.1... VMware.ImageBuilder PSGallery This Windows PowerShell module contains PowerCLI ImageBuilder cmdlets.
11.1.0.... VMware.PowerCLI PSGallery This Windows PowerShell module contains VMware.PowerCLI
6.7.0.1... VMware.Vim PSGallery This Windows PowerShell module contains PowerCLI Vim.
11.0.0.... VMware.VimAutomation.Cis.Core PSGallery This Windows PowerShell module contains PowerCLI Cloud Infrastructure Suite cmdlets.
11.0.0.... VMware.VimAutomation.Cloud PSGallery This Windows PowerShell module contains PowerCLI Cloud cmdlets.
11.0.0.... VMware.VimAutomation.Common PSGallery This Windows PowerShell module contains functionality required by multiple PowerCLI modules.
11.0.0.... VMware.VimAutomation.Core PSGallery This Windows PowerShell module contains Windows PowerShell cmdlets for managing vSphere.
7.6.0.1... VMware.VimAutomation.HorizonView PSGallery This Windows PowerShell module contains Connect/Disconnect cmdlets for View API service.
10.0.0.... VMware.VimAutomation.License PSGallery This Windows PowerShell module contains PowerCLI cmdlets for managing VMware product licenses.
11.0.0.... VMware.VimAutomation.Nsxt PSGallery This Windows PowerShell module contains PowerCLI NSXT cmdlets.
11.0.0.... VMware.VimAutomation.Sdk PSGallery This Windows PowerShell module contains PowerCLI Sdk.
11.0.0.... VMware.VimAutomation.Security PSGallery This Windows PowerShell module contains PowerCLI security management cmdlets.
11.1.0.... VMware.VimAutomation.Srm PSGallery This Windows PowerShell module contains PowerCLI SRM cmdlets.
11.1.0.... VMware.VimAutomation.Storage PSGallery This Windows PowerShell module contains PowerCLI storage management cmdlets.
1.3.0.0 VMware.VimAutomation.StorageUtility PSGallery This Windows PowerShell module contains utility scripts for storage.
11.0.0.... VMware.VimAutomation.Vds PSGallery This Windows PowerShell module contains PowerCLI VDS cmdlets.
11.0.0.... VMware.VimAutomation.Vmc PSGallery This Windows PowerShell module contains PowerCLI VMC cmdlets.
10.0.0.... VMware.VimAutomation.vROps PSGallery This Windows PowerShell module contains PowerCLI vROps cmdlets.
6.5.1.7... VMware.VumAutomation PSGallery This Windows PowerShell module contains PowerCLI VUM cmdlets.
The latest document I can find is https://code.vmware.com/doc/preview?id=6330#/doc/Move-VM.html
Anybody know how I can use PowerCli to move a VM to a resourcepool against VCSA 6.7?
Thanks,
Jack