set-wmiinstance

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?

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

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.

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

The simplest way would be to use a registry key