вторник, 21 февраля 2023 г.

Import VMs from vCenter to vCloud vApp with PowerCLI

cls

#  Import VMs from vCenter to vCloud vApp with PowerCLI

$SourceFolder = "SOURCE"

$DestVApp = "DEST_VAPP"

$VIserver = 'VCENTER.DOMAIN.COM"

$CIserver = 'VCLOUD.DOMAIN.COM"

$UVI = "VCENTER_USER"

$PVI = "VCENTER_PASSWORD"

$UCI = "VCLOUD_USER"

$PCI = "VCLOUD_PASSWORD"

Disconnect-VIServer * -Confirm:$false -ErrorAction SilentlyContinue | Out-Null

Connect-VIServer -Server $VIserver -User $UVI -Password $PVI

Disconnect-CIServer * -Confirm:$false -ErrorAction SilentlyContinue

Connect-CIServer -Server $CIserver -User $UCI -Password $PCI

$VMs = Get-Folder $SourceFolder | Get-VM | sort 

$CIvappObj = Get-CIVApp $DestVApp

foreach ($VM in $VMs) 

    {

    $VM.name

    $CIvappObj | Import-CIVApp -VM $vm -NoCopy:$False -RunAsync -Confirm $false

    }


Комментариев нет:

Отправить комментарий