Get-PSSnapin Microsoft.SharePoint.PowerShell returns error even if the snapin has been already added.

Blaze 5 Reputation points
2023-07-03T13:53:44.45+00:00

Get-PSSnapin Microsoft.SharePoint.PowerShell returns error even if the snapin has been already added.

It works fine for other snapins. I am able to use the cmdlets from the Microsoft.SharePoint.PowerShell snapin but Get-PSSnapin returns error.

Capture

The Snapin is in the list of registered snapinsCapture1

Please state your views on this. Thanks in advance.

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2023-07-03T15:14:27.1033333+00:00

  2. Rich Matheisen 47,901 Reputation points
    2023-07-04T17:56:31.0333333+00:00

    If the cmdlets you're using work, why do you need the snap-in? Try removing the Add-PSSnapin and Get-PSSnapin from you code and see if works.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.