Enable-SBRAgent.ps1
|
function Enable-SBRAgent(){ [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [string] $ApiBaseUrl, [Parameter(Mandatory=$true)] [string] $ApiKey, [Parameter(Mandatory=$true)] [guid] $AgentUID ) $RestError = $null Invoke-RestMethod -Uri "$ApiBaseUrl/api/SBRAgents/$($AgentUID)/Activate" ` -Method Post ` -Headers @{"Authorization" = "Bearer " + $ApiKey } ` -ErrorVariable "RestError" if ($null -ne $RestError){ Write-Error -Message $RestError } } |