VMware Cloud Community
astrolab
Contributor
Contributor
Jump to solution

Setting Advanced Configurations for a Host

I am trying to set the CimoemProvideEnabled value for all the hosts in a VC.

This works:

Get-VMHost myhost | Set-VMHostAdvancedConfiguration -Name UserVars.CIMoemProviderEnabled -Value ([System.Int32] 1 )

This does not :

$esxhosts

= Get-vmhost

foreach

($esxhost in $esxhosts)

{

Set-VMHostAdvancedConfiguration

-VMHost $_ -Name UserVars.CIMoemProviderEnabled -Value ([System.Int32] 1)

}

The error message is :

Set-VMHostAdvancedConfiguration : Cannot validate argument on parameter 'VMHost'. The argumen

t is null or empty.

Where is the error? Thanks

0 Kudos
1 Solution

Accepted Solutions
alanrenouf
VMware Employee
VMware Employee
Jump to solution

$esxhosts = Get-vmhost

foreach ($esxhost in $esxhosts)

{


Set-VMHostAdvancedConfiguration -VMHost $esxhost -Name UserVars.CIMoemProviderEnabled -Value ([System.Int32] 1)


}

Or

Get-vmhost | foreach {

     Set-VMHostAdvancedConfiguration -VMHost $_ -Name UserVars.CIMoemProviderEnabled -Value ([System.Int32] 1)
}

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com

View solution in original post

0 Kudos
2 Replies
alanrenouf
VMware Employee
VMware Employee
Jump to solution

$esxhosts = Get-vmhost

foreach ($esxhost in $esxhosts)

{


Set-VMHostAdvancedConfiguration -VMHost $esxhost -Name UserVars.CIMoemProviderEnabled -Value ([System.Int32] 1)


}

Or

Get-vmhost | foreach {

     Set-VMHostAdvancedConfiguration -VMHost $_ -Name UserVars.CIMoemProviderEnabled -Value ([System.Int32] 1)
}

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You have to replace $_ with $esxhost.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition