From feefd44119bc4d41ea4b31f01b4f29f5461b6f33 Mon Sep 17 00:00:00 2001 From: John Worth Date: Thu, 30 May 2024 19:23:30 +0100 Subject: [PATCH 1/2] Add files via upload --- .../PageService/Remove-CWCHostFromSession.ps1 | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ConnectWiseControlAPI/Public/PageService/Remove-CWCHostFromSession.ps1 diff --git a/ConnectWiseControlAPI/Public/PageService/Remove-CWCHostFromSession.ps1 b/ConnectWiseControlAPI/Public/PageService/Remove-CWCHostFromSession.ps1 new file mode 100644 index 0000000..b4d48d9 --- /dev/null +++ b/ConnectWiseControlAPI/Public/PageService/Remove-CWCHostFromSession.ps1 @@ -0,0 +1,38 @@ +function Remove-CWCHostFromSession +{ + [CmdletBinding(SupportsShouldProcess)] + param ( + [Parameter(Mandatory = $True)] + [guid[]]$SessionID, + [Parameter(Mandatory = $True)] + [guid[]]$ConnectionID, + [Parameter(Mandatory = $True)] + [string]$Group + ) + + $Endpoint = 'Services/PageService.ashx/AddSessionEvents' + + $SessionEventType = 48 + $Body = ConvertTo-Json @( + @( + $Group + ), + @( + @{ + SessionID = $SessionID + EventType = $SessionEventType + ConnectionID = $ConnectionID + } + ) + ) + + $WebRequestArguments = @{ + Endpoint = $Endpoint + Body = $Body + Method = 'Post' + } + if ($PSCmdlet.ShouldProcess($WebRequestArguments.Body, 'Remove-CWCHostFromSession')) + { + Invoke-CWCWebRequest -Arguments $WebRequestArguments + } +} \ No newline at end of file From 057660bdf3d5a86e9723c2cc2d889d0d3e387df1 Mon Sep 17 00:00:00 2001 From: John Worth Date: Thu, 30 May 2024 19:25:01 +0100 Subject: [PATCH 2/2] Update ConnectWiseControlAPI.psd1 --- ConnectWiseControlAPI/ConnectWiseControlAPI.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ConnectWiseControlAPI/ConnectWiseControlAPI.psd1 b/ConnectWiseControlAPI/ConnectWiseControlAPI.psd1 index 2e39cbf..0d2f4e0 100644 --- a/ConnectWiseControlAPI/ConnectWiseControlAPI.psd1 +++ b/ConnectWiseControlAPI/ConnectWiseControlAPI.psd1 @@ -69,7 +69,7 @@ # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. - FunctionsToExport = @('Get-CWCAuditInfo','Get-CWCAuditLog','Connect-CWC','Get-CWCLauncURL','Add-CWCRemoteWorkforceRequiredRole','New-CWCRemoteWorkforceAssignment','New-CWCMFA','Get-CWCLastContact','Get-CWCSession','Get-CWCSessionDetail','Invoke-CWCCommand','Invoke-CWCWake','New-CWCAccessToken','Remove-CWCSession','Update-CWCCustomProperty','Update-CWCSessionName','Get-CWCSecurityConfigurationInfo','New-CWCUser','Remove-CWCUser','Update-CWCUser','Get-CWCSessionGroup') + FunctionsToExport = @('Get-CWCAuditInfo','Get-CWCAuditLog','Connect-CWC','Get-CWCLauncURL','Add-CWCRemoteWorkforceRequiredRole','New-CWCRemoteWorkforceAssignment','New-CWCMFA','Get-CWCLastContact','Get-CWCSession','Get-CWCSessionDetail','Invoke-CWCCommand','Invoke-CWCWake','New-CWCAccessToken','Remove-CWCSession','Remove-CWCHostFromSession','Update-CWCCustomProperty','Update-CWCSessionName','Get-CWCSecurityConfigurationInfo','New-CWCUser','Remove-CWCUser','Update-CWCUser','Get-CWCSessionGroup') # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @()