none
Remove Appx before they are fully installed (Candy Crush) RRS feed

  • Question

  • Hello Scripting Community,

    I need some help.  I am currenlty automating some processes to make a Build environment more sutiable to a company.

    I will start by saying that the company I work for, at this point in time, has said no to Volume licensing (eliminating imaging options) and will not invest in other solutions like Intune.    OS is Windows 10 OEM

    The following is the script i use to remove some of the Microsoft Applciations that we do not want.

    Clean-MSApps {Get-AppxProvisionedPackage -Online | Where {$_.DisplayName -notmatch "Microsoft.MicrosoftStickyNotes" -And 
    $_.DisplayName -notmatch "Microsoft.MSPaint" -And
    $_.DisplayName -notmatch "Microsoft.People" -And
    $_.DisplayName -notmatch "Microsoft.ScreenSketch" -And
    $_.DisplayName -notmatch "Microsoft.WindowsAlarms" -And
    $_.DisplayName -notmatch "Microsoft.Microsoft3DViewer" -And
    $_.DisplayName -notmatch "Microsoft.WindowsCamera" -And
    $_.DisplayName -notmatch "Microsoft.WindowsSoundRecorder" -And
    $_.DisplayName -notmatch "Microsoft.Windows.Photos" -And
    $_.DisplayName -notmatch "Microsoft.WindowsCalculator" -And
    $_.DisplayName -notmatch "Microsoft.BingWeather" -And 
    $_.DisplayName -notmatch "Microsoft.WindowsMaps"} | Remove-AppxProvisionedPackage -Online

    Get-AppxPackage -Allusers | Where {$_.Name -notmatch "Microsoft.WindowsMaps" -And
    $_.Name -notmatch "Microsoft.MSPaint" -And
    $_.Name -notmatch "Microsoft.Windows.Photos" -And
    $_.Name -notmatch "Microsoft.WindowsCalculator" -And
    $_.Name -notmatch "Microsoft.MicrosoftStickyNotes" -And
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.1.3" -and                    
    $_.Name -notmatch "Microsoft.VCLibs.140.00" -and                                            
    $_.Name -notmatch "Microsoft.VCLibs.120.00" -and                                                                                       
    $_.Name -notmatch "Microsoft.NET.Native.Framework.1.6" -and                               
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.1.6" -and                        
    $_.Name -notmatch "Microsoft.VCLibs.120.00.Universal" -and             
    $_.Name -notmatch "Microsoft.VCLibs.140.00" -and                                           
    $_.Name -notmatch "Microsoft.RemoteDesktop" -and                        
    $_.Name -notmatch "Microsoft.BingWeather" -and                          
    $_.Name -notmatch "Microsoft.NET.Native.Framework.2.1" -and                         
    $_.Name -notmatch "Microsoft.Microsoft3DViewer" -and                               
    $_.Name -notmatch "Microsoft.VCLibs.140.00.UWPDesktop" -and             
    $_.Name -notmatch "Microsoft.ScreenSketch" -and                                
    $_.Name -notmatch "Microsoft.NET.Native.Framework.2.0" -and             
    $_.Name -notmatch "Microsoft.WindowsSoundRecorder" -and                 
    $_.Name -notmatch "Microsoft.WindowsAlarms" -and                        
    $_.Name -notmatch "Microsoft.People" -and                               
    $_.Name -notmatch "Microsoft.WindowsCamera" -and                        
    $_.Name -notmatch "Microsoft.VCLibs.140.00.UWPDesktop" -and                         
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.2.1" -and               
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.1.4" -and
    $_.Name -notmatch "Microsoft.NET.Native.Framework.1.3" -and
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.1.7" -and
    $_.Name -notmatch "Microsoft.NET.Native.Framework.1.7" -and
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.2.0" -and
    $_.Name -notmatch "Microsoft.MicrosoftEdge" -and
    $_.Name -notmatch "Microsoft.NET.Native.Framework.2.2" -and
    $_.Name -notmatch "Microsoft.NET.Native.Runtime.2.2"} | Select Name

    Now to the problem.  When I run this, even if i put sleep timers in to allow for apps to install fullly before removing them,  Candy Crush seems to hang around until i click on them,  let them install then run the script again.

    I have also tried this

    Get-AppxPackage -Allusers | where {$_.name -eq "king.com.CandyCrushFriends"} | Remove-AppxPackage
    Get-AppxPackage -Allusers | where {$_.name -eq "King.com.CandyCrushSaga"} | Remove-AppxPackage

    Is there a way to get powershell to open these applicaitons?  Or strip them before they install?

       

    Tuesday, July 9, 2019 10:33 PM