Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Find Example Code

$
0
0

Summary: Use Windows PowerShell to find easy-to-use example code.

Hey, Scripting Guy! Question How can I find examples of using Windows PowerShell cmdlets and functions—in particular examples that begin with the verb Get?

Hey, Scripting Guy! Answer Use the Get-Command cmdlet to find commands beginning with the verb Get, pipe the results to the Foreach-Object cmdlet, and call Get-Help on each item.

For Windows PowerShell 4.0 and Windows PowerShell 3.0:

(Get-Command -Verb get).name | foreach {get-help $psitem -example}

For Windows PowerShell 2.0 and on Windows PowerShell 1.0:

Get-Command -Verb get | foreach {get-help $_.name -example} 


Viewing all articles
Browse latest Browse all 3333

Trending Articles