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].
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.
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....
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