Windows PowerShell snap-in 'Microsoft.Sharepoint.Powershell' is not installed on this computer?

SCS picture SCS · May 16, 2017 · Viewed 36.4k times · Source

I am new in using powershell, I have been trying to solve this problem for hours and I cant still make it work.

Prerequisites:

  • Using windows 10
  • Running the Powershell ISE as Administrator

But when I used the "Add-PSSnapin WebAdministration"

Command that I am trying to run:

Add-PSSnapin Microsoft.Sharepoint.Powershell
$siteURL = Get-SPOSite "site"
$sitelists = foreach ($web in $siteURL.AllWebs) {
foreach($list in $web.lists){ $list } }
$sitelists |select * | Export-CSV C:\liststitles.csv

It shows the following error:

PS C:\windows\system32> Add-PSSnapin Microsoft.Sharepoint.Powershell
Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.Sharepoint.Powershell' is not installed on this computer.
At line:1 char:1
+ Add-PSSnapin Microsoft.Sharepoint.Powershell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Sharepoint.Powershell:String) [Add-PSSnapin], PSArgumentEx 
   ception
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

I also downloaded the "iis7psprov_x64.msi", but I don't know how to install it since I cant run it as administrator. and also I have read that, it should be available in the "WebAdminstration" module. When trying to run the file the following error is prompted:

enter image description here

Might be simmlar to this but for windows 10:

Add-PsSnapin WebAdministration in Windows7

Answer

Robin picture Robin · May 16, 2017

To work with SharePoint online, you need the SharePoint Online Management Shell PowerShell module. Once installed (on your Windows 10 machine), PowerShell will automatically load the commands you need (like Get-SPOSite) without needing to import the module manually.

You can download it from the link above, and an introduction is here: https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/introduction-sharepoint-online-management-shell?view=sharepoint-ps&redirectedfrom=MSDN