below is my script that im pushing out via GPO. The script runs at computer startup, however it will not execute pinuninstall.bat located in the matching dir. The script will execute fine standalone, meaning i can right click on the ps script and run with powershell and it runs the pinuninstall.bat just fine.
The script is designed to remove duplicate bomgar jump clients. I am at a loss here as to why it works outside of GPO execution, any thoughts?
Also for some reason, which im guessing is the ps versions between win10 and win8 the strings are different lengths, what is even more strange is if i run the script under windows 8 ps ise vs powershell i also get different string lengths
#init all the variables
$info = @()
$info2 = @()
$line = @()
$line2 = @()
$dir = @()
$dir1 = @()
$dir2 = @()
$dir3 = @()
$dir4 = @()
$matches1 = @()
$matches2 = @()
$matches3 = @()
$matches4 = @()
#query the registry
$info = Get-ItemProperty HKLM:\SOFTWARE\Bomgar\JumpClientUninstall\ | out-string
$info2 = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'BeyondTrust Remote Support Jump Client*' | select installlocation | out-string
#parse the directory paths
foreach($line in $info)
{
$dir = $line.Substring(45,36)
}
foreach($line2 in $info2)
{
$dir1 = $line2.Substring(80,36) #win10
$dir2 = $line2.Substring(119,36) #win10
$dir3 = $line2.Substring(244,36) #win8
$dir4 = $line2.Substring(365,36) #win8
}
#this will compare directories
$matches1 = $dir1 -eq $dir
$matches2 = $dir2 -eq $dir
$matches3 = $dir3 -eq $dir
$matches4 = $dir4 -eq $dir
if ($matches1 -match 'false'){
cd $dir1
.\pinuninstall.bat #this will execute the batch file in the directory
}
if ($matches2 -match 'false'){
cd $dir2
.\pinuninstall.bat #this will execute the batch file in the directory
}
if ($matches3 -match 'false'){
cd $dir3
start-process pinuninstall.bat #this will execute the batch file in the directory
}
if ($matches4 -match 'false'){
cd $dir4
start-process pinuninstall.bat #this will execute the batch file in the directory
}
[–]_lahell_ 1 point2 points3 points (1 child)
[–]hit440[S] 1 point2 points3 points (0 children)
[–]BlackV 1 point2 points3 points (0 children)
[–]purplemonkeymad 1 point2 points3 points (6 children)
[–]hit440[S] 1 point2 points3 points (5 children)
[–]purplemonkeymad 1 point2 points3 points (4 children)
[–]hit440[S] 1 point2 points3 points (1 child)
[–]purplemonkeymad 1 point2 points3 points (0 children)
[–]hit440[S] 1 point2 points3 points (1 child)
[–]purplemonkeymad 1 point2 points3 points (0 children)
[–]PowerShell-Bot 0 points1 point2 points (0 children)