Windows 10: Uninstalling ALL store apps with a script Solved

Page 1 of 2 12 LastLast
  1.    11 Jun 2018 #1

    Uninstalling ALL store apps with a script


    I know absolutely nothing about Powershell, and I don't even want to.
    I would like to uninstall ALL store apps through a script/batch file or something. Could anyone tell me how?
    Apparently this is the Ps command to use "Get-AppxPackage -allusers | Remove-AppxPackage" - but I have no idea how to integrate this into a batch file.
      My ComputerSystem Spec

  2.    11 Jun 2018 #2

    Then you won't want to read this:
    Running PowerShell Scripts Is as Easy as 1-2-3 | IT Pro
    as to run a PS script you have to set an execution policy.
    Change PowerShell Script Execution Policy in Windows 10 | Windows 10 Tutorials

    A PowerShell script is simply a text file with a .ps1 extension that contains a list of commands PowerShell should execute. However, PowerShell's secure by default philosophy prevents all scripts from running, so double-clicking a PowerShell script from Windows Explorer won't execute it.

    windows - How to run a PowerShell script? - Stack Overflow.
      My ComputerSystem Spec

  3.    11 Jun 2018 #3

    Thanks.
    Which execution policy do I need to use though?
    And how do I change it back when it's done? (if it works)
      My ComputerSystem Spec

  4.    11 Jun 2018 #4

    Octopuss said: View Post
    Thanks.
    Which execution policy do I need to use though?
    And how do I change it back when it's done? (if it works)
    Code:
    Set-ExecutionPolicy Bypass -Scope Process
    It will bypass the executionpolicy currently in place, for the session only.
    i.e Run your script and when you exit PowerShell everything is as before.
      My ComputerSystem Spec

  5. TairikuOkami's Avatar
    Posts : 3,418
    10.6 Home 1809 x64
       12 Jun 2018 #5

    Octopuss said: View Post
    but I have no idea how to integrate this into a batch file.
    Code:
    %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe "Get-AppxPackage -AllUsers | Remove-AppxPackage"
      My ComputerSystem Spec

  6.    12 Jun 2018 #6

    Hm, doesn't work.
    The script literally only does this:
    Set-ExecutionPolicy Bypass -Scope Process
    Get-AppxPackage -allusers | Remove-AppxPackage

    The command I run from a batch file is
    Code:
    powershell "%SystemDrive%\install\remove-store-apps.ps1"
    I still get the "usual" error message.
    Code:
    c:\Install>powershell "%SystemDrive%\install\remove-store-apps.ps1"
    C:\install\remove-store-apps.ps1 : File C:\install\remove-store-apps.ps1 cannot be loaded because running scripts is di
    sabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135
    170.
    At line:1 char:1
    + C:\install\remove-store-apps.ps1
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : SecurityError: (:) [], PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess
    
    c:\Install>
      My ComputerSystem Spec

  7.    12 Jun 2018 #7

    Octopuss said: View Post
    Hm, doesn't work.
    The script literally only does this:
    Set-ExecutionPolicy Bypass -Scope Process
    Get-AppxPackage -allusers | Remove-AppxPackage

    The command I run from a batch file is
    Code:
    powershell "%SystemDrive%\install\remove-store-apps.ps1"
    I still get the "usual" error message.
    Code:
    c:\Install>powershell "%SystemDrive%\install\remove-store-apps.ps1"
    C:\install\remove-store-apps.ps1 : File C:\install\remove-store-apps.ps1 cannot be loaded because running scripts is di
    sabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135
    170.
    At line:1 char:1
    + C:\install\remove-store-apps.ps1
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : SecurityError: (:) [], PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess
    
    c:\Install>
    To run the script the execution policy has to be changed outside the script, in order for it to run.
    Do you have to run a script, for some reason? If not, don't use a script.

    Open PowerShell as administrator.
    Run the command: Get-AppxPackage -allusers | Remove-AppxPackage
      My ComputerSystem Spec

  8.    12 Jun 2018 #8

    Thanks! That worked.
      My ComputerSystem Spec

  9.    12 Jun 2018 #9

    Octopuss said: View Post
    Thanks! That worked.

    You're very welcome!
      My ComputerSystem Spec

  10.    12 Jun 2018 #10

    If after all you need to run your script from a batch file, follow these steps:

    1. Create a file named RemoveStoreApps.bat, and place it wherever you want. It should contain the following line:
    Code:
    %comspec% /k PowerShell.exe -ExecutionPolicy Bypass -file "%SystemDrive%\install\remove-store-apps.ps1"

    2. The "%SystemDrive%\install\remove-store-apps.ps1" script should contain one line:
    Code:
    Get-AppxPackage -allusers | Remove-AppxPackage

    3. To run the batch file, right click on it and select "Run as Administrator."
      My ComputerSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
Is W10 uninstalling apps itself? in Software and Apps
Two versions of CPU-Z and one of GPU-Z have mysteriously disappared from my computer without any trace a couple of weeks ago. Anyone else who have experienced anything similar?
I finally migrated to W10pro today(09.04.16) from 7 just to get this free upgrade offer and I'm trying to get rid of some of the default apps. I did read tutorial on it on here, but I think it's not entirely relevant anymore, I'm guessing it's after...
Uninstalling individual Office 365 apps in Microsoft Office and 365
I got the free trial version of Office and was planning on buying it after my trial is over. However, I'm wondering if there's a way to only install or keep certain programs? I don't use most of them. I have the entire Office suite already...
Hey guys, I am interested in setting up some company-wide commands to remove a lot of the built-in crap from Windows 10. Employees don't need to be using the Xbox app, and we don't need Get Office, Get Skype etc as we already have those...
Uninstalling Windows apps in Software and Apps
Hello guys, how can I uninstall all these apps I don't need? The tutorial Apps - Uninstall in Windows 10 - Windows 10 Forums is not working. As the folder of the app actually remains.
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 07:34.
Find Us