Uninstall-ADTApplication -Name "7-Zip" -ApplicationType 'MSI' -FilterScript { $_.Publisher -match 'Igor Pavlov' } works when PSADT 4.1.3 elevated and run as admin, but when it is executed via Intune it does not uninstall?
so when I check the logs for same package that run same uninstall command but now via Intun - it says:
| [Pre-Uninstall] :: Running Show-ADTInstallationWelcome silently as the current deployment is NonInteractive or Silent. |
Show-ADTInstallationWelcome |
27-08-2025 13:07:32 |
23620 (0x5C44) |
| [Pre-Uninstall] :: Checking for running processes: ['7zFM'] |
Get-ADTRunningProcesses |
27-08-2025 13:07:32 |
23620 (0x5C44) |
| [Pre-Uninstall] :: Specified processes are not running. |
Get-ADTRunningProcesses |
27-08-2025 13:07:32 |
23620 (0x5C44) |
| [Pre-Uninstall] :: Bypassing Show-ADTInstallationProgress [Mode: Silent]. Status message: Afinstallation i gang. Vent venligst... |
Show-ADTInstallationProgress |
27-08-2025 13:07:32 |
23620 (0x5C44) |
| [Uninstall] :: Getting information for installed applications matching the provided FilterScript... |
Get-ADTApplication |
27-08-2025 13:07:33 |
23620 (0x5C44) |
| [Uninstall] :: Found no application based on the supplied FilterScript. |
Get-ADTApplication |
27-08-2025 13:07:33 |
23620 (0x5C44) |
| [Uninstall] :: No applications found for removal. |
Uninstall-ADTApplication |
27-08-2025 13:07:33 |
23620 (0x5C44) |
| [Finalization] :: [IgorPavlov_7-Zipedition)_LatestVersion_x64_EN_01] uninstall completed in [0,6771776] seconds with exit code [0]. |
Close-ADTSession |
27-08-2025 13:07:33 |
23620 (0x5C44) |
Uninstall-ADTApplication -Name "Android Studio" -ApplicationType EXE -ArgumentList "/S"
can also add the same thing happens with exe uninstalls, when PSADT 4.1.3 run as admin it does uninstall and all is fine, but when via Intune will say:
[Uninstall] :: Found no application based on the supplied FilterScript. Get-ADTApplication 27-08-2025 13:37:03 27800 (0x6C98)
I'm not certain here, but I think the right use of quotes might be at play here
Looking at the reference for Uninstall-ADTApplication here:
All of the examples are enclosed in single quotes, I am unsure if this is intentional / required, but my first test would be to ensure my code matches the guidance first.
It may be that when it is run through Intune the double quotes are interpreted diferently.
Maybe retry your 1st command as:
Uninstall-ADTApplication -Name '7-Zip' -ApplicationType 'MSI' -FilterScript { $_.Publisher -match 'Igor Pavlov' }
and your 2nd - EXE now wrapped in (single) quotes, retry as:
Uninstall-ADTApplication -Name 'Android Studio' -ApplicationType 'EXE' -ArgumentList '/S'
Let us know how you get on
why those " " quotes should work fine when PSADT 4.1.3 run as admin it work and not when via Intune package ???? That does not make sense... I will change the quotes to ' ' and re-test. but again what if I need a " " to be able to access variables and such....
I have not adjusted to singe quotes and result is the same and log info is the same - no uninstall is happening while it run via Intune.
Uninstall-ADTApplication -Name '7-Zip' -ApplicationType 'MSI' -FilterScript { $_.Publisher -match 'Igor Pavlov' }
Uninstall-ADTApplication -Name '7-Zip' -ApplicationType 'EXE' -ArgumentList '/S' -ErrorAction SilentlyContinue
| [Initialization] :: Module [PSAppDeployToolkit.Extensions] imported successfully. |
PSAppDeployToolkit.Extensions.psm1 |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Pre-Uninstall] :: Running Show-ADTInstallationWelcome silently as the current deployment is NonInteractive or Silent. |
Show-ADTInstallationWelcome |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Pre-Uninstall] :: Checking for running processes: ['7zFM'] |
Get-ADTRunningProcesses |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Pre-Uninstall] :: Specified processes are not running. |
Get-ADTRunningProcesses |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Pre-Uninstall] :: Bypassing Show-ADTInstallationProgress [Mode: Silent]. Status message: Afinstallation i gang. Vent venligst... |
Show-ADTInstallationProgress |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Uninstall] :: Getting information for installed applications matching the provided FilterScript... |
Get-ADTApplication |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Uninstall] :: Found no application based on the supplied FilterScript. |
Get-ADTApplication |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Uninstall] :: No applications found for removal. |
Uninstall-ADTApplication |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Uninstall] :: Getting information for installed applications... |
Get-ADTApplication |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Uninstall] :: Found no application based on the supplied FilterScript. |
Get-ADTApplication |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Uninstall] :: No applications found for removal. |
Uninstall-ADTApplication |
27-08-2025 15:31:50 |
21876 (0x5574) |
| [Finalization] :: [IgorPavlov_7-Zipedition)_LatestVersion_x64_EN_01] uninstall completed in [0,6202745] seconds with exit code [0]. |
Close-ADTSession |
27-08-2025 15:31:50 |
21876 (0x5574) |
As commented on GitHub, IME executing PowerShell x86 is the likely culprit here.. If you use Invoke-AppDeployToolkit.exe (which ensures the native PowerShell is called), or "%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe" as above, this should resolve the issue.
Thank you for the fast reply, I was looking at your deployment instruction and it seems it need some updating for 4.1.3 - How to Deploy · PSAppDeployToolkit
So you mean this both via Intune should be fine?
Install command
%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File Invoke-AppDeployToolkit.ps1 -DeploymentType Install -DeployMode Auto -SuppressRebootPassThru
Uninstall command
%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File Invoke-AppDeployToolkit.ps1 -DeploymentType Uninstall -DeployMode Auto -SuppressRebootPassThru
Install command
Invoke-AppDeployToolkit.exe -DeploymentType Install -DeployMode Auto -SuppressRebootPassThru
Uninstall command
Invoke-AppDeployToolkit.exe -DeploymentType Uninstall -DeployMode Auto -SuppressRebootPassThru
Yes, I can confirm that this worked as intended:
Install command
Invoke-AppDeployToolkit.exe -DeploymentType Install -DeployMode Auto -SuppressRebootPassThru
Uninstall command
Invoke-AppDeployToolkit.exe -DeploymentType Uninstall -DeployMode Auto -SuppressRebootPassThru
and this one worked also as intended:
Install command
%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File Invoke-AppDeployToolkit.ps1 -DeploymentType Install -DeployMode Auto -SuppressRebootPassThru
Uninstall command
%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File Invoke-AppDeployToolkit.ps1 -DeploymentType Uninstall -DeployMode Auto -SuppressRebootPassThru
thank you very much! 