.Put method for WMI invalid class error

This should actually be simple, but for some reason it fails.

I read a WMI class:

$WmiProp = Get-WmiObject -Namespace "ROOT\ccm\Policy\Machine" -Class "CCM_ConfigurationManagementClientConfig" -ComputerName "server-01"

Displaying WmiProp I get this:

__GENUS : 2
__CLASS : CCM_ConfigurationManagementClientConfig
__SUPERCLASS : CCM_ComponentClientConfig
__DYNASTY : CCM_Policy
__RELPATH : CCM_ConfigurationManagementClientConfig.SiteSettingsKey=1
__PROPERTY_COUNT : 11
__DERIVATION : {CCM_ComponentClientConfig, CCM_Policy}
__SERVER : server-01
__NAMESPACE : ROOT\ccm\Policy\Machine
__PATH : \\server-01\ROOT\ccm\Policy\Machine:CCM_ConfigurationManagementClientConfig.SiteSettingsKey=1
ComponentName : SMSConfigurationManagementAgent
Enabled : True
EnableUserStateManagement : True
PerProviderTimeOut : 120
PerScanTimeout : 360
PerScanTTL : 15
Reserved1 : 0
Reserved2 :
Reserved3 :
ScriptExecutionTimeOut : 60
SiteSettingsKey : 1
PSComputerName : server-01

I modify the ScriptExecutionTimeOut property:

$WmiProp.ScriptExecutionTimeOut=600

And try to write it back:

$WmiProp.put()

And I get this:

Exception calling "Put" with "0" argument(s): "Invalid class "
At line:1 char:1
+ $WmiProp.put()
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

I also tried to pipe Get-WmiObject to Set-WmiInstance. Exactly the same error.

I was able to modify just fine other WMI properties. But this one gives me this strange error. I’m out if ideas…

I also tried with wmic. Exactly the same error.

Any idea is more than welcome.

 

May I ask what you’re actually trying to accomplish? There might be a better way.

Trying to set the script execution timeout for the SCCM client.

But never mind, I think I found the problem.

It seems that the correct path to the property was: \root\ccm\policy\machine\actualconfig

The class appears in \root\ccm\policy\machine but cannot be set from there (for some reason). But if I add the \actualconfig I can set the property and it appears as changed in \root\ccm\policy\machine also.