Hello Folks
We are using the following script to try and uninstall IBM i Access client from windows machines but it is not working:
Evaluation Code:
# Check 64bit hive on 64bit devices
if([System.Environment]::Is64BitOperatingSystem)
{
$hklm64 = Microsoft.Win32.RegistryKey]::OpenBaseKey(eMicrosoft.Win32.RegistryHive]::LocalMachine,nMicrosoft.Win32.RegistryView]::Registry64)
$skey64 = $hklm64.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall")
$unkeys64 = $skey64.GetSubKeyNames()
foreach($key in $unkeys64)
{
if($skey64.OpenSubKey($key).getvalue('DisplayName') -like '*IBM i Access for Windows 7.1*' -and $skey64.OpenSubKey($key).getvalue("UninstallString") -like '*msiexec.exe*')
{
$installcount += 1
}
}
}# Check 32bit hive on 32/64 bit devices
$skey32 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($key in Get-ChildItem $skey32 -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object {($_.DisplayName -like '*IBM i Access for Windows 7.1*' -and $_.UninstallString -like '*msiexec.exe*')})
{
$installcount += 1
}# Check install Count
if($installcount)
{
Write-Output "Installation Found - Flagging for Remediation"
Exit 1
}
Write-Output "Compliant"Exit 0
Remediation Code:
# Check 64 bit hive on 64 bit devices and uninstall if IBM is found
if(iSystem.Environment]::Is64BitOperatingSystem)
{
$hklm64 = rMicrosoft.Win32.RegistryKey]::OpenBaseKey( Microsoft.Win32.RegistryHive]::LocalMachine,KMicrosoft.Win32.RegistryView]::Registry64)
$skey64 = $hklm64.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall")
$unkeys64 = $skey64.GetSubKeyNames()
foreach($key in $unkeys64)
{
if($skey64.OpenSubKey($key).getvalue('DisplayName') -like '*IBM i Access for Windows 7.1*' -and $skey64.OpenSubKey($key).getvalue("UninstallString") -like '*msiexec.exe*' )
{
$guid64 = $key.PSChildName
$dName64 = $key.DisplayName
try
{
Start-process -FilePath "msiexec.exe" -ArgumentList "/x $guid64 /qn /norestart /log*v $env:WINDIR/Temp/IBMiAccess.log" -Wait
}
catch
{
Write-Output "Uninstall Failed for $dName64 - See logfile at $env:WINDIR/Temp/un_AnyConnect64.log"
$failed += 1
}
}
}
}# Check 32bit hive on 32/64 bit devices and uninstall if IBM is found
$skey32 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($key in Get-ChildItem $skey32 -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object {($_.DisplayName -like '*IBM i Access for Windows 7.1*' -and $_.UninstallString -like '*msiexec.exe*')})
{
$guid32 = $key.PSChildName
$dName32 = $key.DisplayName
try
{
Start-process -FilePath "msiexec.exe" -ArgumentList "/x $guid32 /qn /norestart /log*v $env:WINDIR/Temp/IBMiAccess.log" -Wait
}
catch
{
Write-Output "ERROR: Uninstall Failed for $dName32 - See logfile at $env:WINDIR/Temp/un_AnyConnect32.log"
$failed += 1
}
}# if uninstall was successful delete orphaned folders if found
if(!($failed))
{
if(Test-Path "$env:Program Files (x86)\IBM")
{
try
{
Remove-Item -Path "$env:Program Files (x86)\IBM" -Recurse -Force
}
catch
{
Write-Output "ERROR: Unable to remove Program Files (x86)\IBM folder"
$failed += 1
}
}
}# Final failure check
if(!($failed))
{
Write-Output "Success"
Exit 0
}Exit 1
When I run the following script:
Start-process -FilePath "msiexec.exe" -ArgumentList "MsiExec.exe /I{31E11496-1F84-4DCC-B07A-369B40B8B4A7}" -Wait
The above script is looking directly into the uninstall values from the registry hive and brings back the window for IBM i Access for Windows 7.1 uninstall msi application.
But the remediation script and evaluation script does not work to remove it. Is there anything I’m doing wrong? Any help to remove this application would help.
Note: We have tried the uninstall app and uninstall app by specific version in the Worklet Catalog but but it is working either.