Uninstall/unpin Spotify, WhatsApp, etc. using script

Jan Tichava 45 Reputation points
2023-11-10T14:08:14.0933333+00:00

Hello everyone,

on a clean Windows 11 installation is a lot of bloatware, which in some weird state - it's there, but it's not installed:

Screenshot 2023-11-10 at 12.36.24

If I right click on "Spotify", there is "Uninstall", but the app is not listed anywhere:Screenshot 2023-11-10 at 12.36.46

Screenshot 2023-11-10 at 12.41.36

The same is, when I use PowerShell to list all apps - it's not there.

Command "Get-AppxPackage Spo" returns nothing.

I found out, that this should list all Start Menu items and then I can do some operations with it, but Spotify is not in the list:

((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items()

I'm looking for a way, how to remove this bloatware using script - ideally PowerShell, but probably any other script would be also acceptable :-)

It's about Spotify, WhatsApp, LinkedIn and Kindle apps.

Thank you very much in advance.

Best regards,

Jan

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. MotoX80 36,401 Reputation points
    2023-11-11T20:32:13.2133333+00:00

    Here are the scripts that I use to clean up the VM's that I use for testing.

    cls
    "Junk App Report"
    "--------------------Junk---------------"
    $Junk = "xbox|phone|disney|skype|spotify|groove|solitaire|zune|mixedreality|tiktok|adobe|prime|soundrecorder|bingweather!3dviewer"
    Get-AppxPackage | Where-Object {  $_.Name -match $Junk  } | Format-Table -Property NonRemovable, Status, Name
    Get-AppxPackage -AllUsers | Where-Object {  $_.Name -match $Junk  } | Format-Table -Property NonRemovable, Status, Name
    Get-AppxProvisionedPackage -Online | Where-Object {  $_.DisplayName -match $Junk  }| Format-Table  -Property DisplayName
    ""
    "--------------------Everything---------------"
    Get-AppxPackage  | Format-Table -Property NonRemovable, Status, Name
    Get-AppxPackage -AllUsers |  Format-Table -Property NonRemovable, Status, Name
    Get-AppxProvisionedPackage -Online | Format-Table  -Property DisplayName
    
    
    

    Modify the junk variable for that apps that you want to remove. Note that it removes apps that are provisioned but not installed. Start small, do one or 2 apps. The first time you run the script you may get errors because the app hasn't been installed for any user. If you run it a second time it should be clean.

    Some apps cannot be removed.

    $Junk = "xbox|phone|disney|skype|spotify|groove|solitaire|zune|mixedreality|tiktok|adobe|prime|soundrecorder|bingweather!3dviewer"
    "Removing apps for this user only."
    $packages = Get-AppxPackage | Where-Object {  $_.Name -match $Junk  } | Where-Object -Property NonRemovable -eq $false 
    foreach ($appx in $packages) {
        "Removing {0}" -f $appx.name
        Remove-AppxPackage $appx   
    }
    ""
    "Removing apps for all users."
    $packages = Get-AppxPackage -AllUsers | Where-Object {  $_.Name -match $Junk  } | Where-Object -Property NonRemovable -eq $false 
    foreach ($appx in $packages) {
        "Removing {0}" -f $appx.name
        Remove-AppxPackage $appx -AllUsers 
    }
    ""
    "Removing provisioned apps."
    $packages = Get-AppxProvisionedPackage -Online | Where-Object {  $_.DisplayName -match $Junk  }
    foreach ($appx in $packages) {
        "Removing {0}" -f $appx.displayname
        Remove-AppxProvisionedPackage -online -allusers -PackageName $appx.PackageName 
    }
    
    
    3 people found this answer helpful.

  2. S.Sengupta 24,636 Reputation points MVP
    2023-11-11T02:06:03.9366667+00:00
    1. Run PowerShell with administrative rights.
    2. After Windows PowerShell opens, type get-appxpackage and press Enter.
    3. Scroll through the list of bloatware you want to remove.
    4. Once you find the bloatware you want to uninstall, type get-appxpackage ** remove-appxpackage. is the name of the app you want to remove. For example, if you want to remove Spotify, simply type get-appxpackage spotifyapp.

  3. 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

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.