Prevent removed apps from reinstalling

Page 2 of 2 FirstFirst 12

  1. Posts : 11
    Windows 7 Ultimate
       #11

    hannelius said:
    edit: i found out if you use classic shell
    you can uninstall all of these...
    even the store...
    just by right clicking

    and you get a nice start menu too...
    Yeah but you have to logout/login to find that they come back. You have to kill them also at the package repository level.
      My Computer


  2. Posts : 5,478
    2004
       #12

    illonus said:
    Hi, first I would like to say thank you so much for this, it worked for me. What I wanna ask is how do I add a line for an additional $apppath within this code?
    For example if I wanna have $appPath="$Env:LOCALAPPDATA\Packages\$app*" and also $appPath="C:\Program Files\WindowsApps\$app*"
    Well, you shouldn't have to delete from WindowsApps as the Remove-AppxProvisionedPackage command does that (at least for me in 14393 build ).

    If it isn't (and I remember sometime in the past it wasn't) and you want to do it manually it would be like this...

    Note that you can delete from %appdata% easily enough as your user owns it. You don't have authority to WindowsApps so you need to take ownership and grant yourself authority first or the Remove-Item will fail. This means you can't just duplicate the last 2 lines and stick them at the end of the foreach loop.

    See below in red. I've also updated the list of apps from GitHub - W4RH4WK as there are more these days. This script was taken from that project in the first place.
    Code:
    $apps = @(
        # default Windows 10 apps
        "Microsoft.3DBuilder"
        "Microsoft.Appconnector"
        "Microsoft.BingFinance"
        "Microsoft.BingNews"
        "Microsoft.BingSports"
        "Microsoft.BingWeather"
        #"Microsoft.FreshPaint"
        "Microsoft.Getstarted"
        "Microsoft.MicrosoftOfficeHub"
        "Microsoft.MicrosoftSolitaireCollection"
        #"Microsoft.MicrosoftStickyNotes"
        "Microsoft.Office.OneNote"
        #"Microsoft.OneConnect"
        "Microsoft.People"
        "Microsoft.SkypeApp"
        #"Microsoft.Windows.Photos"
        "Microsoft.WindowsAlarms"
        #"Microsoft.WindowsCalculator"
        "Microsoft.WindowsCamera"
        "Microsoft.WindowsMaps"
        "Microsoft.WindowsPhone"
        "Microsoft.WindowsSoundRecorder"
        #"Microsoft.WindowsStore"
        "Microsoft.XboxApp"
        "Microsoft.ZuneMusic"
        "Microsoft.ZuneVideo"
        "microsoft.windowscommunicationsapps"
        "Microsoft.MinecraftUWP"
    
        # Threshold 2 apps
        "Microsoft.CommsPhone"
        "Microsoft.ConnectivityStore"
        "Microsoft.Messaging"
        "Microsoft.Office.Sway"
    
        # non-Microsoft
        "9E2F88E3.Twitter"
        "Flipboard.Flipboard"
        "ShazamEntertainmentLtd.Shazam"
        "king.com.CandyCrushSaga"
        "king.com.CandyCrushSodaSaga"
        "king.com.*"
        "ClearChannelRadioDigital.iHeartRadio"
        #"TheNewYorkTimes.NYTCrossword"
    )
    
    foreach ($app in $apps) {
        Write-Host "Removing " -noNewLine; Write-Host $app -f white
    
        # Need to hide the progress bar as otherwise it remains on the screen
        $ProgressPreference = "SilentlyContinue"
    
        Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage
        $ProgressPreference = "Continue"
    
        Get-AppXProvisionedPackage -Online |
            where DisplayName -EQ $app |
            Remove-AppxProvisionedPackage -Online
                
        $appPath="$Env:LOCALAPPDATA\Packages\$app*"
        Remove-Item $appPath -Recurse -Force -ErrorAction 0
        
    
        $appPath = "$apppath = "C:\Program Files\WindowsApps\$app*"
    
        # take ownership
        takeown /f "$appPath" /r 
    	
        # Grant full rights to current user
        icacls "$appPath" --% /grant "%USERDOMAIN%\%USERNAME%":(F) /t
    
        # Delete directory
        Remove-Item $appPath -Recurse -Force -ErrorAction 0
    }
    I've not tried this updated code as I've already uninstalled all my apps and the directories in WindowsApps were removed automatically for me. Let us know if it works OK or not...
      My Computer


  3. Posts : 5,478
    2004
       #13

    illonus said:
    Yup I am aware of WindowsApp's permissions tweaking as I done it manually. Haha I've alrdy removed the directories by changing the $apppath in the first script you provided before I asked this, so I don't know if the new script would work either.
    We'll just have to wait until they come back with the next upgrade :)

    illonus said:
    So if I run this new script, by right it should remove the directories from both folders right? Thanks again for your help
    You're welcome and yes - that's the idea... The Remove-Item line just means "delete the folder with whatever the name $apppath has" and the takeown and icacls lines are a pretty standard (if old fashioned) way to give yourself authority.
      My Computer


  4. Posts : 1
    Win 10
       #14

    illonus said:
    Hi, first I would like to say thank you so much for this, it worked for me. What I wanna ask is how do I add a line for an additional $apppath within this code?
    For example if I wanna have $appPath="$Env:LOCALAPPDATA\Packages\$app*" and also $appPath="C:\Program Files\WindowsApps\$app*"

    If anyone could enlighten me I would be grateful, thank you!
    First off, many many thanks! Preforming a thread resurrection here to update the code:

    $appPath="$Env:LOCALAPPDATA\Packages\$app*"
    Remove-Item $appPath -Recurse -Force -ErrorAction 0


    $appPath = "$apppath = "C:\Program Files\WindowsApps\$app*"

    # take ownership
    takeown /f "$appPath" /r
    the red section needs 'code'" instead of "code" in order to run.

    So like this:

    $appPath="$Env:LOCALAPPDATA\Packages\$app*"
    Remove-Item $appPath -Recurse -Force -ErrorAction 0


    $appPath = "$apppath = 'C:\Program Files\WindowsApps\$app*'"

    # take ownership
    takeown /f "$appPath" /r
      My Computer


  5. Posts : 1
    Windows 10
       #15

    lx07 said:
    Right click uninstall only uninstalls for current user. You may want to uninstall the AppxProvisionedPackage as well as the AppxPackage. So for 3d builder, from powershell:
    Code:
    $app="Microsoft.3DBuilder"
    Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage
    Get-AppXProvisionedPackage -Online | where DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online
    if you want to remove more just delete the ones you want to keep from this code (or comment them with a #) then copy/paste into administrator powershell window and press enter:
    Code:
    $apps=@( 	
    	"9E2F88E3.Twitter"
    	"ClearChannelRadioDigital.iHeartRadio"
    	"Flipboard.Flipboard"
    	"king.com.CandyCrushSodaSaga"
    	"Microsoft.3DBuilder"
    	"Microsoft.BingFinance"
    	"Microsoft.BingNews"
    	"Microsoft.BingSports"
    	"Microsoft.BingWeather"
    	"Microsoft.CommsPhone"
    	"Microsoft.Getstarted"
    	#"Microsoft.Messaging"
    	"Microsoft.MicrosoftOfficeHub"
    	"Microsoft.MicrosoftSolitaireCollection"
    	"Microsoft.Office.OneNote"
    	"Microsoft.Office.Sway"
    	"Microsoft.People"
    	"Microsoft.SkypeApp"
    	"Microsoft.Windows.Phone"
    	"Microsoft.Windows.Photos"
    	"Microsoft.WindowsAlarms"
    	#"Microsoft.WindowsCalculator"
    	"Microsoft.WindowsCamera"
    	"Microsoft.WindowsMaps"
    	"Microsoft.WindowsPhone"
    	"Microsoft.WindowsSoundRecorder"
    	"Microsoft.XboxApp"
    	"Microsoft.ZuneMusic"
    	"Microsoft.ZuneVideo"
    	#"microsoft.windowscommunicationsapps"
    	"Microsoft.MinecraftUWP"
    	"ShazamEntertainmentLtd.Shazam"		
    )
    
    foreach ($app in $apps) {	
    	Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage
    	Get-AppXProvisionedPackage -Online | where DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online
    			
    	$appPath="$Env:LOCALAPPDATA\Packages\$app*"
    	Remove-Item $appPath -Recurse -Force -ErrorAction 0
    }
    Then as @TairikuOkami says they'll only come back if you do an upgrade or restore.
    I know I'm using Windows 10 but am struggling with this persistent reinstall
      My Computer


  6. Posts : 5,478
    2004
       #16

    eddyf said:
    I know I'm using Windows 10 but am struggling with this persistent reinstall
    They shouldn't be reinstalling.

    The persistent reinstall stopped after build 14926 in 2016 although MS still add new unwanted apps with each release.

    What version are you using?
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:37.
Find Us




Windows 10 Forums