Contents
Add-PSSnapin : The Windows PowerShell snap-in ‘Microsoft.SharePoint.PowerShell’ is not installed on this computer. Help me to resolve the error to add powershell snapin to SharePoint 2013 environment.
As mentioned by user @kuzimoto the commands I was using were not compatible with SharePoint Online and were designed to be used in conjunction with SharePoint Server. The correct way to connect is using the command Connect-SPOService and passing through the credentials through there or just have them hard coded into your script.
Is there a way to install SharePoint from PowerShell?
This is the preferred installation over the MSI method. Looks like you are running the powershell on a machine where SharePoint is not installed. You can check by running below command if that snap-in available or not? Try to run the PowerShell on the server where SharePoint is installed.
Why is SharePoint Online management shell not installed?
I get the following error: From what I understand this is supposed to come installed with SharePoint Online Management Shell anyway (this is a fresh download) so why won’t it let me install it
But the code above (the only other difference between what you did and that other answer) does not help you load Microsoft.SharePoint.PowerShell if you could not load it through just Add-PSSnapin Microsoft.SharePoint.PowerShell, alone. You would have to run your script on a SharePoint server, where that DLL exists in the GAC.
I load Microsoft.SharePoint.PowerShell with this assembly and verify it with the command above. However, I have to explicitly load each DLL. If I use “Microsoft.SharePoint” as the value it does not load the PowerShell assembly. This does not display any values, SharePoint or otherwise which if found the strangest part.
How to run microsoft.sharepoint.powershell from PC?
Try to run the PowerShell on the server where SharePoint is installed. If you want to run it from pc then you try this workaround: How to add Add-PSSnapin Microsoft.SharePoint.PowerShell to machine without SharePoint Thanks for contributing an answer to SharePoint Stack Exchange!