4

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?


2 Answers 2

11

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:

4

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

1
  • This helped me, +1. Commented Apr 30, 2012 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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