top of page
Search

(161) Microsoft Intune - Uninstall Pesky Applications

  • Writer: Mr B SOE way
    Mr B SOE way
  • Apr 8
  • 1 min read

Recently I have this customer who has numerous versions of Adobe Acrobat Reader, so I have been using this "FastReferencePackage" script that uninstalls based on Get-Package in PowerShell.


As an example, if you were to run: Get-Package "Adobe Acrobat Reader", it will show up with:

By running the "Get-Package", it will show under Control Panel > Programs and Features.


Let's prepare the package with the following:



   $pname = "Adobe Acrobat Reader"
    $Pversion = "23.003.20269"
    $fastPackageReference = (Get-Package $pname).FastPackageReference
    $msiExecCommand = "MsiExec.exe /X `"$fastPackageReference`" /qn"
    #region Config
    $AppName = $PName + "_" + $Pversion + "_UninstallPackage"
    $client = "MR B SOE Way"
    $logPath = "$env:ProgramData\$client\logs"
    $logFile = "$logPath\$appName.log"
    $installer = $PName + "_" + $Pversion + "_Uninstaller.log"
    
    #endregion
    #region Logging
    if (!(Test-Path -Path $logPath)) {
        New-Item -Path $logPath -ItemType Directory -Force | Out-Null
    }

    Start-Transcript -Path $logFile -Force
    Write-Host "Uninstalling $PName $Pversion"

    Stop-Process -Name "AcroRd32" -Force

    $process = (Start-Process -FilePath "MsiExec.exe" -ArgumentList "/X `"$fastPackageReference`" /qn" -Wait -PassThru)
   
        Write-Host "Script completed successfully.."
        Stop-Transcript


    $appname = 'Adobe Acrobat Reader';
    $output = 'Detected';
    
    $Currentversion = (Get-Package -Name $appname -ErrorAction SilentlyContinue)

   
        if (!($currentversion)) {
            return $output
        }

Wrap it up as a Win32 app with https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool, then upload to Intune.


  • Install command line:

    • %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -executionpolicy bypass -command .\install.ps1

  • Install behaviour:

    • Must be in 'System' Context


Create and assign the group containing the specific version, the app package should look like this:



 
 
 

Comments


bottom of page