Jump to content

Recommended Posts

Posted

Hi guys, nearly finished my Win10/Server 2016 setup but now i'm looking at the built in apps. Whats the best method for getting rid of them, or just blocking them? I'm ok with them being present in the image just as long as they can't run. Any ideas?

 

Many thanks

Patrick

Posted
Hi, thanks for the reply. I tried that method but had no luck, when the user searches for the xbox app for example they can still run it.
Posted

D-d-double post.

 

Ok, so i have some PS code to run a logon to remove the apps, if i run the script manually it works, but i can't get the script to run from group policy as a login script. No errors, it just doesn't work.

 

 

$AppsList = "Microsoft.3DBuilder", "Microsoft.BingWeather", "Microsoft.XboxApp", "Microsoft.SkypeApp", "Microsoft.ZuneVideo" ForEach ($App in $AppsList){ $PackageFullName = (Get-AppxPackage $App).PackageFullName If ($PackageFullName) { Write-Host "Removing Package: $App" Remove-AppxPackage -Package $PackageFullName } }

 

Any ideas?

Posted (edited)

I had issues with getting these removed via login.

 

I opted to push out a Scheduled Task via Group Policy Preferences to which runs a PowerShell scripts are Startup and (and at a regular interval daily) to which runs Remove-AppXProvisionedPackage for the Apps we're certain we don't want/need.

Running Remove-AppXPackage simply removes it from a single user where Remove-AppXProvisionedPackage removes it from the machine and therefore will never apply to the user.

 

PowerShell

# Script to remove unwanted AppX UWP applications

# Global Variables
$LogFile = "C:\Windows\Logs\Remove-UnwatedAppXProvisionedPackages.log"
$AppxToRemove = 'Microsoft.3DBuilder','Microsoft.BingWeather','Microsoft.DesktopAppInstaller','Microsoft.Getstarted','Microsoft.Messaging','Microsoft.MicrosoftOfficeHub','Microsoft.MicrosoftSolitaireCollection','Microsoft.OneConnect','Microsoft.People','Microsoft.WindowsAlarms','Microsoft.windowscommunicationsapps','Microsoft.WindowsFeedbackHub','Microsoft.WindowsMaps','Microsoft.XboxApp','Microsoft.XboxIdentityProvider','Microsoft.ZuneMusic','Microsoft.ZuneVideo'
$AppxList = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -In $AppxToRemove }

# Main script block
function Main
{
   if ($AppxList.Count -gt 0)
   {
       ForEach ($App in $AppxList) {
           try {
               Log "$(Get-Date): Removing $($App.DisplayName)"
               Remove-AppxProvisionedPackage -PackageName $App.PackageName -Online -ErrorAction Stop
           }
           catch [system.Exception] {
               Log "$(Get-Date): $($_.Exception.Message)"
           }
       }
   }
}

function Log($string)
{
  $string | Out-File -Filepath $LogFile -Append
}

Main

 

Task Scheduler XML (runs as System)



 
   DOMAIN\Administrator
   \Remove Unwanted Provisioned AppX Packages
 
 
   
     true
   
   
     
       PT1H
       PT12H
       false
     
     2017-08-04T06:00:00
     true
     
       1
     
   
 
 
   
     S-1-5-18
     LeastPrivilege
   
 
 
   IgnoreNew
   false
   false
   true
   false
   false
   
     PT10M
     PT1H
     true
     false
   
   true
   true
   false
   false
   false
   PT1H
   7
 
 
   
     powershell.exe
     -ExecutionPolicy Bypass "\\domain\NETLOGON\Configuration\Remove-UnwantedAppXProvisionedPackages.ps1"
   
 

 

Once this runs, this leaves a .log file behind which I can then pickup using our Inventory tools to check which machines still need to run the script.

 

08/07/2017 08:55:34: Removing Microsoft.People
08/07/2017 08:55:46: Removing Microsoft.WindowsAlarms
08/07/2017 08:56:03: Removing microsoft.windowscommunicationsapps
08/07/2017 09:06:56: Removing Microsoft.WindowsFeedbackHub
08/07/2017 09:07:17: Removing Microsoft.WindowsMaps
08/07/2017 09:07:42: Removing Microsoft.XboxApp
08/07/2017 09:07:54: Removing Microsoft.XboxIdentityProvider
08/07/2017 09:07:58: Removing Microsoft.ZuneMusic
08/07/2017 09:08:08: Removing Microsoft.ZuneVideo
08/07/2017 09:22:32: Removing Microsoft.BingWeather

 

If we ever decide to remove more apps in the future (or if a future build includes newer ones we want to remove) we just need to update one line in the PowerShell script and let me machines look after themselves.

 

As none of our users have logged in yet, none of their local profiles have these Apps included. I plan to have a Remove-AppXPackage version of this just incase something slips through the net (unlikey though).

Edited by Arcolite
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...