PowerShell comes with numerous cmdlets, Microsoft released more than 500 just for SharePoint, and this number grows with each new release or service pack. Memorizing all these commands would be a challenge.
There are two cmdlets that come to the rescue and help administrators understand what the individual commandlets are. Type the following in your SharePoint PowerShell shell:
Get-Command
This command lists all available SharePoint commands. Because there are so many cmdlets, they cannot fit on one screen. To check only specific sets of commands related with one object—for example, Site—type the following:
Get-Command *Site*
The preceding command lists all SharePoint cmdlets that have Site in their name. Depending on your SharePoint version, you will probably get the following or similar results, as shown in Figure 7.3.
Figure 7.3. Viewing the results of Get-Command
cmdlet in SharePoint 2010 Management Shell.
As you can see, commands usually start with a verb (get
, set
, backup
, and so on) and end with a noun. All the commands listed in Figure 7.3 enable you to work with SharePoint sites collections either for retrieving properties (Get-
commands) or modifying site collection properties with Set-
commands.
Most SharePoint commands require input before you can run them. In case you run a command without all the required properties, you will be prompted to enter these. To familiarize yourself with a PowerShell cmdlet, type the following:
Get-Help Get-SPSite
This command can give you detailed help for the Get-SPSite
cmdlet. You can also type the preceding command with the following parameters: –examples
or –detailed
to check out more info on this command. SharePoint cmdlets are well documented and provide a great learning starting point.