A cmdlet is a simple, single-function command-line tool built into the shell. You use cmdlets just as you would use traditional commands and utilities. Begin by typing the name of the cmdlet at the Windows PowerShell command prompt. Windows PowerShell commands are not case-sensitive, so you can type in any case.
For example, you can try the Get-Date cmdlet:
C:\PS> get-date Thursday, November 10, 2005 4:43:50 PM
To list the cmdlets in your session, use the Get-Command cmdlet without any command parameters.
PS> get-command CommandType Name Definition ----------- ---- ---------- Cmdlet Add-Content Add-Content [-Path] <String[... Cmdlet Add-History Add-History [[-InputObject] ... Cmdlet Add-Member Add-Member [-MemberType] <PS... ... …
The default Get-Command display has three columns: CommandType, Name, and Definition. When listing cmdlets, the Definition column displays the syntax of the cmdlet. The ellipsis (…) in the syntax indicates that the data is truncated.
The Get-Command cmdlet also gets commands and command elements other than cmdlets, including aliases (command nicknames), functions, and executable files that are available in Windows PowerShell.
The following command lists the executable files available in Windows PowerShell by using the Name parameter of Get-Command.
PS> get-command -name *.exe CommandType Name Definition ----------- ---- ---------- Application 000StTHK.exe C:\WINDOWS\system32\000StTHK.exe Application 00THotkey.exe C:\WINDOWS\system32\00THotkey.exe Application accwiz.exe C:\WINDOWS\system32\accwiz.exe ...
When listing executable files, the Definition column contains the full path to the executable file.
Then, try some of the other cmdlets, like Get-Process, Get-Service, Get-EventLog, and Get-Alias.
When you feel comfortable with the simple "Get-" cmdlets, try Get-WmiObject. This cmdlet enables you to view and change the components of remote computers. For example, the following command gets information about the BIOS on the Server01 remote computer:
get-wmiobject win32_bios -computername server01
If you need help with any cmdlet, type:
get-help <cmdlet-name> -detailed
for example:
get-help get-alias -detailed