unable to uninstall windows store app using SCCM Task Sequence

Salanje Banda 20 Reputation points
2023-09-12T19:12:19.6933333+00:00

I tried to run the following two commands manually on one of the machine and it worked.However,i tried to push the same commands through sccm task sequence on another machine as available.I run it and it showed successful but unfortunately the app is still appearing on the computer after running the first command l have shared.What am i missing?

Get-WmiObject -Query "select version from Win32_InstalledStoreProgram where name='Microsoft.ECApp'"

Get-AppxPackage -User alfred.cb.lim | Where-Object {$_.Name-match ".Microsoft.ECApp*.*"} | Remove-AppxPackage

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,500 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,482 questions
Microsoft Configuration Manager
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,470 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Simon Ren-MSFT 33,761 Reputation points Microsoft Vendor
    2023-09-25T08:09:15.07+00:00

    Hi,

    1,We can run the command line step with local admin privilege user account to have a try.

    2,If this still fails, we can use PsExec.exe to run the package/program under a specified credential to have a try. For more detailed information, please refer to:

    How to Access the Local System Account

    MDT/SCCM 2010 - Running Applications Installations under different credentials

    PsTools

    Hope it helps. Have a nice day!

    Best regards,

    Simon


    If the response is helpful, please click "Accept Answer" and upvote it.

    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.

    0 comments No comments

  3. MotoX80 33,376 Reputation points
    2023-09-25T14:44:01.2366667+00:00

    That is what i have done in user context but still failing

    Add logging and troubleshooting statements to your script to capture errors and verify that your variables contain the data that you think they have.

    Save a C:\temp\Uninstall.ps1 script on the target PC and have Powershell execute the .ps1 file. Use a folder that has "everyone full control".

    Start-Transcript C:\Temp\Uninstall.log  
    "This process is executing as the following account."
    whoami.exe 
    $appx = Get-AppxPackage -User alfred.cb.lim
    "We found {0} packages." -f $appx.count
    $ECA = $appx | Where-Object {$_.Name-match ".Microsoft.ECApp*.*"} 
    "We found {0} ECApp packages." -f $ECA.count
    $ECA | Remove-AppxPackage
    Stop-Transcript 
    

    Review the transcript log file.

    Maybe you should just uninstall it for all users? "Get-AppxPackage -Allusers".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.