I ran my powershell with powershell 7.2.1-1 in ubuntu and vCenter 7.0.2 and last SDK of VMWare. It was ran successfuly. Now I run my script in powershell 7.2.1-1 in ubuntu and vCenter 6.0.0 But I get the following error:
New-VM: /installer.ps1:125
Line |
125 | $vm = New-VM -Template $template -VMHost $esx -Name $myVM -Datastore …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 04/12/2022 05:39:47 New-VM
After $vm line, I run the following line :
Get-HardDisk -vm $vm |Set-HardDisk -CapacityGB 25 -Confirm:$false
And get the following error:
Get-HardDisk: Cannot validate argument on parameter 'VM'. The argument is null. Provide a valid value for the argument, and then try running the command again.
How can I fix this error in my script? Is it related to vcenter version?