PS C:\Users\Administrator> Connect-VIServer 192.168.1.1
Name Port User
---- ---- ----
192.168.1.1 443 VSPHERE.LOCAL\Administrator
# or
PS C:\Users\Administrator> Connect-VIServer -Server 192.168.1.1 -Protocol https -User 'administrator' -Password 'VMware1!'
Get-VMGuestNetworkInterface -VM win-server-2019 -HostUser root -HostPassword <password> -GuestUser administrator -GuestPassword <password>
New-VM -VMHost 192.168.1.12 -Name TestCli -MemoryMB 1024 -DiskMB 8024
Get-VMHost 192.168.1.12 | Get-VM "win-server-2019" | Move-VM -Destination 192.168.1.13
可以通过 vSphere Client 的近期任务中查看
Connect-VIServer Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction
如错误中所述,Set-PowerCLIConfiguration 命令可用于使用以下语法忽略证书检查:、
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false