Migrate VMs From VSS to VDS
# One liner
#### one Vm at a time
get-vm | get-networkadapter |where {$_.networkname -eq “OldPortGroup”} | set-networkadapter -networkname “NewPortGroup” -Confirm:$false
### migrating from ESXi host
$esx = "hostname"
$vsname = "old_vswitch"
$vdsname = "new_vdswitch"
$oldpg = "old_portgroup"
$newpg = "new portgroup"
# get the VMs
$vdPortGroup = Get-VDPortGroup -VDSwitch ( Get-VDSwitch -Name $vdsname) -Name $newpg ;
## get all VMs in this host and migrate the network to VDS
Get-vm -Location $esx | Get-NetworkAdapter | where { $_.NetworkName -eq $oldpg } | Set-NetworkAdapter -PortGroup $vdPortGroup -RunAsync ;
Change PSP for ESXi Host to RoundRobin
Get-VMHost “esxihostname” | Get-ScsiLun -CanonicalName “naa.600*” | Set-ScsiLun -MultipathPolicy “roundrobin”
Try naa.600 depending on storage iscsi or fc
Change Default PSP for SATP (Path Selection Policy and Storage Array Type Policy)
# Change the Default PSP for a SATP
# PowerCLI Session must be connected to vCenter Server using Connect-VIServer
Connect-Viserver UK3P-vc01.lab.local, ntcp-vc01.lab.local
# Define the default PSP to set VMW_PSP_MRU, VMW_PSP_RR, VMW_PSP_FIXED
$defaultpsp = "VMW_PSP_RR"
# Define the SATP to Set Default PSP to $defaultpsp
# This will depend on the SATP used associated with the connected array
# For example the SATP for an EMC VNXe is VMW_SATP_DEFAULT_AA
$satp = "VMW_SATP_DEFAULT_AA"
$esxHosts = Get-VMHost
foreach ($esx in $esxHosts) {
Write-Host "Setting Default PSP to $defaultpsp for SATP $satp on $esx" -ForegroundColor green
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.storage.nmp.satp.set($null,$defaultpsp,$satp)
}
Write-Host "Done!" -ForegroundColor green
#Migrate VMs From VSS to VDS
# One liner
#### one Vm at a time
get-vm | get-networkadapter |where {$_.networkname -eq “OldPortGroup”} | set-networkadapter -networkname “NewPortGroup” -Confirm:$false
### migrating from ESXi host
$esx = "hostname"
$vsname = "old_vswitch"
$vdsname = "new_vdswitch"
$oldpg = "old_portgroup"
$newpg = "new portgroup"
# get the VMs
$vdPortGroup = Get-VDPortGroup -VDSwitch ( Get-VDSwitch -Name $vdsname) -Name $newpg ;
## get all VMs in this host and migrate the network to VDS
Get-vm -Location $esx | Get-NetworkAdapter | where { $_.NetworkName -eq $oldpg } | Set-NetworkAdapter -PortGroup $vdPortGroup -RunAsync ;
# Change PSP for ESXi Host to RoundRobin
Get-VMHost “esxihostname” | Get-ScsiLun -CanonicalName “naa.500*” | Set-ScsiLun -MultipathPolicy “roundrobin”
#Try naa.600 depending on storage iscsi or fc
Change Default PSP for SATP (Path Selection Policy and Storage Array Type Policy)
# Change the Default PSP for a SATP
# PowerCLI Session must be connected to vCenter Server using Connect-VIServer
Connect-Viserver UK3P-vc01.lab.local, ntcp-vc01.lab.local
# Define the default PSP to set VMW_PSP_MRU, VMW_PSP_RR, VMW_PSP_FIXED
$defaultpsp = "VMW_PSP_RR"
# Define the SATP to Set Default PSP to $defaultpsp
# This will depend on the SATP used associated with the connected array
# For example the SATP for an EMC VNXe is VMW_SATP_DEFAULT_AA
$satp = "VMW_SATP_DEFAULT_AA"
$esxHosts = Get-VMHost
foreach ($esx in $esxHosts) {
Write-Host "Setting Default PSP to $defaultpsp for SATP $satp on $esx" -ForegroundColor green
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.storage.nmp.satp.set($null,$defaultpsp,$satp)
}
Write-Host "Done!" -ForegroundColor green