Windows 10: Updating .bat File, Removing Default Apps Solved

Page 2 of 3 FirstFirst 123 LastLast
  1.    02 Nov 2017 #11

    "PowerShell -Command "

    Is that the right thing? Or is that just the normal PowerShell?
      My ComputerSystem Spec


  2. Posts : 8,144
    10 Home x64 (1803) (10 Pro on 2nd pc)
       02 Nov 2017 #12

    A .bat file runs in the command prompt environment: cmd.exe. From a command prompt you can run the normal powershell. If you type powershell in a command prompt window it runs poweshell until you type 'exit' to close powershell.

    Each line in your .bat file is calling powershell and passing a command line for it to execute. If you run the .bat in a 'Command Prompt (Admin)' it should also run the powershell commands as administrator (which is required for them to work).
      My ComputersSystem Spec

  3.    02 Nov 2017 #13

    Bree said: View Post
    A .bat file runs in the command prompt environment: cmd.exe. From a command prompt you can run the normal powershell. If you type powershell in a command prompt window it runs poweshell until you type 'exit' to close powershell.

    Each line in your .bat file is calling powershell and passing a command line for it to execute. If you run the .bat in a 'Command Prompt (Admin)' it should also run the powershell commands as administrator (which is required for them to work).
    This is the same as right clicking and running as admin.
      My ComputerSystem Spec


  4. Posts : 8,144
    10 Home x64 (1803) (10 Pro on 2nd pc)
       03 Nov 2017 #14

    SightUp said: View Post
    This is the same as right clicking and running as admin.
    That should work too. The point is the .bat has to run in an elevated command processor in order to be able to run powershell at an elevated level.
      My ComputersSystem Spec

  5.    03 Nov 2017 #15

    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*3dbuilder*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowsalarms*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Appconnector*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Asphalt8Airborne*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowscalculator*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowscommunicationsapps*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowscamera*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*CandyCrushSodaSaga*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*DrawboardPDF*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Facebook*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*BethesdaSoftworks.FalloutShelter*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*FarmVille2CountryEscape*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*WindowsFeedbackHub*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*GetHelp*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*officehub*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*skypeapp*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*getstarted*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*zunemusic*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowscommunicationsapps*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowsmaps*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Messaging*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*solitairecollection*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Wallet*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*ConnectivityStore*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*MinecraftUWP*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*bingfinance*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*zunevideo*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Netflix*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*bingnews*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*onenote*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*OneConnect*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*MSPaint*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*PandoraMediaInc*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*people*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*CommsPhone*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowsphone*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*photos*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*WindowsScan*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*SkypeApp*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*bingsports*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*MicrosoftStickyNotes*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*windowsstore*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Office.Sway*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*getstarted*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Twitter*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*Microsoft3DViewer*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*soundrecorder*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*bingweather*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*xboxapp*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*XboxGameOverlay*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*XboxIdentityProvider*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*XboxOneSmartGlass*"} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*XboxSpeechToTextOverlay*"} | remove-appxprovisionedpackage –online"
    So this is my .bat. Why do I get errors on each line?
      My ComputerSystem Spec


  6. Posts : 8,144
    10 Home x64 (1803) (10 Pro on 2nd pc)
       03 Nov 2017 #16

    SightUp said: View Post
    So this is my .bat. Why do I get errors on each line?
    This is one of your lines...
    Code:
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "*CandyCrushSodaSaga*"} | remove-appxprovisionedpackage –online"
    I copied it, saved it to a .bat and tried to run it. I got errors too. In fact, there are two problems.

    First, look very carefully at each occurrence of –online. That is not a 'minus' sign (as it should be) at the beginning, It should look like this : -online (note the almost imperceptible difference between the and - characters). I'm not surprised you didn't spot it. Just find and replace all with - and it will work. (There's also a wrong before like.)

    It looks like this problem may be in the code lines as copied from @Brink's tutorial,

    The second problem is the use of the " quotes character. You have put quotes around the command to pass to powershell, but the command itself uses the " quotes character around the *packagename* bit. As written in your command line, only the part of the command between the first pair of quotes is passed to powershell. Effectively the command is interpreted as...
    PowerShell -Command "Get-appxprovisionedpackage –online | where-object {$_.packagename –like "
    ...the remainder of the line is being ignored.

    To correct that you need to use two different 'quote' delimiters. Use ' instead of " around each *packagename*.

    So, a working (and tested) version of your line above with both errors corrected is...
    Code:
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*CandyCrushSodaSaga*'} | remove-appxprovisionedpackage -online"
    nb. don't forget to run the .bat as Administrator.
      My ComputersSystem Spec

  7.    03 Nov 2017 #17

    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*3dbuilder*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowsalarms*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Appconnector*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Asphalt8Airborne*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowscalculator*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowscommunicationsapps*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowscamera*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*CandyCrushSodaSaga*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*DrawboardPDF*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Facebook*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*BethesdaSoftworks.FalloutShelter*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*FarmVille2CountryEscape*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*WindowsFeedbackHub*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*GetHelp*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*officehub*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*skypeapp*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*getstarted*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*zunemusic*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowscommunicationsapps*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowsmaps*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Messaging*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*solitairecollection*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Wallet*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*ConnectivityStore*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*MinecraftUWP*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*bingfinance*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*zunevideo*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Netflix*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*bingnews*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*onenote*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*OneConnect*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*MSPaint*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*PandoraMediaInc*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*people*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*CommsPhone*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowsphone*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*photos*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*WindowsScan*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*SkypeApp*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*bingsports*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*MicrosoftStickyNotes*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*windowsstore*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Office.Sway*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*getstarted*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Twitter*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*Microsoft3DViewer*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*soundrecorder*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*bingweather*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*xboxapp*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*XboxGameOverlay*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*XboxIdentityProvider*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*XboxOneSmartGlass*'} | remove-appxprovisionedpackage –online"
    PowerShell -Command "Get-appxprovisionedpackage -online | where-object {$_.packagename -like '*XboxSpeechToTextOverlay*'} | remove-appxprovisionedpackage –online"
    I tried to changed everything you recommended. I am still getting errors. Do you see what is still wrong?
      My ComputerSystem Spec

  8.    03 Nov 2017 #18

    OK! I got it working.

    Path :
    Online : True
    RestartNeeded : False
    Some of them had this line appear under the code and some didn't. Is that a problem?
      My ComputerSystem Spec

  9.    03 Nov 2017 #19

    SightUp said: View Post
    Some of them had this line appear under the code and some didn't. Is that a problem?
    No, it is normal.

    If something was removed you get it. If it wasn't (for example you try to remove a package that doesn't exist) you don't.

    You could consider deleting the junk from %appdata% as well. This is what I do:
    PHP Code:
            ForEach ($app in $apps) {    
                
    Write-Host "Removing " -noNewLineWrite-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            
            

      My ComputerSystem Spec

  10.    03 Nov 2017 #20

    lx07 said: View Post
    No, it is normal.

    If something was removed you get it. If it wasn't (for example you try to remove a package that doesn't exist) you don't.

    You could consider deleting the junk from %appdata% as well. This is what I do:
    PHP Code:
            ForEach ($app in $apps) {    
                
    Write-Host "Removing " -noNewLineWrite-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            
            

    This is something new. What does it do specifically? Is that complete?
      My ComputerSystem Spec


 
Page 2 of 3 FirstFirst 123 LastLast

Related Threads
What I have already is this: This works perfectly. Microsoft, in their good wisdom, decided to add a new folder however. I need some help. I found a website that tells me exactly how to remove it. I did it manually but going forward, I'd...
>.NBF file in Default apps in General Support
Is it possible to remove the .NBF from the list. 113119
Every time I reboot, the file associations for images (jpg/png), media (mp3/wav/mp4/mkv) revert back to the default Microsoft apps. I prefer to use VLC for videos, Winamp for audio and Irfanview for images, and it's getting really annoying having to...
Solved Removing default user in User Accounts and Family Safety
I have obtained a 'legacy' computer with W10 on it. There is a single user in the configuration, and the computer is 'named' after that user, meaning that when I look at my router, or see the computer in my network neighborhood, I see this user's...
When I go to the store and update my apps it also downloads and installs Microsoft Native runtime pack 1.123101.0. It keeps doing this every time and always the same file. Anyone know of a solution to this Thanks
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 16:38.
Find Us