Link to home
Start Free TrialLog in
Avatar of Techie solution
Techie solution

asked on

Cold Vmotion Script

Hi All,

Do we have any script for cold migration of multiple vm from one cluster to another.
Avatar of Murali Sripada
Murali Sripada

Avatar of Techie solution

ASKER

How can I connect to the server via cli also please guide from basic commands. I never performed it.
SOLUTION
Avatar of Murali Sripada
Murali Sripada

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Error: Invalid server certificate. Use Set-powerCLIConfigurationto set the value for the InvalidCertification option prompt.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Used below command

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP $true
Before you try the steps in production, i request you to try in a lab setup environment and test the scripts..

Thanks,
MS
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am still fetching help on this.
Though it helped with few knowledge but script is throwing error as I need to change both source network and Datastore.
I used below and was able to migrate them successfully #Put the path of the csv file
 $vms = Import-CSV "C:\test\Testback.csv"
 foreach ($vm in $vms)
 {
 #Assign Variables
 $VMName = ($vm.Name1,$vm.Name2)
 $VMHost = ($vm.Host)
 $DD = ($vm.Datastore)
 $OldNetwork = ($vm.OldNetwork)
 $Net = ($vm.Network)
 Write-Host $VMName
 Write-Host $vm.Host
 Write-Host $vm.Datastore
 Write-Host $vm.Network
 Write-Host $vm.OldNetwork
 #Power off vms
 Get-VM -Name $VMName | Shutdown-VMGuest
 #Where the VM gets Migrated 
 Move-VM -VM $VMName -Destination $VMHost -Datastore$DD
 Get-VM $VMName | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName $Net -Confirm:$false
 #Power On VMs
 #Start-VM $VMName -Confirm 
 }