diff --git a/api/tacticalrmm/scripts/community_scripts.json b/api/tacticalrmm/scripts/community_scripts.json index 5cdb9a0c..6f5f29b2 100644 --- a/api/tacticalrmm/scripts/community_scripts.json +++ b/api/tacticalrmm/scripts/community_scripts.json @@ -161,6 +161,18 @@ "shell": "powershell", "category": "TRMM (Win):Collectors" }, + { + "guid": "973c34d7-cab0-4fda-999c-b4933655f946", + "filename": "Win_Screenconnect_GetGUID.ps1", + "submittedBy": "https://github.com/silversword411", + "name": "Screenconnect - Get GUID for client", + "description": "Returns Screenconnect GUID for client - Use with Custom Fields for later use. ", + "args": [ + "-serviceName {{client.ScreenConnectService}}" + ], + "shell": "powershell", + "category": "TRMM (Win):Collectors" + }, { "guid": "95a2ee6f-b89b-4551-856e-3081b041caa7", "filename": "Win_Power_Profile_Reset_High_Performance_to_Defaults.ps1", diff --git a/scripts/Win_Screenconnect_GetGUID.ps1 b/scripts/Win_Screenconnect_GetGUID.ps1 new file mode 100644 index 00000000..5eff74e8 --- /dev/null +++ b/scripts/Win_Screenconnect_GetGUID.ps1 @@ -0,0 +1,25 @@ +<# +Requires global variables for serviceName "ScreenConnectService" +serviceName is the name of the ScreenConnect Service once it is installed EG: "ScreenConnect Client (1327465grctq84yrtocq)" +Variable value must start and end with " (Prior to TRMM Version 0.6.5), remove / don't use " on TRMM Version 0.6.5 or later. +Requires Custom Fields Agent entry Name: ScreenConnectGUID Type: text +URL Action entry: https://YOURNAME.screenconnect.com/Host#Access/All%20Machines//{{agent.ScreenConnectGUID}}/Join +#> + +param ( + [string] $serviceName +) + +if (!$serviceName) { + write-output "Variable not specified ScreenConnectService, please create a global custom field under Client called ScreenConnectService, Example Value: `"ScreenConnect Client (1327465grctq84yrtocq)`" `n" + $ErrorCount += 1 +} + +if (!$ErrorCount -eq 0) { + exit 1 +} + +$imagePath = Get-Itempropertyvalue "HKLM:\SYSTEM\ControlSet001\Services\$serviceName" -Name "ImagePath" +$imagePath2 = ($imagePath -split "&s=")[1] +$machineGUID = ($imagePath2 -split "&k=")[0] +Write-Output $machineGUID \ No newline at end of file