set-wmiinstance

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Richard Siddaway Richard Siddaway 2 years, 7 months ago.

  • Author
    Posts
  • #15253
    Profile photo of Jason Beamish
    Jason Beamish
    Participant

    Good morning,

    I am trying to add an asset tag number to Win32_SystemEnclosure.SMBIOSAssetTag. This is what I am running and the results I am getting
    PS C:\Windows\system32> Set-WmiInstance -class win32_systemEnclosure -Arguments @{SMBIOSAssetTag="******"}
    Set-WmiInstance : Provider is not capable of the attempted operation
    At line:1 char:1
    + Set-WmiInstance -class win32_systemEnclosure -Arguments @{SMBIOSAssetTag="GCECO- ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Set-WmiInstance], ManagementException
    + FullyQualifiedErrorId : SetWMIManagementException,Microsoft.PowerShell.Commands.SetWmiInstance

    Can someone point me in the right direction?

  • #15255
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    According to get-member the property can be set

    SMBIOSAssetTag Property string SMBIOSAssetTag {get;set;}

    BUT

    if you use get-cimclass to dig into the class information

    £> $class = Get-CimClass Win32_SystemEnclosure
    £> $class.CimClassProperties['SMBIOSAssetTag']

    Name : SMBIOSAssetTag
    Value :
    CimType : String
    Flags : Property, ReadOnly, NullValue
    Qualifiers : {MappingStrings, read}
    ReferenceClassName :

    You'll see that the property is readonly. This is why you're getting the message about the provider not being capable of the attempted action

    You're not going to be able to perform this action

  • #15257
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Yeah, there's kind of a difference between WMI – which is technically willing to set any property on any class – and what the underlying code/hardware actually permits. WMI is happy to send the "set" message, but in the case the underlying bits aren't having any of it.

  • #15261
    Profile photo of Jason Beamish
    Jason Beamish
    Participant

    Hmmm, so would you have any suggestion of where I can store an asset tag?

  • #15262
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    The simplest way would be to use a registry key

You must be logged in to reply to this topic.