PowerShell for Windows Admins

May 14 2014   10:51AM GMT

Provider is not capable of the attempted operation

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

A question on the (powershell.org) forum described a situation where the user was trying to use Set-WmiInstance to set a property on a particular WMI class instance.

The attempt failed and the message “Provider is not capable of the attempted operation” was part of the reported exception.

This message very often indicates that you are trying to write to a readonly property – which was the case here.  The class was Win32_SystemEnclosure and the property was SMBIOSAssetTag.

If you use get-member

Get-WmiObject -Class Win32_SystemEnclosure | Get-Member

and look at the SMBIOSAssetTag property you’ll see this

SMBIOSAssetTag            Property      string SMBIOSAssetTag {get;set;}

BUT that’s not right because if you look at the documentation at http://msdn.microsoft.com/en-us/library/aa394474%28v=vs.85%29.aspx

you’ll see this:

SMBIOSAssetTag

Data type: string
Access type: Read-only

Asset tag number of the system enclosure.

Get-Member doesn’t report correctly on whether a WMI class’ property is readonly.  The best way to find out is to use Get-CimClass

£> $class = Get-CimClass Win32_SystemEnclosure

£> $class.CimClassProperties['SMBIOSAssetTag']

Name               : SMBIOSAssetTag

Value              :

CimType            : String

Flags              : Property, ReadOnly, NullValue

Qualifiers         : {MappingStrings, read}

ReferenceClassName :

And you can see in the flags that the property is ReadOnly.

Get-CimClass should be your starting point when investigating WMI classes.

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: