Get-help
Help
Get-Command
- Alias:
gcm
- Example:
gcm *event*
Have help launch web browser to help page
Help Get-Eventlog -online
Get examples for a command
Get-Help event-log -examples
Get a list of all aliases
Get-Alias
Get the properties of a cmdlet
Get-ADComputer -filter * | Get-Member
Pipelining
Get-Process -name b* | Stop-Service
What Happened?
Get-Process
returns an object containing all running processes that start with b.Get-Process | Get-Member
shows that the object being returns has a type of Process. Technically System.Diagnostocs.Process- The
|
between the commands is the pipeline character that powershell interperates as a hand off between commands. - Looking at the full help for
Stop-Service
. Name and InputObject parameters are capable of accepting pipeling input by value. - Neither Name nor InputObject can accept Process objects, so ByValue parameter binding ceases. The shell will next try ByPropertyName.
- The Name parameter is the only one listed as accepting pipeline input ByPropertyName.
- In the example the objects in the pipeline happen to have a Name property. PowerShell is able to match between the property name and the -Name parameter name.
- The Name properties of the objects sent to the pipeline by
Get-Service
match the process names in the -Name parameter ofStop-Service
. Stop-Service
will attempt to stop services for each object it recieves.
Parenthesis in powershell
Get-Service -computername (Get-Content c:\names.txt)