Learn the storage and data-retrieval fundamentals of SQL Server 2016. Enroll Now.
[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
$Servers = Get-Content "C:\temp\Servers.txt"
Foreach ($server in $servers)
Shutdown-VMguest $server -Confirm:$false
Write-Host -Foregroundcolorcolor Green "Virtual Machine Powered off"
Move-VM $server -Destination "Destination ESX IP or FQDN"
Write-Host -Foregroudcolorcolor Green "Virtual Machine Migrated to Destination"
Open in new window
Discover app within WatchGuard's Wi-Fi Cloud helps you optimize W-Fi user experience with the most complete set of visibility, troubleshooting, and network health features. Quickly pinpointing network problems will lead to more happy users and most importantly, productive IT.
#Put the path of the csv file
$vms = Import-CSV "C:\test\3.csv"
foreach ($vm in $vms)
$VMName = ($vm.Name1,$vm.Name2,$vm.Name3,$vm.Name4,$vm.Name5, $vm.Name6,$vm.Name7,$vm.Name8, $vm.Name9,$vm.Name10)
$vHost = $vm.Hos
$vDatastore = $vm.Datastore
$vNetwork = $vm.Network
#Power off vms
Get-VM -Name $VMName | Shutdown-VMGuest
#Where the VM gets Migrated (Datastore:VV02-FC-D01;VV02-FC-D02;VV02-FC-D03;VV02-FC-D04,VV02-FC-D01 to D04)
#Host is XXXXXXXXX017 to XXXXXXXX0024, XXXXXXXX0025 to XXXXXXX0032)
Move-VM -VM $VMName -Destination $vHost -Datastore $vDatastore
#Set Network Adapter (NET_10.xx.xx.0_24 to NET_NET_10.xx.xx.0_24,NET_10.xx.xx.0_24)
Get-VM -Name $VMName|Get-NetworkAdapter| Set-NetworkAdapter -NetworkName $vNetwork -Confirm:$false
#Power On VMs
Start-VM $VMName -Confirm -RunAsync
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.