Advertisements

SharePoint & PowerShell 101: Finding Cmdlets


imageI recently did a post on Listing all available PowerShell commands in SharePoint 2010. That is all well and good, if you want to manually browse through all of them. But what if you want to search for them?

 

Get-Command

Get-Command is a highly useful cmdlet in PowerShell. Today we are just going to use a basic functionality of it, to help us find and locate the cmdlets we need to use. Today, we need to do some work with the User Profile Service. However, we don’t know what the command names are that we need to use, only that we need to use them. For that, we can use Get-Command. If you need to figure out how to use the Get-Command cmdlet, run

Get-Help Get-Command

Which will return the following information about the cmdlet

image

This will return the usage of the Get-Command cmdlet. We are just going to use the –Noun switch to pass in our parameters.

Let’s start looking at the basics… we’re looking to find commands relating to the User Profile Service. So, let’s try searching for a noun of Profile

Get-Command –Noun Profile

Nothing is returned… oh right, it would appear that the Get-Command is literal, not a wildcard. However, we can use a wildcard character to help us search, as we have no idea what the name of the command is. Let’s try searching for *Profile*, that should do the trick.

Get-Command –Noun *Profile*

image

Hooray, results! However, we cannot see the entire name of the results returned. For that, we can use the Select-Object cmdlet.

Fore information on using that, try this in the PowerShell console

Get-Help Select-Object

So, let’s only pull the Name property in our results of the Get-Command

Get-Command -Noun *Profile* | Select-Object –Property Name

image

Much better! We can further refine these by adjusting our Noun, to just look at ProfileService

Get-Command -Noun *ProfileService* | Select-Object -Property Name

image

And there we go! Hopefully this helps you in your quest to add PowerShell to your arsenal of SharePoint management and development tools.

I’d love to hear what else you would like to learn about – leave me information in the comments!

Advertisements

About Geoff Varosky
Geoff Varosky is a Senior Architect for BlueMetal Architects, based out of Watertown, MA. He has been architecting and developing web based applications his entire career, and has been working with SharePoint for the past 13 years. Geoff is an active member of the SharePoint community, Co-Founder and Co-Organizer of the Boston Area SharePoint Users Group, co-founder for the Boston Office 365 Users Group, co-organizer for SharePoint Saturday Boston and speaks regularly at SharePoint events and user groups.

4 Responses to SharePoint & PowerShell 101: Finding Cmdlets

  1. Pingback: SharePoint Daily » Blog Archive » SharePoint Trends for 2011; Firefox Beats IE in Europe; Cloud Computing Predictions

  2. Pingback: SharePoint Daily

  3. Pingback: SharePoint 2010: Recopilatorio de enlaces interesantes (XVI)! « Pasión por la tecnología…

  4. Pingback: SharePoint 2010: Recopilatorio de enlaces interesantes (XVI)! - Blog del CIIN

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: