2017-05-16 978 views
-3

我是使用PowerShell的新手,我一直在努力解決這個問題幾個小時,我不能使它的工作。此電腦上未安裝Windows PowerShell管理單元'Microsoft.Sharepoint.Powershell'?

先決條件:

  • 採用windows 10
  • 運行PowerShell的ISE作爲管理員

但是當我用 「Add-PSSnapin WebAdministration

命令,我試圖運行:

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 

它顯示了以下錯誤:

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 

我也下載了「iis7psprov_x64.msi」,但我不知道如何安裝它,因爲我不能運行它爲管理員。並且我已經讀過,它應該在「WebAdminstration」模塊中可用。當試圖運行該文件會被提示以下錯誤:

enter image description here

可能simmlar到這一點,但對於Windows 10:

Add-PsSnapin WebAdministration in Windows7

+0

對於這個問題引用'Microsoft.SharePoint.Powershell'標題。你的代碼示例說'Add-PSSnapin WebAdministration',你的錯誤信息再次引用SharePoint。請你能澄清你想要做什麼?你需要運行哪些命令?與SharePoint相關的命令不是Web管理模塊的一部分(據我所知)。 – Robin

+0

@Robin分享點相關命令...對於混淆抱歉。在搜索答案時,我偶然發現了Web管理模塊,因此我認爲這是錯誤 – SCS

+0

Web管理是針對Microsoft IIS的。您是否嘗試在Office 365中使用SharePoint?或本地? – Robin

回答

2

要使用SharePoint Online,您需要的SharePoint Online Management Shell 。一旦安裝(在Windows 10機器上),PowerShell將自動加載您需要的命令(如Get-SPOSite),而無需手動導入模塊。

您可以從鏈接下載它上面,並介紹在這裏:https://technet.microsoft.com/en-us/library/fp161388.aspx

+0

我已經下載了shrarepoint在線管理shell,並試圖用它作爲管理員,同樣的錯誤 – SCS

+0

連接到SharePoint沒有問題。 btw – SCS

+0

我不太清楚「連接到SharePoint時沒有問題」的意思,但是如果您使用Connect-SPOService連接到SharePoint,則會加載命令。我看不出有什麼理由需要以「管理員」身份運行。在PowerShell,PowerShell ISE和Visual Studio Code中,它適用於Windows 10上的我和同事。對不起,我不能有更多的幫助。 – Robin

相關問題