set-wmiinstance

Welcome Forums General PowerShell Q&A set-wmiinstance

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
4 years, 8 months ago.

  • Author
    Posts
  • #15253

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    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

    Participant
    Points: 0
    Rank: Member

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

  • #15262

    Participant
    Points: 0
    Rank: Member

    The simplest way would be to use a registry key

The topic ‘set-wmiinstance’ is closed to new replies.