VMware Cloud Community
cbreuser
Enthusiast
Enthusiast
Jump to solution

Change vmk0

Hi All,

Need some help please, i am writing a script post autodeploy to change IP address of the vmk0 but both of the below do not work for 6.7

$esxcli.network.ip.interface.ipv4.set.Invoke(@{interfacename = 'vmk0'; ipv4 = "10.x.x.x".IP; netmask = "255.255.255.0"; gateway = "10.x.x.x"; type = ‘static’})

also tried this

$esxhost | set-vmhostnetworkadapter -name "vmk0" -IP "x.x.x.x" -SubnetMask "255.255.255.0" -confirm:$false

which says the parameter -name is not valid

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Afaik, there is no Name parameter on the Set-VMHostNetworkAdapter cmdlet.

You will first have to do a Get-VMHostNetworkAdapter and pipe that to Set-VMHostNetworkAdapter.

$esxhost |

Get-VMHostNetworkAdapter -Name 'vmk0' |

Set-VMHostNetworkAdapter -IP "x.x.x.x" -SubnetMask "255.255.255.0" -confirm:$false


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

View solution in original post

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

Afaik, there is no Name parameter on the Set-VMHostNetworkAdapter cmdlet.

You will first have to do a Get-VMHostNetworkAdapter and pipe that to Set-VMHostNetworkAdapter.

$esxhost |

Get-VMHostNetworkAdapter -Name 'vmk0' |

Set-VMHostNetworkAdapter -IP "x.x.x.x" -SubnetMask "255.255.255.0" -confirm:$false


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

Reply
0 Kudos