2017-07-19 74 views
0

我有一臺IIS計算機承載一些調用Powershell文件的PHP。在Powershell文件中添加Powercli管理單元后,我連接到vSphere。停止連接消息爲Connect-VIServer返回

當它產生了一些我不想要的輸出,因爲它被放到每個php輸出頁面上。

名端口用戶---- ---- ---- myhostaddress.com 443的MyNetwork \ reporteruser

我試圖變量添加到月底停止反饋

Connect-VIServer -server myhostaddress.com -User $logincred.User -Password $logincred.Password -WarningAction SilentlyContinue -ErrorAction Continue 

但沒用。

有沒有辦法阻止它。或者一個聰明的方式來調用它,以便將輸出轉儲到其他地方?

回答

3

可以分配給一個變量的連接抑制​​輸出:

$connection = Connect-VIServer -Server myhostaddress.com -Credential $cred 

工作PS V5。

相關問題