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.
This commit is contained in:
Richard Newton 2018-02-19 07:53:37 -08:00 committed by GitHub
parent afa87e6947
commit 8e4d165041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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."