Troubleshooting WhatsApp Removal from a Windows Computer using Intune Scripts

Question

Hi all,

I am trying to remove the WhatsApp application from a Windows computer using Intune.
For testing purposes, I installed the WhatsApp app to a PC. Then added a script and assigned it to this system.
After execution, the status of the script is shown as success. But the app is still there.
Later, I tried with another script. The result is the same.
I am adding both scripts below for your reference.
Could you please help me out to do this?
Script 1:
Get-AppxPackage -Name WhatsApp | Remove-AppxPackage
Script 2:
$WhatsAppApp = Get-WmiObject -Query “SELECT * FROM Win32_Product WHERE Name LIKE ‘%WhatsApp%'”
if ($WhatsAppApp) {
$WhatsAppApp.Uninstall()
} else {
Write-Host “WhatsApp not found.”

Posted a Question by Joseph K in the HTMD FB group

whatss - HTMD Forum - Welcome to the world of Device Management! This is community build by Device Management Admins for Device Management Admins❤️ Ask your questions!! We are here to help you! - Troubleshooting WhatsApp Removal from a Windows Computer using Intune Scripts

Answers ( 4 )

    1
    2025-06-12T00:59:50+05:30

    Hi Rasmi,

    If the WhatsApp is installed as a Win32 app (Older exe/msi version) use Get-CimInstance instead of Get-WmiObject (modern and more efficient)

    Use the below mentioned PowerShell Script :-

    $WhatsAppApp = Get-CimInstance -ClassName Win32_Product | Where-Object { $_.Name -like “*WhatsApp*” }

    if ($WhatsAppApp) {
    $WhatsAppApp | ForEach-Object {
    $_.Uninstall()
    Write-Host “Uninstalled: $($_.Name)”
    }
    } else {
    Write-Host “WhatsApp not found.”
    }

    Best answer
  1. Rasmi p
    0
    2025-04-02T20:31:21+05:30

    Replied by Michael Pantner

    Have you tried Winget? And as someone else mentioned, is the install user lever or system, and what context is the script running in?

    Replied by Robin Hjärtfors

    Use winget instead. It will probably work better.

    Replied by Rúben Almeida

    On script 1, you must add -AllUsers on both Get and Remove

    Replied by Joseph K

    When using winget, it is failing. I directly ran winget using PowerShell to test, it was working fine. While applying via Intune, it fails. Robin Hjärtfors Michael Pantner

    Replied by Michael Pantner

    Joseph K, what is the full command you’re using for winget? You need to give the full path to the exe, you can’t just call “winget” or “winget.exe”, unfortunately

  2. Rasmi p
    0
    2025-04-02T20:30:15+05:30

    Replied by Aaron Tytgat

    Depending on how WhatsApp was installed. Microsoft store: Get-AppxPackage -AllUsers -Name “WhatsApp” | Remove-AppxPackage
    OR Exe/mfi installation: $app = Get-Package | Where-Object { $_.Name -like “WhatsApp” }
    if ($app) {
    $app | Uninstall-Package -Force
    } else {
    Write-Host “WhatsApp not found.”
    }

    Replied by Gordon Dragovich

    and check the Get components of both are returning something to then try the remove

    Replied by CJ Tarbox

    Can always try adding it to Intune and setting it to uninstall, which works great for the Windows Store apps

    Replied by Steven McKenzie

    Is it a Windows app? If it is an application on Intune. Find the app in the store and choose Uninstall

  3. Rasmi p
    0
    2025-04-02T20:29:39+05:30

    For more details – Step by Step Process of Removing or Uninstalling an App using Intune – https://www.anoopcnair.com/process-of-remove-or-uninstall-app-using-intune/

    Replied by Ryan Matthew

    Did you test the script manually to ensure it would work? Also, what are your installation commands in Intune? Did you review the IME logs to ensure the script ran properly?

    Replied by Peter Cashen

    Are you running as a system or a user?

    Replied by David Stanton

    Peter Cashen, this is the start of the answer.

    Replied by Joseph K

    I created a Group and added the system and its user to the same group.
    Assigned policy to this group. Both the user and the system show success. But the Application is still there.

Leave an answer

Sorry, you do not have permission to answer to this question .