簡體   English   中英

如何使用 PowerShell 監控 VSTS 代理的可用性?

[英]How to monitor VSTS agent availability using PowerShell?

如何使用powershell從遠程代理機器獲取vsts代理狀態? 我做了谷歌搜索,我沒有找到任何關於這個的想法或信息。

我在 c# 中找到了解決方案。 但是我無法在 powershell 中執行此操作。 我試圖在 powershell 中調用 c# 代碼。 我收到錯誤

添加類型:(0):找不到元數據文件“Microsoft.TeamFoundation.Client,版本=15.0.0.0.dll”(1):使用 Microsoft.TeamFoundation.Client;

我拋出錯誤的代碼是

$Assemblies = ("Microsoft.TeamFoundation.Client, Version=15.0.0.0", "Microsoft.TeamFoundation.Lab.Client, Version=15.0.0.0")

您需要通過路徑引用您的.dll文件:

Add-Type -Path 'C:\path\to\your\assembly.dll'

請記住,由於-Path接受字符串數組( 請參閱文檔),您可以像這樣使用它:

$assemblies = "C:\Path\To\Microsoft.TeamFoundation.Client.dll", "C:\Path\To\Microsoft.TeamFoundation.Lab.Client.dll"
Add-Type -Path $assemblies 

編輯:因為它被發現(在評論中 - 歸功於user3081672 ),替代方法是運行

TestControllerConfig.exe status

這將為您提供控制器上所有代理的狀態。 在此處查看示例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM