@ -11,13 +11,14 @@ Else {
Write-Output " The folder 'C:\Windows10Debloater' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now. "
Write-Output " The folder 'C:\Windows10Debloater' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now. "
Start-Sleep 1
Start-Sleep 1
New-Item -Path " C:\Windows10Debloater " -ItemType Directory
New-Item -Path " C:\Windows10Debloater " -ItemType Directory
Write-Output " The folder C:\Windows10Debloater was successfully created. "
}
}
Start-Transcript -OutputDirectory " C:\Windows10Debloater "
Start-Transcript -OutputDirectory " C:\Windows10Debloater "
Add-Type -AssemblyName PresentationCore , PresentationFramework
Add-Type -AssemblyName PresentationCore , PresentationFramework
Function Start- Debloat {
Function DebloatAllApps {
[ CmdletBinding ( ) ]
[ CmdletBinding ( ) ]
@ -31,6 +32,78 @@ Function Start-Debloat {
Get-AppxProvisionedPackage -Online | Where-Object { $_ . PackageName -NotMatch $WhitelistedApps } | Remove-AppxProvisionedPackage -Online
Get-AppxProvisionedPackage -Online | Where-Object { $_ . PackageName -NotMatch $WhitelistedApps } | Remove-AppxProvisionedPackage -Online
}
}
Function DebloatBlacklist {
[ CmdletBinding ( ) ]
Param ( )
$Bloatware = @ (
#Unnecessary Windows 10 AppX Apps
" Microsoft.BingNews "
" Microsoft.DesktopAppInstaller "
" Microsoft.GetHelp "
" Microsoft.Getstarted "
" Microsoft.Messaging "
" Microsoft.Microsoft3DViewer "
" Microsoft.MicrosoftOfficeHub "
" Microsoft.MicrosoftSolitaireCollection "
" Microsoft.NetworkSpeedTest "
" Microsoft.Office.OneNote "
" Microsoft.Office.Sway "
" Microsoft.OneConnect "
" Microsoft.People "
" Microsoft.Print3D "
" Microsoft.RemoteDesktop "
" Microsoft.SkypeApp "
" Microsoft.StorePurchaseApp "
" Microsoft.WindowsAlarms "
" Microsoft.WindowsCamera "
" microsoft.windowscommunicationsapps "
" Microsoft.WindowsFeedbackHub "
" Microsoft.WindowsMaps "
" Microsoft.WindowsSoundRecorder "
" Microsoft.Xbox.TCUI "
" Microsoft.XboxApp "
" Microsoft.XboxGameOverlay "
" Microsoft.XboxIdentityProvider "
" Microsoft.XboxSpeechToTextOverlay "
" Microsoft.ZuneMusic "
" Microsoft.ZuneVideo "
#Sponsored Windows 10 AppX Apps
#Add sponsored/featured apps to remove in the "*AppName*" format
" *EclipseManager* "
" *ActiproSoftwareLLC* "
" *AdobeSystemsIncorporated.AdobePhotoshopExpress* "
" *Duolingo-LearnLanguagesforFree* "
" *PandoraMediaInc* "
" *CandyCrush* "
" *Wunderlist* "
" *Flipboard* "
" *Twitter* "
" *Facebook* "
" *Spotify* "
" *Minecraft* "
" *Royal Revolt* "
#Optional: Typically not removed but you can if you need to for some reason
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
#"*Microsoft.BingWeather*"
#"*Microsoft.MSPaint*"
#"*Microsoft.MicrosoftStickyNotes*"
#"*Microsoft.Windows.Photos*"
#"*Microsoft.WindowsCalculator*"
#"*Microsoft.WindowsStore*"
)
foreach ( $Bloat in $Bloatware ) {
Get-AppxPackage -Name $App | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $App | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
Write-Output " Trying to remove $Bloat . "
}
}
Function Remove-Keys {
Function Remove-Keys {
[ CmdletBinding ( ) ]
[ CmdletBinding ( ) ]
@ -103,10 +176,10 @@ Function Protect-Privacy {
Write-Output " Disabling Bing Search in Start Menu "
Write-Output " Disabling Bing Search in Start Menu "
$WebSearch = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search "
$WebSearch = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search "
Set-ItemProperty " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search " BingSearchEnabled -Value 0
Set-ItemProperty " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search " BingSearchEnabled -Value 0
If ( ! ( Test-Path $WebSearch ) ) {
If ( ! ( Test-Path $WebSearch ) ) {
New-Item $WebSearch
New-Item $WebSearch
}
}
Set-ItemProperty $WebSearch DisableWebSearch -Value 1
Set-ItemProperty $WebSearch DisableWebSearch -Value 1
#Stops the Windows Feedback Experience from sending anonymous data
#Stops the Windows Feedback Experience from sending anonymous data
Write-Output " Stopping the Windows Feedback Experience program "
Write-Output " Stopping the Windows Feedback Experience program "
@ -128,12 +201,12 @@ Function Protect-Privacy {
If ( ! ( Test-Path $registryOEM ) ) {
If ( ! ( Test-Path $registryOEM ) ) {
New-Item $registryOEM
New-Item $registryOEM
}
}
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
#Preping mixed Reality Portal for removal
#Preping mixed Reality Portal for removal
Write-Output " Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings "
Write-Output " Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings "
@ -148,14 +221,14 @@ Function Protect-Privacy {
$WifiSense2 = " HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots "
$WifiSense2 = " HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots "
$WifiSense3 = " HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config "
$WifiSense3 = " HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config "
If ( ! ( Test-Path $WifiSense1 ) ) {
If ( ! ( Test-Path $WifiSense1 ) ) {
New-Item $WifiSense1
New-Item $WifiSense1
}
}
Set-ItemProperty $WifiSense1 Value -Value 0
Set-ItemProperty $WifiSense1 Value -Value 0
If ( ! ( Test-Path $WifiSense2 ) ) {
If ( ! ( Test-Path $WifiSense2 ) ) {
New-Item $WifiSense2
New-Item $WifiSense2
}
}
Set-ItemProperty $WifiSense2 Value -Value 0
Set-ItemProperty $WifiSense2 Value -Value 0
Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
#Disables live tiles
#Disables live tiles
Write-Output " Disabling live tiles "
Write-Output " Disabling live tiles "
@ -212,54 +285,54 @@ Function Protect-Privacy {
Write-Output " Stopping and disabling WAP Push Service "
Write-Output " Stopping and disabling WAP Push Service "
#Stop and disable WAP Push Service
#Stop and disable WAP Push Service
Stop-Service " dmwappushservice "
Stop-Service " dmwappushservice "
Set-Service " dmwappushservice " -StartupType Disabled
Set-Service " dmwappushservice " -StartupType Disabled
Write-Output " Stopping and disabling Diagnostics Tracking Service "
Write-Output " Stopping and disabling Diagnostics Tracking Service "
#Disabling the Diagnostics Tracking Service
#Disabling the Diagnostics Tracking Service
Stop-Service " DiagTrack "
Stop-Service " DiagTrack "
Set-Service " DiagTrack " -StartupType Disabled
Set-Service " DiagTrack " -StartupType Disabled
}
}
Function DisableCortana {
Function DisableCortana {
Write-Host " Disabling Cortana "
Write-Host " Disabling Cortana "
$Cortana1 = " HKCU:\SOFTWARE\Microsoft\Personalization\Settings "
$Cortana1 = " HKCU:\SOFTWARE\Microsoft\Personalization\Settings "
$Cortana2 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization "
$Cortana2 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization "
$Cortana3 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore "
$Cortana3 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore "
If ( ! ( Test-Path $Cortana1 ) ) {
If ( ! ( Test-Path $Cortana1 ) ) {
New-Item $Cortana1
New-Item $Cortana1
}
}
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
If ( ! ( Test-Path $Cortana2 ) ) {
If ( ! ( Test-Path $Cortana2 ) ) {
New-Item $Cortana2
New-Item $Cortana2
}
}
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
If ( ! ( Test-Path $Cortana3 ) ) {
If ( ! ( Test-Path $Cortana3 ) ) {
New-Item $Cortana3
New-Item $Cortana3
}
}
Set-ItemProperty $Cortana3 HarvestContacts -Value 0
Set-ItemProperty $Cortana3 HarvestContacts -Value 0
}
}
Function EnableCortana {
Function EnableCortana {
Write-Host " Re-enabling Cortana "
Write-Host " Re-enabling Cortana "
$Cortana1 = " HKCU:\SOFTWARE\Microsoft\Personalization\Settings "
$Cortana1 = " HKCU:\SOFTWARE\Microsoft\Personalization\Settings "
$Cortana2 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization "
$Cortana2 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization "
$Cortana3 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore "
$Cortana3 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore "
If ( ! ( Test-Path $Cortana1 ) ) {
If ( ! ( Test-Path $Cortana1 ) ) {
New-Item $Cortana1
New-Item $Cortana1
}
}
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
If ( ! ( Test-Path $Cortana2 ) ) {
If ( ! ( Test-Path $Cortana2 ) ) {
New-Item $Cortana2
New-Item $Cortana2
}
}
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
If ( ! ( Test-Path $Cortana3 ) ) {
If ( ! ( Test-Path $Cortana3 ) ) {
New-Item $Cortana3
New-Item $Cortana3
}
}
Set-ItemProperty $Cortana3 HarvestContacts -Value 1
Set-ItemProperty $Cortana3 HarvestContacts -Value 1
}
}
Function Stop-EdgePDF {
Function Stop-EdgePDF {
@ -386,13 +459,13 @@ Function Revert-Changes {
Write-Output " Re-enabling and starting WAP Push Service "
Write-Output " Re-enabling and starting WAP Push Service "
#Enable and start WAP Push Service
#Enable and start WAP Push Service
Set-Service " dmwappushservice " -StartupType Automatic
Set-Service " dmwappushservice " -StartupType Automatic
Start-Service " dmwappushservice "
Start-Service " dmwappushservice "
Write-Output " Re-enabling and starting the Diagnostics Tracking Service "
Write-Output " Re-enabling and starting the Diagnostics Tracking Service "
#Enabling the Diagnostics Tracking Service
#Enabling the Diagnostics Tracking Service
Set-Service " DiagTrack " -StartupType Automatic
Set-Service " DiagTrack " -StartupType Automatic
Start-Service " DiagTrack "
Start-Service " DiagTrack "
}
}
Function Enable-EdgePDF {
Function Enable-EdgePDF {
@ -451,24 +524,24 @@ Function UninstallOneDrive {
$onedrive = " $env:SYSTEMROOT \SysWOW64\OneDriveSetup.exe "
$onedrive = " $env:SYSTEMROOT \SysWOW64\OneDriveSetup.exe "
$ExplorerReg1 = " HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} "
$ExplorerReg1 = " HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} "
$ExplorerReg2 = " HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} "
$ExplorerReg2 = " HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} "
Stop-Process -Name " OneDrive* "
Stop-Process -Name " OneDrive* "
Start-Sleep 2
Start-Sleep 2
If ( ! ( Test-Path $onedrive ) ) {
If ( ! ( Test-Path $onedrive ) ) {
$onedrive = " $env:SYSTEMROOT \System32\OneDriveSetup.exe "
$onedrive = " $env:SYSTEMROOT \System32\OneDriveSetup.exe "
}
}
Start-Process $onedrive " /uninstall " -NoNewWindow -Wait
Start-Process $onedrive " /uninstall " -NoNewWindow -Wait
Start-Sleep 2
Start-Sleep 2
Write-Output " Stopping explorer "
Write-Output " Stopping explorer "
Start-Sleep 1
Start-Sleep 1
. \ taskkill . exe / F / IM explorer . exe
. \ taskkill . exe / F / IM explorer . exe
Start-Sleep 3
Start-Sleep 3
Write-Output " Removing leftover files "
Write-Output " Removing leftover files "
Remove-Item " $env:USERPROFILE \OneDrive " -Force -Recurse
Remove-Item " $env:USERPROFILE \OneDrive " -Force -Recurse
Remove-Item " $env:LOCALAPPDATA \Microsoft\OneDrive " -Force -Recurse
Remove-Item " $env:LOCALAPPDATA \Microsoft\OneDrive " -Force -Recurse
Remove-Item " $env:PROGRAMDATA \Microsoft OneDrive " -Force -Recurse
Remove-Item " $env:PROGRAMDATA \Microsoft OneDrive " -Force -Recurse
If ( Test-Path " $env:SYSTEMDRIVE \OneDriveTemp " ) {
If ( Test-Path " $env:SYSTEMDRIVE \OneDriveTemp " ) {
Remove-Item " $env:SYSTEMDRIVE \OneDriveTemp " -Force -Recurse
Remove-Item " $env:SYSTEMDRIVE \OneDriveTemp " -Force -Recurse
}
}
Write-Output " Removing OneDrive from windows explorer "
Write-Output " Removing OneDrive from windows explorer "
If ( ! ( Test-Path $ExplorerReg1 ) ) {
If ( ! ( Test-Path $ExplorerReg1 ) ) {
New-Item $ExplorerReg1
New-Item $ExplorerReg1
@ -479,7 +552,7 @@ Function UninstallOneDrive {
}
}
Set-ItemProperty $ExplorerReg2 System . IsPinnedToNameSpaceTree -Value 0
Set-ItemProperty $ExplorerReg2 System . IsPinnedToNameSpaceTree -Value 0
Write-Output " Restarting Explorer that was shut down before. "
Write-Output " Restarting Explorer that was shut down before. "
Start explorer . exe -NoNewWindow
Start -Process explorer . exe -NoNewWindow
}
}
#GUI prompt Debloat/Revert options and GUI variables
#GUI prompt Debloat/Revert options and GUI variables
@ -493,77 +566,116 @@ $Ask = 'The following will allow you to either Debloat Windows 10 or to revert c
Select " No " to Revert changes made by this script
Select " No " to Revert changes made by this script
Select " Cancel " to stop the script . '
Select " Cancel " to stop the script . '
$EverythingorSpecific = " Would you like to remove everything that was preinstalled on your Windows Machine? Select Yes to remove everything, or select No to remove apps via a blacklist. "
$EdgePdf = " Do you want to stop edge from taking over as the default PDF viewer? "
$EdgePdf = " Do you want to stop edge from taking over as the default PDF viewer? "
$EdgePdf2 = " Do you want to revert changes that disabled Edge as the default PDF viewer? "
$EdgePdf2 = " Do you want to revert changes that disabled Edge as the default PDF viewer? "
$Reboot = " For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart? "
$Reboot = " For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart? "
$OneDriveDelete = " Do you want to uninstall One Drive? "
$OneDriveDelete = " Do you want to uninstall One Drive? "
$Prompt1 = [ Windows.MessageBox ] :: Show ( $Ask , " Debloat or Revert " , $Button , $ErrorIco )
$Prompt1 = [ Windows.MessageBox ] :: Show ( $Ask , " Debloat or Revert " , $Button , $ErrorIco )
Switch ( $Prompt1 ) {
Switch ( $Prompt1 ) {
#This will debloat Windows 10
#This will debloat Windows 10
Yes {
Yes {
#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. "
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Start-Sleep 1
Write-Output " Uninstalling bloatware, please wait. The first step is to identify and remove them via a blacklist, and then to use the whitelist approach. "
Start-Debloat
Write-Output " Bloatware removed. "
Start-Sleep 1
Write-Output " Removing specific registry keys. "
Remove-Keys
Write-Output " Leftover bloatware registry keys removed. "
Start-Sleep 1
Write-Output " Checking to see if any Whitelisted Apps were removed, and if so re-adding them. "
Start-Sleep 1
FixWhitelistedApps
Start-Sleep 1
Write-Output " Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary. "
Protect-Privacy
Start-Sleep 1
DisableCortana
Write-Output " Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled. "
Start-Sleep 1
Write-Output " Stopping and disabling Diagnostics Tracking Service "
DisableDiagTrack
Write-Output " Diagnostics Tracking Service disabled "
Start-Sleep 1
Write-Output " Disabling WAP push service "
Start-Sleep 1
DisableWAPPush
Write-Output " WAP push service stopped and disabled "
Start-Sleep 1 ; = $Debloat
$Prompt2 = [ Windows.MessageBox ] :: Show ( $EdgePdf , " Edge PDF " , $Button , $Warn )
$Prompt2 = [ Windows.MessageBox ] :: Show ( $EverythingorSpecific , " Everything or Specific " , $Button , $Warn )
Switch ( $Prompt2 ) {
switch ( $Prompt2 ) {
Yes {
#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. "
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Start-Sleep 1
Write-Output " Uninstalling bloatware, please wait. "
DebloatAllApps
Write-Output " Bloatware removed. "
Start-Sleep 1
Write-Output " Removing specific registry keys. "
Remove-Keys
Write-Output " Leftover bloatware registry keys removed. "
Start-Sleep 1
Write-Output " Checking to see if any Whitelisted Apps were removed, and if so re-adding them. "
Start-Sleep 1
FixWhitelistedApps
Start-Sleep 1
Write-Output " Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary. "
Protect-Privacy
Start-Sleep 1
DisableCortana
Write-Output " Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled. "
Start-Sleep 1
Write-Output " Stopping and disabling Diagnostics Tracking Service "
DisableDiagTrack
Write-Output " Diagnostics Tracking Service disabled "
Start-Sleep 1
Write-Output " Disabling WAP push service "
Start-Sleep 1
DisableWAPPush
Write-Output " WAP push service stopped and disabled "
Start-Sleep 1 ; = $Debloat
}
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. "
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Start-Sleep 1
Write-Output " Uninstalling bloatware, please wait. "
DebloatBlacklist
Write-Output " Bloatware removed. "
Start-Sleep 1
Write-Output " Removing specific registry keys. "
Remove-Keys
Write-Output " Leftover bloatware registry keys removed. "
Start-Sleep 1
Write-Output " Checking to see if any Whitelisted Apps were removed, and if so re-adding them. "
Start-Sleep 1
FixWhitelistedApps
Start-Sleep 1
Write-Output " Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary. "
Protect-Privacy
Start-Sleep 1
DisableCortana
Write-Output " Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled. "
Start-Sleep 1
Write-Output " Stopping and disabling Diagnostics Tracking Service "
DisableDiagTrack
Write-Output " Diagnostics Tracking Service disabled "
Start-Sleep 1
Write-Output " Disabling WAP push service "
Start-Sleep 1
DisableWAPPush
Write-Output " WAP push service stopped and disabled "
Start-Sleep 1 ; = $Debloat
}
}
$Prompt3 = [ Windows.MessageBox ] :: Show ( $EdgePdf , " Edge PDF " , $Button , $Warn )
Switch ( $Prompt3 ) {
Yes {
Yes {
Stop-EdgePDF
Stop-EdgePDF
Write-Output " Edge will no longer take over as the default PDF viewer. " ; = $Yes
Write-Output " Edge will no longer take over as the default PDF viewer. " ; = $Yes
}
}
No {
No {
= $No
= $No
}
}
Cancel {
Cancel {
Exit-PSSession
}
}
}
}
#Prompt asking to delete OneDrive
#Prompt asking to delete OneDrive
$Prompt3 = [ Windows.MessageBox ] :: Show ( $OneDriveDelete , " Delete OneDrive " , $Button , $ErrorIco )
$Prompt 4 = [ Windows.MessageBox ] :: Show ( $OneDriveDelete , " Delete OneDrive " , $Button , $ErrorIco )
Switch ( $Prompt3 ) {
Switch ( $Prompt 4 ) {
Yes {
Yes {
UninstallOneDrive
UninstallOneDrive
Write-Output " OneDrive is now removed from the computer. " ; = $Yes
Write-Output " OneDrive is now removed from the computer. " ; = $Yes
}
}
No {
No {
= $No
= $No
}
}
Cancel {
Cancel {
Exit-PSSession
}
}
}
}
#Prompt asking if you'd like to reboot your machine
#Prompt asking if you'd like to reboot your machine
$Prompt4 = [ Windows.MessageBox ] :: Show ( $Reboot , " Reboot " , $Button , $Warn )
$Prompt 5 = [ Windows.MessageBox ] :: Show ( $Reboot , " Reboot " , $Button , $Warn )
Switch ( $Prompt4 ) {
Switch ( $Prompt 5 ) {
Yes {
Yes {
Write-Output " Unloading the HKCR drive... "
Write-Output " Unloading the HKCR drive... "
Remove-PSDrive HKCR
Remove-PSDrive HKCR
@ -583,7 +695,6 @@ Switch ($Prompt1) {
Exit ; = $No
Exit ; = $No
}
}
Cancel {
Cancel {
Exit-PSSession
}
}
}
}
}
}
@ -593,21 +704,21 @@ Switch ($Prompt1) {
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Revert-Changes ; = $Revert
Revert-Changes ; = $Revert
#Prompt asking to revert edge changes as well
#Prompt asking to revert edge changes as well
$Prompt 5 = [ Windows.MessageBox ] :: Show ( $EdgePdf2 , " Revert Edge " , $Button , $ErrorIco )
$Prompt 6 = [ Windows.MessageBox ] :: Show ( $EdgePdf2 , " Revert Edge " , $Button , $ErrorIco )
Switch ( $Prompt 5 ) {
Switch ( $Prompt 6 ) {
Yes {
Yes {
Enable-EdgePDF
Enable-EdgePDF
Write-Output " Edge will no longer be disabled from being used as the default Edge PDF viewer. " ; = $Yes
Write-Output " Edge will no longer be disabled from being used as the default Edge PDF viewer. " ; = $Yes
}
}
No { = $No
No {
= $No
}
}
Cancel {
Cancel {
Exit-PSSession
}
}
}
}
#Prompt asking if you'd like to reboot your machine
#Prompt asking if you'd like to reboot your machine
$Prompt 6 = [ Windows.MessageBox ] :: Show ( $Reboot , " Reboot " , $Button , $Warn )
$Prompt 7 = [ Windows.MessageBox ] :: Show ( $Reboot , " Reboot " , $Button , $Warn )
Switch ( $Prompt 6 ) {
Switch ( $Prompt 7 ) {
Yes {
Yes {
Write-Output " Unloading the HKCR drive... "
Write-Output " Unloading the HKCR drive... "
Remove-PSDrive HKCR
Remove-PSDrive HKCR
@ -627,11 +738,9 @@ Switch ($Prompt1) {
Exit ; = $No
Exit ; = $No
}
}
Cancel {
Cancel {
Exit-PSSession
}
}
}
}
}
}
Cancel {
Cancel {
Exit-PSSession
}
}
}
}