mirror of
https://github.com/Sycnex/Windows10Debloater.git
synced 2025-09-24 18:48:42 +02:00
Admin check and GUI prompts
Added an admin check to see if the script is running with admin right, if it isn't then it'll close and reopen with admin right and continue on. Also added a GUI to replace the need for "read-host" to get a response from USER
This commit is contained in:
parent
deaa99c664
commit
4c3dd2003d
@ -1,6 +1,13 @@
|
|||||||
#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
|
#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
|
||||||
#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
|
#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
|
||||||
|
|
||||||
|
#Checks for the script running as admin and if it's not then restarts the script in admin
|
||||||
|
Add-Type -AssemblyName PresentationCore,PresentationFramework
|
||||||
|
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
|
||||||
|
Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
|
||||||
If (Test-Path "C:\Windows10Debloater") {
|
If (Test-Path "C:\Windows10Debloater") {
|
||||||
Write-Output "C:\Windows10Debloater exists. Skipping."
|
Write-Output "C:\Windows10Debloater exists. Skipping."
|
||||||
}
|
}
|
||||||
@ -11,6 +18,10 @@ Else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Start-Transcript -OutputDirectory "C:\Windows10Debloater"
|
Start-Transcript -OutputDirectory "C:\Windows10Debloater"
|
||||||
|
|
||||||
|
#no errors throughout
|
||||||
|
$ErrorActionPreference = 'silentlycontinue'
|
||||||
|
|
||||||
Function Start-Debloat {
|
Function Start-Debloat {
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
@ -20,8 +31,8 @@ Function Start-Debloat {
|
|||||||
#Removes AppxPackages
|
#Removes AppxPackages
|
||||||
#Credit to /u/GavinEke for a modified version of my whitelist code
|
#Credit to /u/GavinEke for a modified version of my whitelist code
|
||||||
[regex]$WhitelistedApps = 'Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI'
|
[regex]$WhitelistedApps = 'Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI'
|
||||||
Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage -ErrorAction SilentlyContinue
|
Get-AppxPackage -AllUsers | Where-Object {$_.Name -NotMatch $WhitelistedApps} | Remove-AppxPackage
|
||||||
Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
|
Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -NotMatch $WhitelistedApps} | Remove-AppxProvisionedPackage -Online
|
||||||
}
|
}
|
||||||
Function Remove-Keys {
|
Function Remove-Keys {
|
||||||
|
|
||||||
@ -67,7 +78,7 @@ Function Remove-Keys {
|
|||||||
#This writes the output of each key it is removing and also removes the keys listed above.
|
#This writes the output of each key it is removing and also removes the keys listed above.
|
||||||
ForEach ($Key in $Keys) {
|
ForEach ($Key in $Keys) {
|
||||||
Write-Output "Removing $Key from registry"
|
Write-Output "Removing $Key from registry"
|
||||||
Remove-Item $Key -Recurse -ErrorAction SilentlyContinue
|
Remove-Item $Key -Recurse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,18 +108,18 @@ Function Protect-Privacy {
|
|||||||
$Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
|
$Period2 = 'HKCU:\Software\Microsoft\Siuf\Rules'
|
||||||
$Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
$Period3 = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
||||||
If (!(Test-Path $Period3)) {
|
If (!(Test-Path $Period3)) {
|
||||||
mkdir $Period1 -ErrorAction SilentlyContinue
|
mkdir $Period1
|
||||||
mkdir $Period2 -ErrorAction SilentlyContinue
|
mkdir $Period2
|
||||||
mkdir $Period3 -ErrorAction SilentlyContinue
|
mkdir $Period3
|
||||||
New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $Period3 -Name PeriodInNanoSeconds -Value 0 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "Adding Registry key to prevent bloatware apps from returning"
|
Write-Output "Adding Registry key to prevent bloatware apps from returning"
|
||||||
#Prevents bloatware applications from returning
|
#Prevents bloatware applications from returning
|
||||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
||||||
If (!(Test-Path $registryPath)) {
|
If (!(Test-Path $registryPath)) {
|
||||||
Mkdir $registryPath -ErrorAction SilentlyContinue
|
Mkdir $registryPath
|
||||||
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
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"
|
||||||
@ -121,7 +132,7 @@ Function Protect-Privacy {
|
|||||||
Write-Output "Disabling live tiles"
|
Write-Output "Disabling live tiles"
|
||||||
$Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
|
$Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
|
||||||
If (!(Test-Path $Live)) {
|
If (!(Test-Path $Live)) {
|
||||||
mkdir $Live -ErrorAction SilentlyContinue
|
mkdir $Live
|
||||||
New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose
|
New-ItemProperty $Live -Name NoTileApplicationNotification -Value 1 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +147,7 @@ Function Protect-Privacy {
|
|||||||
Write-Output "Disabling People icon on Taskbar"
|
Write-Output "Disabling People icon on Taskbar"
|
||||||
$People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
|
$People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
|
||||||
If (!(Test-Path $People)) {
|
If (!(Test-Path $People)) {
|
||||||
mkdir $People -ErrorAction SilentlyContinue
|
mkdir $People
|
||||||
New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose
|
New-ItemProperty $People -Name PeopleBand -Value 0 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,32 +174,32 @@ Function Stop-EdgePDF {
|
|||||||
#Stops edge from taking over as the default .PDF viewer
|
#Stops edge from taking over as the default .PDF viewer
|
||||||
If (!(Get-ItemProperty 'HKCR:\.pdf' -Name NoOpenWith)) {
|
If (!(Get-ItemProperty 'HKCR:\.pdf' -Name NoOpenWith)) {
|
||||||
$NoOpen = 'HKCR:\.pdf'
|
$NoOpen = 'HKCR:\.pdf'
|
||||||
New-ItemProperty $NoOpen -Name NoOpenWith -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $NoOpen -Name NoOpenWith -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
If (!(Get-ItemProperty 'HKCR:\.pdf' -Name NoStaticDefaultVerb)) {
|
If (!(Get-ItemProperty 'HKCR:\.pdf' -Name NoStaticDefaultVerb)) {
|
||||||
$NoStatic = 'HKCR:\.pdf'
|
$NoStatic = 'HKCR:\.pdf'
|
||||||
New-ItemProperty $NoStatic -Name NoStaticDefaultVerb -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $NoStatic -Name NoStaticDefaultVerb -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithProgids' -Name NoOpenWith)) {
|
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithProgids' -Name NoOpenWith)) {
|
||||||
$NoOpen = 'HKCR:\.pdf\OpenWithProgids'
|
$NoOpen = 'HKCR:\.pdf\OpenWithProgids'
|
||||||
New-ItemProperty $NoOpen -Name NoOpenWith -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $NoOpen -Name NoOpenWith -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithProgids' -Name NoStaticDefaultVerb)) {
|
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithProgids' -Name NoStaticDefaultVerb)) {
|
||||||
$NoStatic = 'HKCR:\.pdf\OpenWithProgids'
|
$NoStatic = 'HKCR:\.pdf\OpenWithProgids'
|
||||||
New-ItemProperty $NoStatic -Name NoStaticDefaultVerb -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $NoStatic -Name NoStaticDefaultVerb -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithList' -Name NoOpenWith)) {
|
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithList' -Name NoOpenWith)) {
|
||||||
$NoOpen = 'HKCR:\.pdf\OpenWithList'
|
$NoOpen = 'HKCR:\.pdf\OpenWithList'
|
||||||
New-ItemProperty $NoOpen -Name NoOpenWith -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $NoOpen -Name NoOpenWith -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithList' -Name NoStaticDefaultVerb)) {
|
If (!(Get-ItemProperty 'HKCR:\.pdf\OpenWithList' -Name NoStaticDefaultVerb)) {
|
||||||
$NoStatic = 'HKCR:\.pdf\OpenWithList'
|
$NoStatic = 'HKCR:\.pdf\OpenWithList'
|
||||||
New-ItemProperty $NoStatic -Name NoStaticDefaultVerb -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $NoStatic -Name NoStaticDefaultVerb -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
#Appends an underscore '_' to the Registry key for Edge
|
#Appends an underscore '_' to the Registry key for Edge
|
||||||
@ -197,6 +208,7 @@ Function Stop-EdgePDF {
|
|||||||
Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ -Verbose
|
Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ -Verbose
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Revert-Changes {
|
Function Revert-Changes {
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
@ -206,7 +218,7 @@ Function Revert-Changes {
|
|||||||
#This function will revert the changes you made when running the Start-Debloat function.
|
#This function will revert the changes you made when running the Start-Debloat function.
|
||||||
|
|
||||||
#This line reinstalls all of the bloatware that was removed
|
#This line reinstalls all of the bloatware that was removed
|
||||||
Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"} -ErrorAction SilentlyContinue
|
Get-AppxPackage -AllUsers | ForEach {Add-AppxPackage -Verbose -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
|
||||||
|
|
||||||
Write-Output "Re-enabling key to show advertisement information"
|
Write-Output "Re-enabling key to show advertisement information"
|
||||||
#Tells Windows to enable your advertising information.
|
#Tells Windows to enable your advertising information.
|
||||||
@ -227,7 +239,7 @@ Function Revert-Changes {
|
|||||||
If (!('HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds')) {
|
If (!('HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds')) {
|
||||||
mkdir 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
mkdir 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
||||||
$Period = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
$Period = 'HKCU:\Software\Microsoft\Siuf\Rules\PeriodInNanoSeconds'
|
||||||
New-Item $Period -ErrorAction SilentlyContinue
|
New-Item $Period
|
||||||
Set-ItemProperty -Name PeriodInNanoSeconds -Value 1 -Verbose
|
Set-ItemProperty -Name PeriodInNanoSeconds -Value 1 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +247,8 @@ Function Revert-Changes {
|
|||||||
#Enables bloatware applications
|
#Enables bloatware applications
|
||||||
If ('HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent') {
|
If ('HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent') {
|
||||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
||||||
Mkdir $registryPath -ErrorAction SilentlyContinue
|
Mkdir $registryPath
|
||||||
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 0 -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 0 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
#Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
|
#Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
|
||||||
@ -249,17 +261,17 @@ Function Revert-Changes {
|
|||||||
#Re-enables live tiles
|
#Re-enables live tiles
|
||||||
Write-Output "Enabling live tiles"
|
Write-Output "Enabling live tiles"
|
||||||
If ('HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications') {
|
If ('HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications') {
|
||||||
mkdir 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications' -ErrorAction SilentlyContinue
|
mkdir 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
|
||||||
$Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
|
$Live = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications'
|
||||||
New-ItemProperty $Live -Name NoTileApplicationNotification -Value 0 -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $Live -Name NoTileApplicationNotification -Value 0 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "Changing the 'Cloud Content' registry key value to 1 to allow bloatware apps to reinstall"
|
Write-Output "Changing the 'Cloud Content' registry key value to 1 to allow bloatware apps to reinstall"
|
||||||
#Prevents bloatware applications from returning
|
#Prevents bloatware applications from returning
|
||||||
If ("HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent\") {
|
If ("HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent\") {
|
||||||
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
|
||||||
Mkdir $registryPath -ErrorAction SilentlyContinue
|
Mkdir $registryPath
|
||||||
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $registryPath -Name DisableWindowsConsumerFeatures -Value 1 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
#Re-enables data collection
|
#Re-enables data collection
|
||||||
@ -273,7 +285,7 @@ Function Revert-Changes {
|
|||||||
Write-Output "Enabling People icon on Taskbar"
|
Write-Output "Enabling People icon on Taskbar"
|
||||||
If ('HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People') {
|
If ('HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People') {
|
||||||
$People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
|
$People = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People'
|
||||||
New-ItemProperty $People -Name PeopleBand -Value 1 -Verbose -ErrorAction SilentlyContinue
|
New-ItemProperty $People -Name PeopleBand -Value 1 -Verbose
|
||||||
}
|
}
|
||||||
|
|
||||||
#Re-enables suggestions on start menu
|
#Re-enables suggestions on start menu
|
||||||
@ -285,12 +297,12 @@ Function Revert-Changes {
|
|||||||
|
|
||||||
#Re-enables scheduled tasks that were disabled when running the Debloat switch
|
#Re-enables scheduled tasks that were disabled when running the Debloat switch
|
||||||
Write-Output "Enabling scheduled tasks that were disabled"
|
Write-Output "Enabling scheduled tasks that were disabled"
|
||||||
Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Enable-ScheduledTask -ErrorAction SilentlyContinue
|
Get-ScheduledTask -TaskName XblGameSaveTaskLogon | Enable-ScheduledTask
|
||||||
Get-ScheduledTask -TaskName XblGameSaveTask | Enable-ScheduledTask -ErrorAction SilentlyContinue
|
Get-ScheduledTask -TaskName XblGameSaveTask | Enable-ScheduledTask
|
||||||
Get-ScheduledTask -TaskName Consolidator | Enable-ScheduledTask -ErrorAction SilentlyContinue
|
Get-ScheduledTask -TaskName Consolidator | Enable-ScheduledTask
|
||||||
Get-ScheduledTask -TaskName UsbCeip | Enable-ScheduledTask -ErrorAction SilentlyContinue
|
Get-ScheduledTask -TaskName UsbCeip | Enable-ScheduledTask
|
||||||
Get-ScheduledTask -TaskName DmClient | Enable-ScheduledTask -ErrorAction SilentlyContinue
|
Get-ScheduledTask -TaskName DmClient | Enable-ScheduledTask
|
||||||
Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Enable-ScheduledTask -ErrorAction SilentlyContinue
|
Get-ScheduledTask -TaskName DmClientOnScenarioDownload | Enable-ScheduledTask
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Enable-EdgePDF {
|
Function Enable-EdgePDF {
|
||||||
@ -350,13 +362,21 @@ Function FixWhitelistedApps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Switch statement containing Debloat/Revert options
|
#GUI prompt Debloat/Revert options and GUI variables
|
||||||
Write-Output "The following options will allow you to either Debloat Windows 10, or to revert changes made after Debloating Windows 10.
|
$Button = [Windows.MessageBoxButton]::YesNo
|
||||||
Choose 'Debloat' to Debloat Windows 10 or choose 'Revert' to revert changes made by this script."
|
$ErrorIco = [Windows.MessageBoxImage]::Error
|
||||||
$Readhost = Read-Host " ( Debloat / Revert ) "
|
$Warn = [Windows.MessageBoxImage]::Warning
|
||||||
Switch ($ReadHost) {
|
$Ask = 'The following will allow you to either Debloat Windows 10, or to revert changes made after Debloating Windows 10.
|
||||||
|
Choose "Yes" to Debloat Windows 10
|
||||||
|
Choose "No" to revert changes made by this script.'
|
||||||
|
$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?'
|
||||||
|
$Reboot = 'For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart?'
|
||||||
|
|
||||||
|
$Prompt1 = [Windows.MessageBox]::Show($Ask,'Debloat or Revert',$Button,$ErrorIco)
|
||||||
|
Switch ($Prompt1) {
|
||||||
#This will debloat Windows 10
|
#This will debloat Windows 10
|
||||||
Debloat {
|
Yes {
|
||||||
#Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
|
#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-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 -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
||||||
@ -377,10 +397,9 @@ Switch ($ReadHost) {
|
|||||||
Protect-Privacy
|
Protect-Privacy
|
||||||
Write-Output "Cortana disabled from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
|
Write-Output "Cortana disabled from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled."
|
||||||
Start-Sleep 1; $PublishSettings = $Debloat
|
Start-Sleep 1; $PublishSettings = $Debloat
|
||||||
|
|
||||||
Write-Output "Do you want to stop edge from taking over as the default PDF viewer?"
|
$Prompt2 = [Windows.MessageBox]::Show($EdgePdf,'Edge PDF',$Button,$Warn)
|
||||||
$ReadHost = Read-Host " (Yes / No ) "
|
Switch ($Prompt2) {
|
||||||
Switch ($ReadHost) {
|
|
||||||
Yes {
|
Yes {
|
||||||
Stop-EdgePDF
|
Stop-EdgePDF
|
||||||
Write-Output "Edge will no longer take over as the default PDF viewer."; $PublishSettings = $Yes
|
Write-Output "Edge will no longer take over as the default PDF viewer."; $PublishSettings = $Yes
|
||||||
@ -389,10 +408,9 @@ Switch ($ReadHost) {
|
|||||||
$PublishSettings = $No
|
$PublishSettings = $No
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#Switch statement asking if you'd like to reboot your machine
|
#Prompt asking if you'd like to reboot your machine
|
||||||
Write-Output "For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart?"
|
$Prompt3 = [Windows.MessageBox]::Show($Reboot,'Reboot',$Button,$Warn)
|
||||||
$ReadHost = Read-Host " ( Yes / No ) "
|
Switch ($Prompt3) {
|
||||||
Switch ($Readhost) {
|
|
||||||
Yes {
|
Yes {
|
||||||
Write-Output "Unloading the HKCR drive..."
|
Write-Output "Unloading the HKCR drive..."
|
||||||
Remove-PSDrive HKCR
|
Remove-PSDrive HKCR
|
||||||
@ -413,24 +431,23 @@ Switch ($ReadHost) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Revert {
|
No {
|
||||||
Write-Output "Reverting changes..."
|
Write-Output "Reverting changes..."
|
||||||
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-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."
|
||||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
||||||
Revert-Changes; $PublishSettings = $Revert
|
Revert-Changes; $PublishSettings = $Revert
|
||||||
Write-Output "Do you want to revert changes that disabled Edge as the default PDF viewer?"
|
#Prompt asking to revert edge changes as well
|
||||||
$ReadHost = Read-Host " (Yes / No ) "
|
$Prompt4 = [Windows.MessageBox]::Show($EdgePdf2,'Revert Edge',$Button,$ErrorIco)
|
||||||
Switch ($ReadHost) {
|
Switch ($Prompt4) {
|
||||||
Yes {
|
Yes {
|
||||||
Enable-EdgePDF
|
Enable-EdgePDF
|
||||||
Write-Output "Edge will no longer be disabled from being used as the default Edge PDF viewer."; $PublishSettings = $Yes
|
Write-Output "Edge will no longer be disabled from being used as the default Edge PDF viewer."; $PublishSettings = $Yes
|
||||||
}
|
}
|
||||||
No {$PublishSettings = $No}
|
No {$PublishSettings = $No}
|
||||||
}
|
}
|
||||||
#Switch statement asking if you'd like to reboot your machine
|
#Prompt asking if you'd like to reboot your machine
|
||||||
Write-Output "For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart?"
|
$Prompt5 = [Windows.MessageBox]::Show($Reboot,'Reboot',$Button,$Warn)
|
||||||
$Readhost = Read-Host " ( Yes / No ) "
|
Switch ($Prompt5) {
|
||||||
Switch ($Readhost) {
|
|
||||||
Yes {
|
Yes {
|
||||||
Write-Output "Unloading the HKCR drive..."
|
Write-Output "Unloading the HKCR drive..."
|
||||||
Remove-PSDrive HKCR
|
Remove-PSDrive HKCR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user