Find commands, help and history

Get-Command

The Get-Command cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, workflows, filters, scripts, and applications. Get-Command gets the commands from Windows PowerShell modules and s nap-ins and commands that were imported from other sessions. To get only commands that have been imported into the current session, use the ListImported parameter.

Syntax

Image result for powershell command syntax

Get-Help

PowerShell have one of the best help systems I've seen for console apps. I think it is even better than the man-pages in the UNIX world. I like the examples section which usually is completely enough to learn about cmdlet without reading whole help page.

Example:

help Get-Service
  • Shows the help page for get-service cmdlet

help Get-Service -Examples

Very important are the about help pages that shows how to use usually built-in features such as aliases, classes, functions, loops, comparison operators, etc.

help *about*
  • List all available about help pages

Updating help pages

Open PowerShell as an Administrator and run

Update-Help
  • Always run Update-Help after installing new Roles and Features!

Get-History

get-history # or just 'history'
  • Show history of commands for this session

get-history | out-file c:\scripts\history\history01.txt
  • Output history of commands into a file

Transcript

Creates a record of all or part of a Windows PowerShell session to a text file. (We can compare it to Excel Record Macro functionality probably)

start-transcript -path c:\scripts\transcript01.txt  # starts recording
stop-transcript                                     # stops recording

Last updated