Customise OS with PowerShell script to remove ALL Apps.

Page 1 of 3 123 LastLast
  1. Paul Black's Avatar
    Posts : 12,578
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #1

    Customise OS with PowerShell script to remove ALL Apps.


    I have been playing around with customising an Win 10 Pro ISO for installation. I basically want to get rid of pretty much ALL the Apps besides about three.

    For customisation, I have tried out WinReducer, MSMG, and WinToolkit, all of which allowed various levels of customisation with respect to what is included in their software. Removing Components, Features, Appearance, Unattend etc, is pretty much OK in all of them!

    After installing each of the above, I tried out the Windows10Debloater.ps1, Classic Shell, O&O ShutUp10, and Ultimate Windows Tweaker, again, all with varying results, although a combination of these does seem to give me the required results, well almost!

    Anyway, back to my question.

    Using the customisation software, there were problems with the installed system with regards to things not working correctly. Obviously this would be a nightmare to try and resolve them, so I thought that maybe I could install and untouched ISO and then DELETE the Apps using a PowerShell script [and then customise for security etc].

    To do this by individual Apps I came up with this . . .
    Code:
    $Applist = Get-AppXProvisionedPackage -Online
    
    $Applist | Where-Object {$_.PackageName -Like "*CloudExperienceHost*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*3D*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*AdvertisingXaml*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Alarms*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*AppConnector*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*AppInstaller*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*BingWeather*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Calculator*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Camera*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*ContentDeliveryManager*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Cortana*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*DesktopAppInstaller*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Edge*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Feedback*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*GetHelp*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Getstarted*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Holographic*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*InputApp*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Maps*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Messaging*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*MixedReality*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*MSPaint*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*NarratorQuickStart*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*OfficeHub*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*OfficeOneNote*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*OneConnect*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*ParentalControls*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*People*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Phone*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Photo*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*ScreenSketch*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*SkypeApp*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*SolitaireCollection*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*SoundRecorder*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*StickyNotes*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Store*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Sway*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Wallet*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*WindowsCommunicationsApps*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Xbox*"} | Remove-AppxProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -Like "*Zune*"} | Remove-AppxProvisionedPackage -Online

    I thought I would write a script that does them ALL at once and just leaves the ones I want. Therefore I came up with this . . .
    Code:
    $Applist = Get-AppXProvisionedPackage -Online
    
    $Applist | Where-Object {$_.PackageName -NotLike "*Alarms*"} | Where-Object {$_.PackageName -NotLike "*MSPaint*"} | Where-Object {$_.PackageName -NotLike "*Photo*"} | Remove-AppxProvisionedPackage -Online

    I should mention that I ran . . .
    Code:
    Set-ExecutionPolicy Unrestricted
    . . . initially to give me full access rights.

    The script runs but doesn't seem to do anything because when I click the Apps they still open. I did restart after the script had completed.

    Has anyone got any ideas please?

    Thanks in advance.
      My Computer

  2. Superfly's Avatar
    Posts : 3,337
       #2

    You would need to specify each package - Try this

    Code:
    $Applist = Get-AppXProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -NotLike "*Alarms*" -and $_.PackageName -NotLike "*MSPaint*" -and $_.PackageName -NotLike "*Photo*"} | ForEach-Object {$_.PackageName} | Remove-AppxProvisionedPackage -Online
      My Computer

  3. Paul Black's Avatar
    Posts : 12,578
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #3

    Thanks for the reply Superfly, it is appreciated!

    Superfly said:
    You would need to specify each package - Try this
    Code:
    $Applist = Get-AppXProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -NotLike "*Alarms*" -and $_.PackageName -NotLike "*MSPaint*" -and $_.PackageName -NotLike "*Photo*"} | ForEach-Object {$_.PackageName} | Remove-AppxProvisionedPackage -Online
    I will try it later.
      My Computer

  4. Superfly's Avatar
    Posts : 3,337
       #4

    Paul Black said:
    Thanks for the reply Superfly, it is appreciated!


    I will try it later.
    No prob. I think this is a better way...

    Code:
    $Applist = Get-AppXProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -NotLike "*Alarms*" -and $_.PackageName -NotLike "*MSPaint*" -and $_.PackageName -NotLike "*Photo*"} | ForEach-Object {Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName }
      My Computer

  5. Paul Black's Avatar
    Posts : 12,578
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #5

    Superfly said:
    No prob. I think this is a better way...
    Code:
    $Applist = Get-AppXProvisionedPackage -Online
    $Applist | Where-Object {$_.PackageName -NotLike "*Alarms*" -and $_.PackageName -NotLike "*MSPaint*" -and $_.PackageName -NotLike "*Photo*"} | ForEach-Object {Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName }
    Thank you!
      My Computer

  6. Paul Black's Avatar
    Posts : 12,578
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #6

    Well, unfortunately that didn't work!

    I even tried [in PowerShell as Administrator] . . .
    Code:
    Get-AppxPackage *3D* | Remove-AppxPackage
    . . . as a test, and that didn't work. When I clicked 3D Paint it loaded as normal [yes, I did restart].

    Update . . .

    I booted into the Administrator account and it seems to have worked, but it hasn't pulled through to my User Account!
    Last edited by Paul Black; 04 Feb 2020 at 06:45.
      My Computer

  7. Superfly's Avatar
    Posts : 3,337
       #7

    It depends which set of packages you want to remove AppXProvisionedPackage is different to AppxPackage - so the commands will differ
      My Computer

  8. Paul Black's Avatar
    Posts : 12,578
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #8

    Thanks for sticking with me on this!

    Superfly said:
    It depends which set of packages you want to remove AppXProvisionedPackage is different to AppxPackage - so the commands will differ
    I will investigate the differences!

    I basically just want to DELETE them from both the Administrator account and the User account.

    Thanks in advance.
      My Computer


  9. Posts : 1,494
       #9

    Hey PaulB and SuperFly! Good to see youse guys in here! PaulB, if you have some favorite Powershell scripts to share, throw 'em up into my W10 sandbox!
      My Computer

  10. Paul Black's Avatar
    Posts : 12,578
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #10

    Hello Roland,
    RolandJS said:
    Hey PaulB and SuperFly! Good to see youse guys in here! PaulB, if you have some favorite Powershell scripts to share, throw 'em up into my W10 sandbox!
    I think most of my .bat scripts in SevenForums would probably work here in TenForums. I know for a fact that the Clear Event Viewer Logs and the Extended Disk Cleanup work in Win 10!
      My Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 04:22.
Find Us




Windows 10 Forums