Kill all running Windows Apps with PowerShell

Kill all running Windows Apps with PowerShell

2 minute read

Are you having some issue(s) with some Windows Apps in Windows 8-10 (as of 10041), well there’s a PowerShell command for that… well multiple piped commands :-).

I ran into an issue with all of my apps freezing, I was running Windows 10 so of course you’ll run into some issue because it’s a beta OS; however, I was able to run a quick line in PowerShell to kill all* the running apps and re-launch all of my apps.

The first thing we need to do is get all the processes running that are in the “windowsapps” directory, that’s where all* of your apps are installed. I’m doing this command ignoring which account is running the app, if you have multiple accounts logged in with apps running and you’re running this as an admin this will catch their apps too. If you don’t know much about PowerShell I would highly recommend it, gives you the flexibility in the command line Windows hasn’t really had before, not as much as Linux, but it’s getting better.

get-process | where {$_.path -like “windowsapps”}

That command will display all running processes in the "windowsapps" directory, this will include any folder with that name, so you could try
 get-process | where {$_.path -like "c:\*windowsapps*"}
 to specify the drive you want.

If you want to close all the apps listed you can then pipe that through to the Stop-Process command.

get-process | where {$_.path -like "*windowsapps*"} | Stop-Process

But wait Martino, what if I want to kill all of the apps, except my GameStream or my Xbox app?? Well, there's something we can do there too, we can pipe that to for each and exclude those!

get-process | where {$_.path -like "c:\*windowsapps*"} | where {$_.processname -notlike "*stream*"} | Stop-Process

Well, what if I don't want to kill either app... in the same one line??? Well just send that through another "where-object" command... if you have a list of processes you would like to exclude this wouldn't scale, I would just do a for each and do an if statement on an array of names; however, this is just two names so it doesn't matter:

get-process | where {$_.path -like "c:\*windowsapps*"} | where {$_.processname -notlike "*stream*"} | where {$_.processname -notlike "*xbox*"} | Stop-Process

So if you remember earlier I mentioned not killing the music app, well this wouldn't kill the music app... this will only kill apps that are in the "windowsapps" folder... that app is the only app I've seen that isn't in that folder. But I know what that apps is actually called: "C:\WINDOWS\system32\wwahost.exe" -ServerName:Microsoft.ZuneMusic.wwa, so you'd have to kill that process.