我看到很多有關PowerShell +等待進程結束的主題,但不知何故它不適合我。我有這樣的:等待任務運行? /任務完成時跳轉下一行?
Add-PsSnapin Microsoft.SharePoint.Powershell
Add-SPSolution sol.wsp
Install-SPSolution -identity $sol -GACDeployment
Install-SPFeature "feature"
什麼即時試圖做的是增加一個新的SharePoint(2010)的解決方案,然後我試着去安裝的解決方案,最後我試着去安裝功能。
最後一個失敗,因爲解決方案的安裝需要更長的時間,但他已經嘗試安裝該功能。如果我再次啓動腳本,則可以安裝該功能,我收到錯誤Install-SPFeature : Failed to find the XML file at location
。我怎麼能改變我的腳本來處理這個問題?確定我可以使用Start-Sleep -s 2
什麼的,但那不是最好的方法。 | Out-Null
或-Wait
也不能工作。我認爲這是因爲該進程或任何它已經完成,但Windows需要幾秒鐘才能意識到該解決方案已安裝。有任何想法嗎?謝謝
嗯,這個我不能做任何事情,我得到的消息:'術語'Install-SPSolution'不被識別爲cmdlet,函數,腳本文件或可操作程序的名稱。檢查名稱的拼寫,或者如果路徑包含012dded,請驗證路徑是否正確,然後重試。 + CategoryInfo:ObjectNotFound:(Install-SPSolution:String)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException' – sabisabi 2012-04-10 14:55:46
這僅僅是因爲你必須在作爲工作開始的scriptblock內添加snappin。你也打電話給工作傳遞參數。 – JPBlanc 2012-04-10 15:23:59