Remove Click-To-Run Office (MS Store version) (and other crap) From New PCs

Tags: , , ,

If you’re a sysadmin, help desk, or anyone that builds new machines for a company that uses anything other than the OEM version of Microsoft Office, you’ve probably noticed that it’s become more difficult to remove the pre-installed (click-to-run) version of Microsoft Office from the machine (and Candy Crush, and Skype, and Zune — I mean really — who still uses a Zune?!)

What’s worse, if you clean it up for the logged in user (manually go in and and right-click > “uninstall” for EACH app), then log in as another user, they’re all back! I mean come one!

At any rate, I’ve been putting together a PowerShell script to make life a little easier, and remove the crap I’ve found on the Dells we order to make the rest of the install process a little smoother.

To run the script, make sure you run PowerShell as Administrator, then just copy and paste the below.

**Please note – some of the packages in this script may not be installed on your system – you may see some red text / errors as it scrolls through the commands. This is ok. Use the commands to get the list of packages and see if there are other packages that you want to remove as well.

# Get the list of Provisioned packages
Get-AppxProvisionedPackage -online | select packagename

# Remove packages that start with the Match string for All Users
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.Office.Desktop") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.Office.OneNote") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.Xbox") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.SkypeApp") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.Zune") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.MicrosoftOffice") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "LinkedInforWindows") {$_ | Remove-AppxProvisionedPackage -AllUsers}}
Get-AppxProvisionedPackage -online | %{if ($_.packagename -match "Microsoft.LinkedInforWindows") {$_ | Remove-AppxProvisionedPackage -AllUsers}}


# Get the list of other packages
get-appxpackage | select name

# Remove packages that start with the Match string for All Users
Get-AppxPackage | %{if ($_.name -match "Fitbit.") {$_ | Remove-AppxPackage -AllUsers}}
Get-AppxPackage | %{if ($_.name -match "king.com") {$_ | Remove-AppxPackage -AllUsers}}
Get-AppxPackage | %{if ($_.name -match "Microsoft.zune") {$_ | Remove-AppxPackage -AllUsers}}
Get-AppxPackage | %{if ($_.name -match "microsoft.skypeapp") {$_ | Remove-AppxPackage -AllUsers}}
Get-AppxPackage | %{if ($_.name -match "NORDCURRENT.COOKINGFEVER") {$_ | Remove-AppxPackage -AllUsers}}

# Unpin EVERYTHING (well, at least almost everything) from the start menu (clean slate)
(New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items()| foreach { ($_).Verbs() | ?{$_.Name.Replace('&', '') -match 'From "Start" UnPin|Unpin from Start'} | %{$_.DoIt()}  }

 

Top