Every agent has two sets of capabilities that define the features of the agent.
User capabilities are properties you can add to an agent to help identify a specific agent or a specific feature that it supports. These capabilities can be demanded in a release definition, so that Release Management automatically chooses the appropriate agent when executing a deployment. The capabilities can also be used to pass agent-specific values that are required by a deployment (such as the path of a tool or framework you have installed on the server). For more details, see Select the agent for a task phase.
System capabilities are built-in features of the agent such as the versions and locations of applications it can access when deploying artifacts. These capability settings cannot be changed.
You can use this in release definition, however just as jessehouwing said in that link you cannot access the capabilities from PowerShell through a variable unfortunately. And since build task acctually invoked by powershell script. So this can't be achieved for now.