From 2ba3407a2c1b99c48751ca485fa12765418177da Mon Sep 17 00:00:00 2001 From: twistedpro Date: Thu, 15 Feb 2024 20:53:25 +1100 Subject: [PATCH 1/2] Update Get-CWCSession.ps1 updated endpoint --- .../Public/PageService/Get-CWCSession.ps1 | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 b/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 index f1f3ac3..f03c627 100644 --- a/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 +++ b/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 @@ -4,12 +4,12 @@ function Get-CWCSession { [Parameter(Mandatory=$True)] [ValidateSet('Support','Access','Meeting')] $Type, - [string]$Group = 'All Machines', + [string]$Group = $script:defaultGroup, [string]$Search, [int]$Limit ) - $Endpoint = 'Services/PageService.ashx/GetHostSessionInfo' + $Endpoint = 'Services/PageService.ashx/GetLiveData' switch($Type){ 'Support' { $Number = 0 } @@ -18,7 +18,27 @@ function Get-CWCSession { default { return Write-Error "Unknown Type, $Type" } } - $Body = ConvertTo-Json @($Number,@($Group),$Search,$null,$Limit) + #$Body = ConvertTo-Json @($Number,@($Group),$Search,$null,$Limit) + Write-Debug $Group + + $Body = @" +[ + { + `"HostSessionInfo`": { + `"sessionType`": 2, + `"sessionGroupPathParts`": [ + `"$Group`" + ], + `"filter`": `"$Search`", + `"findSessionID`": null, + `"sessionLimit`": 1000 + }, + `"ActionCenterInfo`": {} + }, + 0 +] +"@ + Write-Verbose $Body $WebRequestArguments = @{ @@ -28,5 +48,5 @@ function Get-CWCSession { } $Data = Invoke-CWCWebRequest -Arguments $WebRequestArguments - $Data.sessions + $Data.ResponseInfoMap.HostSessionInfo.sessions } From 4bec36b42bf3f95608c19a322b3dd97193c52c27 Mon Sep 17 00:00:00 2001 From: twistedpro Date: Thu, 15 Feb 2024 20:56:49 +1100 Subject: [PATCH 2/2] updated endpoint --- ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 b/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 index f03c627..cbd7795 100644 --- a/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 +++ b/ConnectWiseControlAPI/Public/PageService/Get-CWCSession.ps1 @@ -4,7 +4,7 @@ function Get-CWCSession { [Parameter(Mandatory=$True)] [ValidateSet('Support','Access','Meeting')] $Type, - [string]$Group = $script:defaultGroup, + [string]$Group = 'All Machines', [string]$Search, [int]$Limit )