added ' -and $_.NonRemovable -eq "False"' to the Get-AppxPackage code lines to help sort through apps that can't get deleted and just get skipped anyways.
Onedrive fixes and code reuse from GUI moved over to interactive script code.
Removed [CmdletBinding()] and Param() that wasn't being used.
Fixed Write-Output to Write-Host
Added ' -and $_.NonRemovable -eq "False"' to GUI code as well in the DebloatAll function
Write-Output"A folder named OneDriveBackupFiles will be created and will be located on your desktop. All files from your OneDrive location will be located in that folder."
Write-Host"A folder named OneDriveBackupFiles will be created and will be located on your desktop. All files from your OneDrive location will be located in that folder."
#Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys."
Write-Host "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys."
Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
Start-Sleep1
FixWhitelistedApps
Start-Sleep1
Write-Output "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
Write-Host "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
Protect-Privacy
Start-Sleep1
DisableCortana
Write-Output "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
Write-Host "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
Start-Sleep1
Write-Output "Stopping and disabling Diagnostics Tracking Service"
Write-Host "Stopping and disabling Diagnostics Tracking Service"
DisableDiagTrack
Write-Output "Diagnostics Tracking Service disabled"
Write-Host "Diagnostics Tracking Service disabled"
Start-Sleep1
Write-Output "Disabling WAP push service"
Write-Host "Disabling WAP push service"
DisableWAPPush
Start-Sleep1
Write-Output "Re-enabling DMWAppushservice if it was disabled"
Write-Host "Re-enabling DMWAppushservice if it was disabled"
CheckDMWService
Start-Sleep1
Write-Output "Removing 3D Objects from the 'My Computer' submenu in explorer"
Write-Host "Removing 3D Objects from the 'My Computer' submenu in explorer"
Remove3dObjects
Start-Sleep1
}
No{
#Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys."
Write-Host "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys."
Write-Output "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
Start-Sleep1
FixWhitelistedApps
Start-Sleep1
Write-Output "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
Write-Host "Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary."
Protect-Privacy
Start-Sleep1
DisableCortana
Write-Output "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
Write-Host "Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
Start-Sleep1
Write-Output "Stopping and disabling Diagnostics Tracking Service"
Write-Host "Stopping and disabling Diagnostics Tracking Service"
DisableDiagTrack
Write-Output "Diagnostics Tracking Service disabled"
Write-Host "Diagnostics Tracking Service disabled"
Start-Sleep1
Write-Output "Disabling WAP push service"
Write-Host "Disabling WAP push service"
Start-Sleep1
DisableWAPPush
Write-Output "Re-enabling DMWAppushservice if it was disabled"
Write-Host "Re-enabling DMWAppushservice if it was disabled"
CheckDMWService
Start-Sleep1
}
@ -773,10 +750,10 @@ Switch ($Prompt1) {
Switch($Prompt3){
Yes{
Stop-EdgePDF
Write-Output "Edge will no longer take over as the default PDF viewer."
Write-Host "Edge will no longer take over as the default PDF viewer."
}
No{
Write-Output "You chose not to stop Edge from taking over as the default PDF viewer."
Write-Host "You chose not to stop Edge from taking over as the default PDF viewer."
}
}
#Prompt asking to delete OneDrive
@ -784,10 +761,10 @@ Switch ($Prompt1) {
Switch($Prompt4){
Yes{
UninstallOneDrive
Write-Output "OneDrive is now removed from the computer."
Write-Host "OneDrive is now removed from the computer."
}
No{
Write-Output "You have chosen to skip removing OneDrive from your machine."
Write-Host "You have chosen to skip removing OneDrive from your machine."
}
}
#Prompt asking if you'd like to unpin all start items
@ -795,20 +772,20 @@ Switch ($Prompt1) {
Switch($Prompt5){
Yes{
UnpinStart
Write-Output "Start Apps unpined."
Write-Host "Start Apps unpined."
}
No{
Write-Output "You have chosen to skip removing OneDrive from your machine."
Write-Host "You have chosen to skip removing OneDrive from your machine."
Write-Output "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the modification of specific registry keys."
Write-Host "Reverting changes..."
Write-Host "Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the modification of specific registry keys."
#This is the switch parameter for running this script as a 'silent' script, for use in MDT images or any type of mass deployment without user interaction.