Systems Management

Deleting Win32 Apps from Intune with PowerShell 

Topics: Systems Management

I was recently tasked with making a PowerShell script that can uninstall an application from Intune using PowerShell, rather than the user having to go into the Intune admin center to remove it. The app had been added multiple times with the same name and depended on another Intune app. In this post and the next, we’ll cover how to delete an Intune app and what to do when it has a dependency. 

 Delete an Intune App with PowerShell 

Deleting an Intune app with PowerShell is straightforward. 

Microsoft Graph is Microsoft’s API for accessing Microsoft 365 services and data. It’s a quick and easy way to access Intune and Entra ID and there’s a PowerShell module to do almost everything you need in Intune. 

Loading the module into PowerShell is as simple as running the command: 

Install-Module Microsoft.Graph -Scope CurrentUser -Force  

After installation, list the installed Graph modules with: 

Get-InstalledModule -Name Microsoft.Graph.* | Ft -A   
Remove Win32 apps from Intune with PowerShell - Graph Modules

In order to do actions with the cmdlets, connect to Microsoft Graph: 

Connect-MgGraph -Scopes "DeviceManagementApps.ReadWrite.All"  

This signs in with your credentials and grants Intune app-management permissions. After connecting, list all Intune apps: 

Get-MgDeviceAppManagementMobileApp | Select-Object DisplayName, Id, Publisher 

Which will display like this: 

Remove Win32 apps from Intune with PowerShell - Intune Apps

Now that we have the application ID, we can delete it with the following command: 

Remove-MgDeviceAppManagementMobileApp -MobileAppId ad637bdd-af20-4fbb-a06c-8118fdbdd62e  

When we list the applications again, you’ll notice that 1BitSquared KiCad (x64) 9.0.3 is no longer available. 

Remove Win32 apps from Intune with PowerShell - Output

However, If you try an application with a dependency (here I’m trying to delete the top Adobe Acrobat Reader DC MUI (x64)), you will get the following error: “Message”: “Cannot delete this app as it is the parent of another app: 111e310f-394c-4935-94f6-adde13300da4.  

You might also see: “Message”: “Cannot delete this app as it is the child of another app: e3e7e0b3-5b68-4055-b064-2e1bb117473c.  

Both errors mean the app has a dependency. The ID shown is the related app’s ID. In my example, Adobe Acrobat is the parent and Microsoft Visual C++ 2013 Redistributable is the child. 

To delete an app with a dependency, remove the dependency first. We’ll cover that in the next post. For now, here’s how to remove multiple apps with the same name. 

Delete Multiple Apps with the Same Name in Intune. 

To delete multiple apps with the same display name, use a script like this: 

# Check if Microsoft.Graph module is installed 
if (-not (Get-Module -ListAvailable -Name Microsoft.Graph.Applications)) { 
    Write-Host "Microsoft.Graph module not found. Installing..." 
    Install-Module Microsoft.Graph -Scope CurrentUser -Force 
} else { 
    Write-Host "Microsoft.Graph module is already installed. Skipping installation." 
} 
# Connect to Microsoft Graph with required scope 
Connect-MgGraph -NoWelcome -Scopes "DeviceManagementApps.ReadWrite.All" 
# Define the app name to search for 
$appName = "Adobe Acrobat Reader DC (MUI) (x64) 21.001.20135" 
# Get all apps and filter by name 
$apps = Get-MgDeviceAppManagementMobileApp | Where-Object { $_.DisplayName -eq $appName } 
# Loop through and delete each matching app 
foreach ($app in $apps) { 
    Write-Host "Deleting app: $($app.DisplayName) with ID: $($app.Id)" 
    Remove-MgDeviceAppManagementMobileApp -MobileAppId $app.Id 
} 
Write-Host "All matching apps deleted."
  • The first section checks for the Microsoft.Graph module and installs it if needed. 
  • The second section connects to Graph and requests the DeviceManagementApps.ReadWrite.All scope. 
  • In the third section, set $appName to the exact display name you want to remove. Use the earlier listcommand to confirm the display name. 
  • The fourth section retrieves all apps that match that display name. 
  • The fifth section loops through the matches, deletes each app, and writes the app ID to the console. 

Conclusion 

With these steps, you can quickly remove one or many Win32 apps from Intune using PowerShell and Microsoft Graph. This approach is especially useful when you need to automate cleanup or handle apps with duplicate names.  

In the next post, we’ll tackle a common blocker—how to remove dependencies so you can delete parent or child apps without running into errors. 

Back to Top