PowerShell comes with a lot of in-built cmdlets, and with the addition of every new module, the list of available cmdlets increases. You can use your favorite search engine to get more information on a cmdlet. You can do this from the PowerShell window as well. The cmdlet to get the help is this:
Get-Help nameofcmdlet
Here's an, for example:
Get-Help Get-Service
The following screenshot shows the output for the preceding command:
This is useful if we would like to get help but don't want to leave the Command Prompt.
If you would like to get help from the official online documentation, you can use the following cmdlet:
Get-Help Get-Service -online
This will open the online help manual of the cmdlet with your default browser:
If you would like to quickly check whether there are any commands available for a particular service, you can use the following cmdlet:
Get-Command *Service*
This will give all the commands that contain the Service
service in all the modules that are loaded:
A module is a combination of multiple PowerShell functionalities like scripts, cmdlets that are built to solve a common purpose. For example, to work with the users and licensing, we have to use the Module MSOnline provided by the Microsoft. You can find more information about the Windows PowerShell module here https://msdn.microsoft.com/en-us/library/dd878324(v=vs.85).aspx.
To find out the members of a cmdlet, we can pipe the Get-Member
cmdlet with another cmdlet:
Get-Service | Get-Member
The following screenshot shows the output for the preceding command:
Using the pipe character (|
), we can select the objects and then perform an action on them.
These three cmdlets--Get-Command
, Get-Help
, and Get-Member
--are important to understand and use, especially when you are new to PowerShell. If you take a closer look, you will find the highlighted letters spell Microsoft compiled HTML help (.chm
) files, which were the old-school help files available in Windows. We will use them throughout the book to get additional information on the commands we will use.