VMware Cloud Community
DieterA
Contributor
Contributor
Jump to solution

Change Agent VM Settings using powercli

For a deployment using NSX we are using the Agent VM settings on our ESXi host. I tried to find how to set these values via powercli, but I can't find them anywhere.

Could someone show me where I can change the Agent VM settings on the host via powercli?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

$esxName = 'MyEsx'

$dsName = 'ds1'

$netName = 'netpg'

$esx = Get-VMHost -Name $esxName

$agMgr = Get-View -Id $esx.ExtensionData.ConfigManager.EsxAgentHostManager

$agent = New-Object VMware.Vim.HostEsxAgentHostManagerConfigInfo

$agent.AgentVmDatastore = (Get-Datastore -Name $dsName).ExtensionData.MoRef

$agent.AgentVmNetwork = $esx.ExtensionData.Network | where{(Get-View -Id $_).Name -eq $netName}

$agMgr.EsxAgentHostManagerUpdateConfig($agent)


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Which Agent VM Settings do you mean?

Could you perhaps include a screenshot?


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

0 Kudos
DieterA
Contributor
Contributor
Jump to solution

This is a setting where you can specify a datastore and network that the installation of vm agents can use to put there appliances on.

2017-06-13 12_37_23-vSphere Web Client - vSphere Web Client.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this

$esxName = 'MyEsx'

$dsName = 'ds1'

$netName = 'netpg'

$esx = Get-VMHost -Name $esxName

$agMgr = Get-View -Id $esx.ExtensionData.ConfigManager.EsxAgentHostManager

$agent = New-Object VMware.Vim.HostEsxAgentHostManagerConfigInfo

$agent.AgentVmDatastore = (Get-Datastore -Name $dsName).ExtensionData.MoRef

$agent.AgentVmNetwork = $esx.ExtensionData.Network | where{(Get-View -Id $_).Name -eq $netName}

$agMgr.EsxAgentHostManagerUpdateConfig($agent)


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

0 Kudos
DieterA
Contributor
Contributor
Jump to solution

This worked like a charm. Thanks!

0 Kudos