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

Retrieving attributes and properties


PowerShell provides the ability to view a structure of files, folders, and registry keys. This is performed by leveraging the get-item cmdlet. The proper syntax for using this cmdlet is calling get-item, followed by the –path trigger and the path to the file, folder, or registry location you want to look at. The result of the command will display the folders and files or the keys and subkeys for the registry.

When you use the get-item cmdlet, it evaluates only the actual object you are referencing. This means that if you reference c:\windows as your –path trigger, it will only return the properties of the folder itself. Likewise if you are attempting to view the properties of the registry key HKLM:\Software\Microsoft\Windows\CurrentVersion\, it will only display the named values and properties in that key and not the subkeys contained in that key.

To view the objects that are contained in a folder or registry key, you can use the get-childitem cmdlet. The...