We help IT Professionals succeed at work.

How to run commands in PowerShell

gtrapp
gtrapp asked
on
Hi,
I am new to Powershell and would like to run the following command:

Test-spcontentdatabase -name 2_wss_content -webapplication http:// server:81

When I run the this in PowerShell, PowerShell says this is not a recognized cmdlet. What I am doing wrong?

Thanks.

Comment
Watch Question

Technical Development Lead
Commented:
you need to run it ON your sharepoint server and in the sharepont shell not the plain powershell shell.

OR you need to load the powershell commandlets into powershell shell first

Add-PsSnapin Microsoft.SharePoint.Powershell
Test-spcontentdatabase -name 2_wss_content -webapplication http:// server:81

You either need to load the SharePoint snap-in that adds the cmdlets -or- to launch PowerShell with them already loaded, goto Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell.