How do I determine if a build agent is enabled prior to executing a pipeline task, in powershell?

Wayne Pfeffer 1 Reputation point
2023-11-13T20:40:08.98+00:00

I have a powershell task in a pipeline that cleans out old build directories from inside the agent directory on the build server. This is self hosted up in Azure. I need to be able to determine if the agent is enabled prior to the task executing. Is this even possible?

Community Center | Not monitored
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.