
Use a PowerShell module instead of a snap-in.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
Use a PowerShell module instead of a snap-in.
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.