Use a PowerShell module instead of a snap-in.
Get-PSSnapin Microsoft.SharePoint.PowerShell returns error even if the snapin has been already added.
Blaze
5
Reputation points
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.
The Snapin is in the list of registered snapins
Please state your views on this. Thanks in advance.
2 answers
Sort by: Most helpful
-
-
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.