Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 如何使用PowerShell监控VSTS代理可用性?_Visual Studio_Powershell - Fatal编程技术网

Visual studio 如何使用PowerShell监控VSTS代理可用性?

Visual studio 如何使用PowerShell监控VSTS代理可用性?,visual-studio,powershell,Visual Studio,Powershell,如何使用powershell从远程代理计算机获取vsts代理状态? 我在谷歌上搜索过,但没有找到任何关于这方面的想法或信息 我在c#中找到了解决办法。但我无法在powershell中执行此操作。我试着在powershell中调用c代码。我发现了错误 添加类型:(0):找不到元数据文件“Microsoft.TeamFoundation.Client,Version=15.0.0.0.dll” (1) :使用Microsoft.TeamFoundation.Client 我抛出错误的代码是 $Ass

如何使用powershell从远程代理计算机获取vsts代理状态? 我在谷歌上搜索过,但没有找到任何关于这方面的想法或信息

我在c#中找到了解决办法。但我无法在powershell中执行此操作。我试着在powershell中调用c代码。我发现了错误

添加类型:(0):找不到元数据文件“Microsoft.TeamFoundation.Client,Version=15.0.0.0.dll” (1) :使用Microsoft.TeamFoundation.Client

我抛出错误的代码是

$Assemblies=(“Microsoft.TeamFoundation.Client,版本=15.0.0.0”,
“Microsoft.TeamFoundation.Lab.Client,Version=15.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 
编辑:正如它被发现(在评论-信用到),替代方法是运行

TestControllerConfig.exe status

这将为您提供控制器上所有代理的状态。检查示例。

StackOverflow不是编码服务。你试过什么?你在哪里失败了?查看并编辑您的问题。我找到了一种替代方法,可以在不使用TFS程序集进行连接的情况下获取代理状态(就绪或未就绪)。我们可以通过运行进程“C:\ProgramFiles(x86)\MicrosoftVisualStudio12.0\Common7\IDE\TestControllerConfig.exe”并将参数设置为“Status”来实现这一点。这将为您提供有关在该controllerHi@user3081672下注册的所有代理计算机的信息-我在回答中添加了您的解决方案。如果您觉得有用,请将其标记为已接受。非常感谢。是 啊谢谢你,罗比