因此我們來使用PowerCLI處理,好處是有批次的延伸性
第零步驟是打開設定
Set-ExecutionPolicy 0
第一步驟是安裝PowerCLI,
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery第二步驟是連往vSphere
Install-Module VMware.PowerCLI -scope CurrentUser
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false第三步驟,我們要關機、刪掉snapshot、再匯出OVA
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
Connect-viServer -server "192.168.15.102" -User root -Password secret
$VMNAME="MyVM"
Get-Snapshot $VMNAME | Remove-Snapshot -Confirm:$false
Get-VM $VMNAME | Shutdown-VMGuest -Confirm:$false
Get-VM $VMNAME | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
Get-VM $VMNAME | Export-VApp -Destination "D:\" -Format OVA -Name TEST
沒有留言:
張貼留言