Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Setting WMI properties

$
0
0

Hello All (by the way Richard I read most of your book PowerShell and WMI, excellent book!)

I have a brief question, I think I already have the answer but want a sanity check please.

If you look at

get-WmiObject  win32_bios | gm

You can see the SerialNumber property which states

SerialNumber          Property     System.String SerialNumber {get;set;}

i.e. Set as well as Get. Now I have read in previous posts and online etc, that if a property says Set you can change its value. Therefore I tried in vain using code like

$X = get-wmiobject win32_bios

$X.SerialNumber="newserial"

$X.put()

Then I checked out a post by Ed Wilson, which says use WBEMTEST to check the Qualifiers of the Property in question to see if it has the Write qualifier listed. Which in this case it does not, which would explain why I could not change it.

Therefore why does get-wmimethod show get and set (rather than just get) if there is no write qualifier on SerialNumber?

 

For example I could use the above method the change the drive letter of my CD room using the DriveLetter property of the win32_Volume class as it does have the write qualifier (as shown in Ed's post).

 

Thanks All

Ernie

 

 

 

 


Viewing all articles
Browse latest Browse all 8583

Latest Images

Trending Articles



Latest Images