ENTERPRISE

SharePoint 2010 : Understanding Windows PowerShell Concepts (part 2)

2/5/2011 5:53:45 PM

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 UIObject Name in PowerShell
Web ApplicationSPWebApplication
Site CollectionSPSite
SiteSPWeb

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:

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 3.

Figure 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.

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:

Get-SPSite

The preceding command lists all site collections in the current SharePoint farm. Sample results are shown in Figure 4.

Figure 4. Get-SPSite cmdlets displays a list of SharePoint site collection URLs.
Other  
  •  Managing and Administering SharePoint 2010 Infrastructure : Using Additional Administration Tools for SharePoint
  •  Managing Exchange Server 2010 : Archiving and compliancy (part 3) - Discovery
  •  Managing Exchange Server 2010 : Archiving and compliancy (part 2) - Messaging Records Management
  •  Managing Exchange Server 2010 : Archiving and compliancy (part 1) - Exchange 2010 Archiving
  •  Managing Exchange Server 2010 : Role Based Access Control (RBAC)
  •  SharePoint 2007 : See What Files or List Items Are Checked Out to You
  •  SharePoint 2007 : Publish a File or List Item
  •  SharePoint 2007 : Use the Datasheet View to Add, Edit, or Delete Items and Files
  •  Exchange Server 2007 : Configure the Client Access Server - Manage Exchange ActiveSync
  •  Exchange Server 2007 : Configure the Client Access Server - Manage OWA
  •  
    Most View
    Is It Time To Go Full Frame? (Part 1)
    Preparing Your Windows 8 PC : Adding Devices in Windows 8 (part 2) - Connecting a Device, Removing a Device
    Your Movies Everywhere! (Part 2)
    Some Of The Biggest Brands In The World Had Their Products (Part 11)
    Delete & Recover Data (Part 3) - Dealing With Corrupted Files
    Sharepoint 2013 : Creating an eDiscovery Center
    Microsoft Wedge And Sculpt Kits For Windows 8
    IP Camera Eyespy247 EXT+ - Cloud-Based Home And Office Video-Monitoring System
    Vivid And Warm Sony Bravia KLD-55W954A
    Windows Server 2003 : Securing Network Communication - Securing a Wireless Network
    Top 10
    Tecdesk Smart 5500 (Part 2)
    Tecdesk Smart 5500 (Part 1)
    Thunderstruck ASUS Brings Thunderbolt 2 To Your PC (Part 3)
    Thunderstruck ASUS Brings Thunderbolt 2 To Your PC (Part 2)
    Thunderstruck ASUS Brings Thunderbolt 2 To Your PC (Part 1)
    Toshiba BDX5400KB Smart 3D Bluray Player With Built-in Wifi
    Samsung BD-F7500 Smart Bluray Player
    Samsung Galaxy Note 10.1 2014 Edition
    Samsung Galaxy NotePro 12.2 (Part 2)
    Samsung Galaxy NotePro 12.2 (Part 1)