简体   繁体   中英

How to monitor VSTS agent availability using PowerShell?

How to get vsts agent status from a remote agent machine using powershell? I did google search and i didn't find any ideas or information about this.

I found solution in c#. But i am unable to do this in powershell. I tried to call the c# code in powershell. I am getting the error

Add-Type : (0) : Metadata file 'Microsoft.TeamFoundation.Client, Version=15.0.0.0.dll' could not be found (1) : using Microsoft.TeamFoundation.Client;

My code that is throwing the error is

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

You need to reference your .dll file by path:

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

Keep in mind that as -Path accepts array of strings ( see the docs ) you can use it like this:

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

Edit: as it's been spotted (in the comments - credits to user3081672 ), alternative method is to run

TestControllerConfig.exe status

This will give you status of all the agents on the controller. Check example here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM