From acccdb219b0bb4e681ad12796ff4c7e510cccd2d Mon Sep 17 00:00:00 2001 From: fencepost Date: Thu, 21 Mar 2024 23:58:13 -0500 Subject: [PATCH] Swap 'if' args so wildcard is after -like to allow matching Only the right-hand side of the -like operator can contain wildcards, so no $bin values that contained wildcards could ever match process names. --- RemoteControlAgentSearch.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RemoteControlAgentSearch.ps1 b/RemoteControlAgentSearch.ps1 index 0192715..cdc4b80 100644 --- a/RemoteControlAgentSearch.ps1 +++ b/RemoteControlAgentSearch.ps1 @@ -31,7 +31,7 @@ Foreach ($process in $processes){ Foreach($product in $products){ $bins = $product.Executables -Split ',' foreach($bin in $bins){ - if($bin -like $process.Name){ + if($process.Name -like $bin){ $return += New-Object psobject -Property ([ordered]@{Message="Found possible remote control application."; Product=$product.Software; ProcessName=$process.Name;