locked
Remove-AppxPackage does not work with Scripts in SCCM? RRS feed

  • Question

  • Hi,

    i have a problem with uninstall the built-in app while OS is online via "Scripts" in Software Library -> Scripts.

    The command is: Remove-AppxPackage -Package "Microsoft.WindowsMaps_5.1909.2813.0_x64__8wekyb3d8bbwe"

    It executes successfully, there are no error codes of any kind, but the app is still there after PS does its job.

    If I manually start powershell on a client and run the same command, it executes and removes the app.

    Cheers,


    • Edited by Tonito Dux Monday, December 9, 2019 12:00 PM
    Monday, December 9, 2019 10:22 AM

Answers

All replies

  • When run through the script feature, the script is run as SYSTEM and the app is thus removed for SYSTEM (and not the user currently logged on)

    In an online OS where the app exists for all users you would have to use Remove-AppxPackage with the -AllUsers parameter. :-)

    https://docs.microsoft.com/en-us/powershell/module/appx/remove-appxpackage?view=win10-ps#parameters


    Martin Bengtsson | Blog: www.imab.dk | Twitter: @mwbengtsson
    If a post helps to resolve your issue, please remember to click Mark as Answer.



    Monday, December 9, 2019 11:06 AM
  • Hi Martin,

    thank you, that was the missing piece of the puzzle.

    Can I also ask you why does the same powershell command fail in a online task sequence?

    It says in smsts.log that the parameter for .ps1 is missing. Error code: 0xFFFD0000

    TS, two steps, both "Run Command Line":

    powershell.exe -command "Set-ExecutionPolicy Bypass"

    and

    I want to execute it while windows is running.

    Cheers



    • Edited by Tonito Dux Monday, December 9, 2019 1:05 PM
    Monday, December 9, 2019 1:03 PM
  • Save yourself the headache and use the built-in step to run a Powershell script:

    Also, this script might be of interest for you: https://www.scconfigmgr.com/2019/05/03/remove-built-in-apps-for-windows-10-version-1903/

    :-)


    Martin Bengtsson | Blog: www.imab.dk | Twitter: @mwbengtsson
    If a post helps to resolve your issue, please remember to click Mark as Answer.

    Monday, December 9, 2019 1:09 PM
  • Hi once again,

    this did not work for me before, that is why I was trying with command line. But after your comment I tried and it worked! I guess the PS script was wrong (only today have I learned the correct command thanks to you).

    So thank you very much, 2/2 helpful answers - rarity today.

    Have a great day!

    Monday, December 9, 2019 1:22 PM
  • Hi,

    Thanks Martin for the helpful answers. Here's a short summary for the problem.

    Problem/Symptom:
    ===================
    1. The uninstall the built-in app script executes successfully, but the app is still there after PS does its job.
    2. the same PowerShell command fail in an online task sequence with the error 0xFFFD0000.

    Solution:
    ===================
    1. In an online OS where the app exists for all users you would have to use Remove-AppxPackage with the -AllUsers parameter.
    2. Use the built-in step to run a PowerShell script.

    Thanks again for your time.

    Best regards,
    Simon

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, December 10, 2019 3:15 AM