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.

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,404 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,043 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,186 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,976 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,728 questions
0 comments No comments
{count} votes

2 answers

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

  2. Rich Matheisen 47,496 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.