From 92c386ac0e63ebe9564c97b3263e3a6e1835eec7 Mon Sep 17 00:00:00 2001 From: Samuel Meuchel Date: Tue, 6 Jul 2021 19:41:16 -0500 Subject: [PATCH] Fixed ScreenConnect Collector script for ps 2.0 --- api/tacticalrmm/scripts/community_scripts.json | 2 +- scripts/Win_Screenconnect_GetGUID.ps1 | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/tacticalrmm/scripts/community_scripts.json b/api/tacticalrmm/scripts/community_scripts.json index 3057ddef..da32707c 100644 --- a/api/tacticalrmm/scripts/community_scripts.json +++ b/api/tacticalrmm/scripts/community_scripts.json @@ -175,7 +175,7 @@ "name": "Screenconnect - Get GUID for client", "description": "Returns Screenconnect GUID for client - Use with Custom Fields for later use. ", "args": [ - "-serviceName {{client.ScreenConnectService}}" + "{{client.ScreenConnectService}}" ], "shell": "powershell", "category": "TRMM (Win):Collectors" diff --git a/scripts/Win_Screenconnect_GetGUID.ps1 b/scripts/Win_Screenconnect_GetGUID.ps1 index 1cd423f2..6851968e 100644 --- a/scripts/Win_Screenconnect_GetGUID.ps1 +++ b/scripts/Win_Screenconnect_GetGUID.ps1 @@ -19,8 +19,9 @@ if (!$serviceName) { if (!$ErrorCount -eq 0) { exit 1 } - -$imagePath = Get-Itempropertyvalue "HKLM:\SYSTEM\ControlSet001\Services\$serviceName" -Name "ImagePath" + + +$imagePath = (Get-Item -Path HKLM:\SYSTEM\ControlSet001\Services\$serviceName).GetValue('ImagePath') $imagePath2 = ($imagePath -split "&s=")[1] $machineGUID = ($imagePath2 -split "&k=")[0] Write-Output $machineGUID \ No newline at end of file