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

时间:2017-05-16 09:30:53

标签: powershell sharepoint pssnapin

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

1 个答案:

答案 0 :(得分:2)

要在线使用SharePoint,您需要SharePoint Online Management Shell。安装后(在Windows 10计算机上),PowerShell将自动加载您需要的命令(如Get-SPOSite),而无需手动导入模块。

您可以从上面的链接下载,并在此处介绍:https://technet.microsoft.com/en-us/library/fp161388.aspx