Moin,
das ganze für Powershell sieht in etwa so aus.
$user = "moby"
$token = "abcdefghijklmnopq"
$baseurl = "https://10.10.10.10/myinstance"
$queuename = "MyQueue"
# trust all certificates (local pascom instance)
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# authorization header for requests
$auth = @{
Authorization = "Basic $([Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($user):$($token)")))"
}
# get queue (including members)
$queue = Invoke-RestMethod $baseurl/services/queue/$queuename -Method GET -Headers $auth
# logout active members
foreach ($m in $($queue.members.Where({$_.loggedin})))
{
Invoke-RestMethod $baseurl/services/queue/$queuename/action -Method POST -Headers $auth -Body (@{
"action" = "logout"
"identity" = "$($m.agent)"
"penalty" = "0"
} | ConvertTo-Json) -ContentType "application/json"
}
Gruß,
Rapha