瀏覽代碼

Added new function FixWhitelistedApps

I added a new Function called FixWhitelistedApps, which will check to see if any of the Whitelisted Apps were removed, and if so it should re-add them.

I then changed the code in the function Start-Debloat, given to me by Reddit user /u/GavinEke.
Richard Newton 7 年之前
父節點
當前提交
8e4d165041
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. 14 0
      Windows10SilentDebloater.ps1

+ 14 - 0
Windows10SilentDebloater.ps1

@@ -222,12 +222,26 @@ Function Stop-EdgePDF {
         Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ -Verbose
     }
 }
+
+Function FixWhitelistedApps {
+    
+    Param([switch]$Debloat)
+    
+    If(!(Get-AppxPackage -AllUsers | Select Microsoft.Paint3D, Microsoft.WindowsCalculator, Microsoft.WindowsStore, Microsoft.Windows.Photos)) {
+    
+    Get-AppxPackage -allusers Microsoft.Paint3D | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
+    Get-AppxPackage -allusers Microsoft.WindowsCalculator | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
+    Get-AppxPackage -allusers Microsoft.WindowsStore | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
+    Get-AppxPackage -allusers Microsoft.Windows.Photos | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} } }
+}
+
 Write-Output "Initiating Sysprep"
 Begin-SysPrep
 Write-Output "Removing bloatware apps."
 Start-Debloat
 Write-Output "Removing leftover bloatware registry keys."
 Remove-Keys
+Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
 Write-Output "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
 Protect-Privacy
 Write-Output "Stopping Edge from taking over as the default PDF Viewer."