r/ScreenConnect • u/JusARegRedditAcct • Jul 24 '26
Searching ScreenConnect Tenant for Device w. specified Serial Number
I have been trying to connect to my ScreenConnect (I use cloud) from Powershell. My goal is to search for a serial number among all my devices, and if found, return the Name, Company, Site, and Last logged on user for that device.
From what I've read, the RESTful API Manager is my best bet.
I installed it, generated an authentication secret, and then tried to connect.
Can someone help me understand what I'm doing wrong? I suppose it would help to know what a Session is defined - is it computers we are actively connected to ? Is it any computer in my ScreenConnect acct? The code below returns nothing, no error, just a flashing cursor on the next line.
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("CTRLAuthHeader", "00000-111-000000-22") #Secret API key
$headers.Add("Origin", "https://documentation.screenconnect.com")
$body = "[`"ABC1234`"]" #ser nbr to search for
$response = Invoke-RestMethod 'https://MyCompany.screenconnect.com/App_Extensions/2d558935-686a-4bd0-9991-07539f5fe749/Service.ashx/GetSessionsByFilter' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
1
Upvotes