Easily Remove Built-In Windows 10 Apps Using PowerShell

Here’s something I like to do after setting up a new Windows 10 machine: remove the 20 or so built-in apps that don’t provide an Uninstall option.

It’s a simple task to accomplish; you can achieve it in 4 quick steps:

  1. Create a new text file and save it with the .ps1 extension
  2. Paste the PowerShell code listed below into that new file
  3. Start a PowerShell session via “Run as Administrator”
  4. Type the full path to your new file at the command line and hit the Enter key

Here’s the PowerShell code you need to paste into your .ps1 file:

Write-Host "Starting to remove bloatware."
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *bingfinance* | Remove-AppxPackage
Get-AppxPackage *bingnews* | Remove-AppxPackage
Get-AppxPackage *bingsports* | Remove-AppxPackage
Get-AppxPackage *bingweather* | Remove-AppxPackage
Get-AppxPackage *communicationsapps* | Remove-AppxPackage
Get-AppxPackage *getstarted* | Remove-AppxPackage
Get-AppxPackage *messaging* | Remove-AppxPackage
Get-AppxPackage *onenote* | Remove-AppxPackage
Get-AppxPackage *phone* | Remove-AppxPackage
Get-AppxPackage *photos* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
Get-AppxPackage *sway* | Remove-AppxPackage
Get-AppxPackage *windowscamera* | Remove-AppxPackage
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Get-AppxPackage *windowsphone* | Remove-AppxPackage
Get-AppxPackage *xboxapp* | Remove-AppxPackage
Get-AppxPackage *zunemusic* | Remove-AppxPackage
Get-AppxPackage *zunevideo* | Remove-AppxPackage
Write-Host "Goodbye, bloat."

Linux: How to Determine Cron-Execution-Time Environment Variable Values

Oftentimes it’s asked how to figure out which environment variables your cron scripts are running against.

The first step in doing so is the figure out exactly which shell cron is using.

/bin/sh is usually symbolically linked to bash on a variety of linux systems. Some Debian-based distros jave /bin/sh linked to dash (you can always run “ls -l /bin” to see such links).

To configure cron’s run-time environment in your shell scripts, add the following environment variables at the top of the cron tab. This will set the shell and $PATH, and it will also email you the output of STDOUT and STDERR as your script is executed.

SHELL=/bin/bash
MAILTO=me@me.com
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin

To go a bit deeper in your investigations, you can have cron execute a Perl script (thanks to Po Petz for the code below). The following prints out your environment variable values. It shows you what is visible to cron at exeecution-time, and helps you figure out whether you need to make any adjustments to the cron environment (such as PATH or any special variables like $HOME or $JAVA_HOME).

#!/usr/bin/env perl
use warnings;
use strict;

my $filename = "$0.out"; # just tack on an ".out" to the name of this script

open my $filehandle, '>', $filename or die "Could not write to ' $filename ' : $!\n";

my $timestamp = scalar(localtime);
print $filehandle "Dumping environment values at $timestamp :\n";

# print out the whole environment
foreach my $key (sort (keys %ENV)) {
    print $filehandle "$key = $ENV{$key}\n";
}