From 92e37d4fa3eac648664d8b3c7e2d0d397d78797b Mon Sep 17 00:00:00 2001 From: Nils Coenen Date: Thu, 16 Jul 2026 09:50:14 +0200 Subject: [PATCH] Update file: Win_Teamviewer_Get_ID.ps1 - initialize GoodPath array - move ErrorActionPreference to script start --- scripts/Win_Teamviewer_Get_ID.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/Win_Teamviewer_Get_ID.ps1 b/scripts/Win_Teamviewer_Get_ID.ps1 index c67c1d12..ab688572 100644 --- a/scripts/Win_Teamviewer_Get_ID.ps1 +++ b/scripts/Win_Teamviewer_Get_ID.ps1 @@ -1,5 +1,7 @@ # Retrieve Teamviewer ID from TRMM agent. This tests versions 6+ known Registry Paths. +$ErrorActionPreference = 'SilentlyContinue' + $TeamViewerVersionsNums = @('6', '7', '8', '9', '') $RegPaths = @('HKLM:\SOFTWARE\TeamViewer', 'HKLM:\SOFTWARE\Wow6432Node\TeamViewer') $Paths = @(foreach ($TeamViewerVersionsNum in $TeamViewerVersionsNums) { @@ -8,6 +10,8 @@ $Paths = @(foreach ($TeamViewerVersionsNum in $TeamViewerVersionsNums) { } }) +$GoodPath = @() + foreach ($Path in $Paths) { If (Test-Path $Path) { $GoodPath += $Path @@ -17,7 +21,6 @@ foreach ($Path in $Paths) { foreach ($FullPath in $GoodPath) { If ($null -ne (Get-Item -Path $FullPath).GetValue('ClientID')) { $TeamViewerID = (Get-Item -Path $FullPath).GetValue('ClientID') - $ErrorActionPreference = 'silentlycontinue' }