stai leggendo...

Writable properties for a WMI class

Proprietà scrivibili di una classe WMI

Richard Siddaway's Blog

Do you know how to discover which properties on a WMI class, and therefore a WMI instance, can be modified?

Get-CimClass from the PowerShell 3.0 CIM cmdlets is the answer:

$class = Get-CimClass -ClassName win32_volume



The last command returns all of the properties in this format




Notice the first one has a Flag of ReadOnly and the second one has a Qualifier of write. So the question becomes how can you filter on those two items?


If you run something like this:

$class = Get-CimClass -ClassName Win32_Volume
$class.CimClassProperties |
foreach {
if ($psitem | select -ExpandProperty Qualifiers | where Name -eq ‘write’){$psitem}
if (($psitem.Flags -split ‘, ‘) -notcontains ‘Readonly’)  {$psitem}


You will see that some properties may not be Readonly but also aren’t writable such as:


In that case we need just the writable properties

Get-CimClass -ClassName Win32_Volume  |
select -ExpandProperty…

View original post 40 altre parole



Non c'è ancora nessun commento.


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )


Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: