I just typed the follow to try and get my SharePoint site:

$site = Get-SPSite -Identity $siteID

And I get the following error message:

The term 'Get-SPSite' is not recognized as the name of a cmdlet, function, script..

So after some searches, Apparenty I have to add the following line:

Add-PSSnap in Microsoft.SharePoint.Powershell 

but when I run it, I get the following message: Add-PSSnapin: No snap-ins have been registered for Windows Powershell version 5

Any idea of what I'm doing wrong?

Thank you for help :)


1 Answer 1


Invalid syntax: Add-PSSnap in Microsoft.SharePoint.Powershell


if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue))
Add-PSSnapin Microsoft.SharePoint.PowerShell 

Please make sure that you run the PowerShell on a SharePoint Server machine.

The PowerShell script below can get a list of snap-ins that are registered on your computer:

Get-PSSnapin –registered

More information about Add-PSSnapin


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.