VMware Cloud Community
YanSi
Enthusiast
Enthusiast
Jump to solution

About Use PowerCli Migration VMKernel Question

Hi Guys

I use the following script to execute, although it is successful, but there are some questions

PS C:\> $csv = Import-Csv C:\C01-A-Migration-VMK0.csv -UseCulture
PS C:\> ForEach ($line in $csv){
>>     $vmhost = $line.Host
>>     $VDSName = $line.dvSwitch
>>     $VLANMGTPortgroup = $line.dvMGMTPG
>>     # Migrating VMkernel port (vmk0) on vSwitch to VDS
>>     $vmk = Get-VMHostNetworkAdapter -Name "vmk0" -VMHost $vmhost
>>     Write-Host "Migrate MGMT to" $VLANMGTPortgroup -fo Yellow
>>     $vdPortgroup = Get-VDPortGroup -VDSwitch (Get-VDSwitch -Name $VDSName) -Name $VLANMGTPortgroup
>>     Set-VMHostNetworkAdapter -PortGroup $vdPortgroup -VirtualNic $vmk -Confirm:$false
>> }
Migrate MGMT to C01-A-MGMT-V995
WARNING: PowerCLI scripts should not use the 'VirtualSwitch' property of VmwareVDPortgroup type. The property will be removed in a future release.

Name       Mac               DhcpEnabled IP              SubnetMask      DeviceName
----       ---               ----------- --              ----------      ----------
vmk0       00:50:56:83:b1:c1 False       192.168.50.1    255.255.255.0         vmk0
Migrate MGMT to C01-A-MGMT-V995
vmk0       00:50:56:83:db:ee False       192.168.50.2    255.255.255.0         vmk0
Migrate MGMT to C01-A-MGMT-V995
vmk0       00:50:56:83:ee:05 False       192.168.50.3    255.255.255.0         vmk0

PS C:\>

Why is the prompt as follows when I use the following command, and how to solve it?

WARNING: PowerCLI scripts should not use the 'VirtualSwitch' property of VmwareVDPortgroup type. The property will be removed in a future release.

 

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

These are just "warnings".
If you don't want to see them, turn them off with the Set-PowerCLIConfiguration cmdlet and the DisplayDeprecationWarnings switch.

Normally these warning messages include a line number where the deprecated parameter was discovered.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

These are just "warnings".
If you don't want to see them, turn them off with the Set-PowerCLIConfiguration cmdlet and the DisplayDeprecationWarnings switch.

Normally these warning messages include a line number where the deprecated parameter was discovered.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
YanSi
Enthusiast
Enthusiast
Jump to solution

Thank you for your answer

You are the god of powercli    🙂

I have one more question, How to delete vSwitch0 of all hosts in a cluster?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Thanks.
Just a small remark, next time raise new questions in a new thread.
That makes it easier for others to find resolved questions.

Provided there is nothing left on vSwitch0 (no vmk nor PG), you could do something like this

Get-Cluster -Name <MyCluster> |
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
    Get-VirtualSwitch -Name vSwitch0 -VMHost $esx |
    Remove-VirtualSwitch -Confirm:$false
}

  


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos