Chapter 3 Quick Reference


Open table as spreadsheet

To

Do This

Produce a listing of all variables defined in a Windows PowerShell session

Use the Set-Location cmdlet to change location to the variable PSDrive, then use the Get-ChildItem cmdlet

Obtain a listing of all the aliases

Use the Set-Location cmdlet to change location to the alias PSDrive, then use the Get-ChildItem cmdlet to produce a listing of aliases. Pipeline the resulting object into the Where-Object cmdlet and filter on the name property for the appropriate value

Delete a directory that is empty

Use the Remove-Item cmdlet and supply the name of the directory

Delete a directory that contains other items

Use the Remove-Item cmdlet and supply the name of the directory and specify the recurse argument

Create a new text file

Use the New-Item cmdlet and specify the -path argument for the directory location. Supply the name argument, and specify the type argument as file. Example: new-item -path C:\Mytest -name Myfile.txt-type file

Obtain a listing of registry keys from a registry hive

Use the Get-ChildItem cmdlet and specify the appropriate PSDrive name for the -path argument. Complete the path with the appropriate registry path. Example: gci -path HKLM:\software

Obtain a listing of all functions on the system

Use the Get-ChildItem cmdlet and supply the PSDrive name of function:\ to the path argument. Example: gci -path function:\




Microsoft Press - Microsoft Windows PowerShell Step by Step
MicrosoftВ® Windows PowerShell(TM) Step By Step (Step By Step (Microsoft))
ISBN: 0735623953
EAN: 2147483647
Year: 2007
Pages: 128
Authors: Ed Wilson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net