VMware Cloud Community
Grrmmll
Contributor
Contributor
Jump to solution

Activation of replication services on vmkernel port through Powercli

Hello all

I'm trying to automate the activation of services "vSphere replicaton traffic" and "vSphere Replication NFC traffic" on a vmkernel port and I can't find anywhere the option to do it in Powercli.
I have search Powercli documentation and looked everywhere I could, without success...

No option seems available through New-VMHostNetworkAdapter and Set-VMHostNetworkAdapter

Is there a way to activate those services through Powercli or is it not implemented (yet)?

I have about 40 Esxi to reconfigure and doing it manually through the Web Client is "not efficient"

Thanks

Sebastien

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this, it works for VSS and VDS

$esxName = 'MyEsx'

$vmkName = 'vmk0'

$esx = Get-VMHost -Name $esxName

$vnicMgr = Get-View -Id $esx.ExtensionData.ConfigManager.VirtualNicManager

$vnicMgr.SelectVnicForNicType('vSphereReplication',$vmkName)

$vnicMgr.SelectVnicForNicType('vSphereReplicationNFC',$vmkName)

/body>


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

View solution in original post

0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

Not through a PowerCLI cmdlet I'm afraid.
But you can call the API method from PowerCLI.

Is that a vmk on a VSS or a VDS?


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

0 Kudos
Grrmmll
Contributor
Contributor
Jump to solution

Thank you for your answer. (That's what I feared ^^)

Half or infra has this vmk on VSS, the other half on VDS.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this, it works for VSS and VDS

$esxName = 'MyEsx'

$vmkName = 'vmk0'

$esx = Get-VMHost -Name $esxName

$vnicMgr = Get-View -Id $esx.ExtensionData.ConfigManager.VirtualNicManager

$vnicMgr.SelectVnicForNicType('vSphereReplication',$vmkName)

$vnicMgr.SelectVnicForNicType('vSphereReplicationNFC',$vmkName)

/body>


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

0 Kudos
Grrmmll
Contributor
Contributor
Jump to solution

Thank you very much.

Working great Smiley Happy

0 Kudos
bigartg
Contributor
Contributor
Jump to solution

good script!!

but how can be done with binding to Network Label? not vmkname

 

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The Network Label is the Portgroup, but what if there is more than 1 VMKernel on that Portgroup?


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

0 Kudos
bigartg
Contributor
Contributor
Jump to solution

in my case, only one vmkernel

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You should be able to go from Network Label to the VMKernel.
Something like this

$vmkName = Get-VirtualPortGroup -Name $pgName | 
Get-VMHostNetworkAdapter -VMKernel | 
where{$_.VMHost.Name -eq <name of the ESXi node>} | 
Select -ExpandProperty Name


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

0 Kudos