Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

On a fresh SP2010 install.

I run powershell as the admin

I have my policy set to unrestricted.

I've tried embedding this in a .ps1 file or running in the shell.. but get:

Powershell Get-SPServiceInstance - The term 'Get-SPServiceInstance' is not recognized as the name of a cmdlet

I've also tried loading microoft.SharePoint firrst and it did not help

Am I missing something here?


share|improve this question

2 Answers 2

up vote 3 down vote accepted

You need to register SharePoint snap-in that contains the cmdlets by adding Add-PSSnapin Microsoft.SharePoint.PowerShell before you call any SP cmdlets.

eg.

Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPServiceInstance | Where-Object {$_.TypeName -eq 'Central Administration'}

will return

TypeName                         Status   Id                                  
--------                         ------   --                                  
Central Administration           Online   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

You can also use SharePoint 2010 Management Shell:

share|improve this answer

Instead of just loading PowerShell, goto the start menu - all programs - sharepoint server - sharepoint management shell. That loads powershell with the Sharepoint addons.

share|improve this answer
    
This helped me, +1. –  DeeMac Apr 30 '12 at 14:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.