Site Collections, Sites, and Webs
Cmdlets for SharePoint implement a different naming convention from the one used in the user interface. Table 1 shows the names of the most important SharePoint UI objects and the names of their respective GUI objects.
Table 1. Overview of the Most Important SharePoint Objects Naming Conventions
Object Name in UI | Object Name in PowerShell |
---|
Web Application | SPWebApplication |
Site Collection | SPSite |
Site | SPWeb |
The SharePoint Software Development Kit (SDK)
PowerShell is a
technology designed for IT professionals managing IT systems. However,
the management of SharePoint is much easier if administrators are
familiar with the SharePoint 2010 Software Development Kit (SDK):
Administrators should understand how SharePoint functions under the hood
so that they know which objects enable them to retrieve certain
properties. You can learn more about SharePoint 2010 SDK online at the
following URL:
http://msdn.microsoft.com/en-us/library/ee557253(office.14).aspx
Get-Command and Get-Help
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:
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:
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 3.
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:
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.
The First SharePoint Cmdlet
The easiest way to start
working with SharePoint cmdlets is to start the SharePoint 2010
Management Shell. On a computer with SharePoint 2010 installed, go to
Start, All Programs, Microsoft SharePoint 2010 Products, SharePoint 2010
Management Shell. The shell loads; then type the following command into
the command prompt:
The preceding command lists all site collections in the current SharePoint farm. Sample results are shown in Figure 4.