VMware Cloud Community
larstr
Champion
Champion
Jump to solution

PowerCLI to disable wbem

Hi,

I'm trying to disable wbem, but get the error message "Operation is not valid due to the current state of the object."

PS C:\ps> get-vmhost esxihost01.domain.com

Name                 ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz   MemoryUsageGB   MemoryTotalGB Version

----                 --------------- ---------- ------ ----------- -----------   -------------   ------------- -------

esxihost01.domain.com  Connected       PoweredOn      28       15615       67172         252,417         447,908   6.7.0

PS C:\ps> $esx=get-vmhost esxihost01.domain.com

PS C:\ps> $esxcli = Get-EsxCli -vmhost $esx -V2

PS C:\ps> $wbem=$esxcli.system.wbem.get.Invoke()

PS C:\ps> $wbem

AuthorizationModel         : password

CIMObjectManagerPID        : 2101966

Enabled                    : true

EnabledRunningSSLProtocols : {tlsv1.2}

EnabledSSLProtocols        :

EnabledSystemSSLProtocols  : {tlsv1.2}

Loglevel                   : warning

Port                       : 5989

ServiceLocationProtocolPID : 2101489

WSManagementPID            : 2101787

WSManagementService        : true

PS C:\ps> $wbem.Enabled=$false

Operation is not valid due to the current state of the object.

At line:1 char:1

+ $wbem.Enabled="false"

+ ~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], InvalidOperationException

    + FullyQualifiedErrorId : System.InvalidOperationException

Doing it manually with esxcli on the esxi host works well.

[root@esxihost01:~] esxcli system wbem get

   Authorization Model: password

   CIMObject Manager PID: 2101966

   Enabled: true

   Enabled Running SSLProtocols: tlsv1.2

   Enabled SSLProtocols:

   Enabled System SSLProtocols: tlsv1.2

   Loglevel: warning

   Port: 5989

   Service Location Protocol PID: 2101489

   WSManagement PID: 2101787

   WSManagement Service: true

[root@esxihost01:~] esxcli system wbem set --enable false

[root@esxihost01:~] esxcli system wbem get

   Authorization Model: password

   CIMObject Manager PID: 0

   Enabled: false

   Enabled Running SSLProtocols:

   Enabled SSLProtocols:

   Enabled System SSLProtocols: tlsv1.2

   Loglevel: warning

   Port: 5989

   Service Location Protocol PID: 0

   WSManagement PID: 0

   WSManagement Service: true

Guess I need some input to how to do this correctly with PowerCLI.

Lars

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The CreateArgs method shows which parameters are there and which are required or optional.

The parameters are passed as a hash table to the Invoke method

Try like this.

$esxcli = Get-EsxCli -VMHost myesx -V2

$esxcli.system.wbem.set.CreateArgs()

$esxcli.system.wbem.set.Invoke(@{enable=$false})

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


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

View solution in original post

6 Replies
LucD
Leadership
Leadership
Jump to solution

The CreateArgs method shows which parameters are there and which are required or optional.

The parameters are passed as a hash table to the Invoke method

Try like this.

$esxcli = Get-EsxCli -VMHost myesx -V2

$esxcli.system.wbem.set.CreateArgs()

$esxcli.system.wbem.set.Invoke(@{enable=$false})

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


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

larstr
Champion
Champion
Jump to solution

Thanks alot, LucD!

As there is a bug in 6.7U3 that may cause the vCenter SEAT database to fill up (VMware Knowledge Base) I've now (with your input) ended up with the following script:

param (

  [string]$clustername = $( Read-Host "Enter clustername" )

  )

$cluster = Get-Cluster -Name $clustername

Get-VMHost -Location $cluster | %{

  $esxcli = Get-EsxCli -VMHost $_ -V2

  $esxcli.system.wbem.get.Invoke()       

  $esxcli.system.wbem.set.CreateArgs()

  $esxcli.system.wbem.set.Invoke(@{enable=$false})

  }

Lars

LucD
Leadership
Leadership
Jump to solution

Thanks for sharing that.

Btw, you can leave out the CreateArgs call, I just added that for demonstrating what parameters are available in the hash table.


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

SebastianGrugel
Hot Shot
Hot Shot
Jump to solution

Hi Lars

I have that same situation.

What impact we have without this service ? we dont have only information about some hardware issue ?

Sebastian

vExpert VSAN/NSX/CLOUD | VCAP5-DCA | VCP6-DCV/CMA/NV ==> akademiadatacenter.pl
Reply
0 Kudos
larstr
Champion
Champion
Jump to solution

Sebastian,

As far as I can tell the wbem service is used by OEM vendor​​​ applications to query hw status.

"HPE CIM Providers (HPE Insight Management) WBEM Providers are key components of a managed VMware vSphere server. The Providers

allow a management client, such as HPE SIM, to monitor and display information about server health. "

Lars

Reply
0 Kudos
larstr
Champion
Champion
Jump to solution

The issue described in this thread has been fixed in the latest ESXi release:

VMware ESXi 6.7, Patch Release ESXi670-201911001

"

PR 2439205: You see Sensor -1 type hardware health alarms on ESXi hosts and receive excessive mail alerts

After upgrading to ESXi 6.7 Update 3, you might see Sensor -1 type hardware health alarms on ESXi hosts being triggered without an actual problem. This can result in excessive email alerts if you have configured email notifications for hardware sensor state alarms in your vCenter Server system. These mails might cause storage issues in the vCenter Server database if the Stats, Events, Alarms and Tasks (SEAT) directory goes above the 95% threshold.

This issue is resolved in this release."

Lars

Reply
0 Kudos