Are there any session variables which will allow me to output the following session and tab data on a page for dev purposes?
I am also curious if I can access this console with the session and tab data from a container shell or, a Connect-PSUSession, or a similar command.
adam
2
The variables are $SessionId and $PageId within a dashboard.
You can access this via the management API at:
/api/v1/dashboard/{id}/terminal/{sessionId}/{pageId}
Itβs a POST endpoint and the body should be formatted like:
@{
command = "Get-Process"
}
For example
Invoke-RestMethod http://localhost:5000/api/v1/dashboard/1/123-123-123-123-123/123-123-123-123-123 -Method POST -Body (@{ command = "GPS" } | ConvertTo-Json) -Headers @{
Authorization = "Bearer $Token"
}
1 Like
Thanks @adam, I will give this a go.
Hi @adam ,
Thanks for the examples. I am recieveing HTTP 415 (Unsupported Media Type) when i try to connect.
Can you see from the below example what may be causing this?
I have attempted this both with and without /terminal/ as it was missing from one of your examples.
$token = 'verylongtokenhere'
$psusession = '737fb9df-8e80-47be-aa9d-f3bdf1e840ff'
$PSUpage = 'bb79006a-ce5a-41e4-8a1e-1f41deaefa5c'
$url = "http://localhost:5000/api/v1/dashboard/1/terminal/" + $psusession + "/" + $PSUpage
Write-Output $url
http://localhost:5000/api/v1/dashboard/1/737fb9df-8e80-47be-aa9d-f3bdf1e840ff/78041a2a-2649-4b81-ac19-806b024ac7cb
Invoke-RestMethod $url -Method POST -Body (@{ command = "GPS" } | ConvertTo-Json) -Headers @{Authorization = "Bearer $Token"}
Invoke-RestMethod: Response status code does not indicate success: 415 (Unsupported Media Type)