Unable to uninstall an application using PowerShell/InTune - McAfee

Alim Bhaluani 1 Reputation point
2021-11-03T02:21:23.707+00:00

Hello Everyone, I need some help...

I've been trying to uninstall McAfee Personal Security (MS Store App) using PowerShell/InTune but I'm having some issue.

The script is fairly simple, it's a one line command.

*Get-appxpackage -allusers 5A894077.McAfeeSecurity | Remove-AppPackage*

This works when running the script on the machine via PowerShell.

The issue seems to be when running the script through any automation process such as InTune or Task Scheduler (tested in both).

I've used Verbose and created a log file txt output to show it's running correctly. I've also created transcripts of the script which show successful as well.
I've also checked the IntuneManagementExtension log files & confirmed it ran successfully.
I've tried setting the execution policy to Unrestricted as well.

The deployment is applys to an AD Azure Group with 1 device (for testing) and is set to run as system (run as logged in user box is unchecked).

Please let me know your thoughts and if you need any further details or logs.

  • Alim
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,364 questions
Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
1,720 questions
Microsoft Intune Application management
Microsoft Intune Application management
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Application management: The process of creating, configuring, managing, and monitoring applications.
874 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,336 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Lu Dai-MSFT 28,346 Reputation points
    2021-11-03T05:48:18.937+00:00

    @Alim Bhaluani Thanks for posting in our Q&A.

    To clarify this issue, we appreciate your help to collect some information:

    1. Please make sure the Powershell script is deployed to the device successfully.
    2. Please check if the device is 64 bit. If yes, please set "Run script in 64 bit PowerShell Host" to "Yes" in the Powershell script.
    3. Make sure the device is Azure AD joined, not Azure AD registered.
    4. From your description, did you mean that the setting "Run this script using the logged on credentials" is set to "No"?
      If yes, is it successful when you use the local system account to run the Powershell script?

    If there is anything update or any misunderstanding, feel free to let us know.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Rahul Jindal [MVP] 9,146 Reputation points MVP
    2021-11-03T07:53:59.347+00:00

    If it is a store app, then you should be able to sync it from store for business to Intune and create an uninstallation assignment.

    0 comments No comments