Book Image

Mastering Windows PowerShell Scripting

By : Brenton J.W. Blawat
Book Image

Mastering Windows PowerShell Scripting

By: Brenton J.W. Blawat

Overview of this book

Table of Contents (22 chapters)
Mastering Windows PowerShell Scripting
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating, modifying, and removing WMI property instances


PowerShell provides the ability to create, modify, and remove new properties in WMI classes. If you want to modify an instance of a property, you have to determine if the property has writeable attributes using the get-cimclass cmdlet. To do this, you select a WMI class by calling the get-cimclass cmdlet and referencing the class you want to evaluate. You then gather the expanded properties of the class by piping the get-cimclass output to the selection criteria of Select –ExpandedProperty CimClassProperties.

After gathering the expanded properties, the results need to be piped to the selection criteria of where {$_.Qualifiers –match "write"}. On entering this command, you will see all the properties that permit writing and removing properties. Subsequently, if you want to see the properties that are read-only, you can change the selection criteria of where {$_.Qualifiers –notmatch "write"}. This will display just the read-only properties...