Skip Ribbon Commands
Skip to main content
Sign In
SharePoint Program Manager, Infrastructure
Zach Rosenfield's SharePoint Blog > Posts > PowerShell 2010: Basic Discovery
October 27
PowerShell 2010: Basic Discovery

And on the tone of my previous post--no time to start like the present!  First we should start on SharePoint PowerShell "101".  As announced at SPC, we have over 500 cmdets (and even more if you include FAST and PerformancePoint)--but no need to get started memorizing all those; PowerShell offers great "discovery" tools. 

 

Below are some basic samples to get everyone started.  Please note that i'm going to skip some "basic" PowerShell concepts (like "Piping") as there is some great information on the web about these; however, some of these first few posts will be "repeat" for PowerShell regulars.

 

(Note all these commands assume that you have started your PowerShell in the "SharePoint Management Shell" shown below)

 

 

1. This command will return all SharePoint cmdlets available on the local farm:

 

PS> Get-Command -pssnapin Microsoft.SharePoint.PowerShell

 

 

2. This command will get help for the given command (we have "beta" documentation for over 90% of our commands!):

 

PS> Get-Help Get-SPSite

 

 

3. We can even get a set of Examples from cmdlet help:

 

PS> Get-Help Get-SPSite -Examples

 

 

4. This command will give you a list of all the "Service" related cmdlets in the local SharePoint install:

 

PS> Get-Command -noun "SPService*" | Sort Noun

 

 

5. This command will simplify #3 by only showing the unique "objects" (aka. Nouns) that are available in PowerShell:

 

PS> Get-Command -noun "SPService*" | Sort Noun | Select Noun -Unique

 

 

 

6. Need to figure out what properties or methods a .NET SharePoint object has on it?  Instead of MSDN, try:

 

PS> Get-SPSite http://webapplication | Get-Member

 

 

That’s all for now!  More demos—from the simple to the most advanced—coming soon!

Comments

Great Post...

Very useful post.
Thanks...
 on 6/22/2010 12:44 AM

Re: PowerShell 2010: Basic Discovery

Very useful information
thank you
 on 6/5/2011 11:36 PM

very nice

thanks for sharing
 on 8/10/2012 3:14 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Comments *


Name (required) *


Human Test


Checking if you're human: enter "1234" (no quotes)

Attachments