.Put method for WMI invalid class error

Welcome Forums General PowerShell Q&A .Put method for WMI invalid class error

Viewing 2 reply threads
  • Author
    • #226752
      Topics: 1
      Replies: 1
      Points: 21
      Rank: Member

      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:


      And try to write it back:


      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.


    • #226755
      Topics: 4
      Replies: 2247
      Points: 5,484
      Helping Hand
      Rank: Community MVP

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

    • #226764
      Topics: 1
      Replies: 1
      Points: 21
      Rank: Member

      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.


Viewing 2 reply threads
  • You must be logged in to reply to this topic.