mirror of
https://github.com/Sycnex/Windows10Debloater.git
synced 2024-11-15 12:13:13 +00:00
Added Dark Mode button(s) to the GUI
Also added a small countdown to the admin check
This commit is contained in:
parent
2c587f3fb4
commit
83fd597a00
@ -4,7 +4,13 @@
|
||||
#This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly.
|
||||
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
|
||||
Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
|
||||
Start-Sleep 2
|
||||
Start-Sleep 1
|
||||
Write-Host " 3"
|
||||
Start-Sleep 1
|
||||
Write-Host " 2"
|
||||
Start-Sleep 1
|
||||
Write-Host " 1"
|
||||
Start-Sleep 1
|
||||
Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
|
||||
Exit
|
||||
}
|
||||
@ -17,7 +23,7 @@ If (Test-Path $DebloatFolder) {
|
||||
Write-Output "$DebloatFolder exists. Skipping."
|
||||
}
|
||||
Else {
|
||||
Write-Output "The folder "$DebloatFolder" doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
|
||||
Write-Output "The folder '$DebloatFolder' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
|
||||
Start-Sleep 1
|
||||
New-Item -Path "$DebloatFolder" -ItemType Directory
|
||||
Write-Output "The folder $DebloatFolder was successfully created."
|
||||
|
@ -1,7 +1,13 @@
|
||||
#This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly.
|
||||
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
|
||||
Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
|
||||
Start-Sleep 2
|
||||
Start-Sleep 1
|
||||
Write-Host " 3"
|
||||
Start-Sleep 1
|
||||
Write-Host " 2"
|
||||
Start-Sleep 1
|
||||
Write-Host " 1"
|
||||
Start-Sleep 1
|
||||
Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
|
||||
Exit
|
||||
}
|
||||
@ -138,8 +144,23 @@ $InstallNet35.height = 39
|
||||
$InstallNet35.location = New-Object System.Drawing.Point(9, 387)
|
||||
$InstallNet35.Font = 'Microsoft Sans Serif,10'
|
||||
|
||||
$EnableDarkMode = New-Object system.Windows.Forms.Button
|
||||
$EnableDarkMode.text = "Enable Dark Mode"
|
||||
$EnableDarkMode.width = 152
|
||||
$EnableDarkMode.height = 39
|
||||
$EnableDarkMode.location = New-Object System.Drawing.Point(9, 435)
|
||||
$EnableDarkMode.Font = 'Microsoft Sans Serif,10'
|
||||
|
||||
$Form.controls.AddRange(@($Debloat, $RemoveAllBloatware, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $UnpinStartMenuTiles, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist, $InstallNet35))
|
||||
$DisableDarkMode = New-Object system.Windows.Forms.Button
|
||||
$DisableDarkMode.text = "Disable Dark Mode"
|
||||
$DisableDarkMode.width = 152
|
||||
$DisableDarkMode.height = 39
|
||||
$DisableDarkMode.location = New-Object System.Drawing.Point(169, 435)
|
||||
$DisableDarkMode.Font = 'Microsoft Sans Serif,10'
|
||||
|
||||
|
||||
|
||||
$Form.controls.AddRange(@($Debloat, $RemoveAllBloatware, $RemoveBlacklist, $Label1, $RevertChange, $Label2, $DisableCortana, $EnableCortana, $StopEdgePDFTakeover, $EnableEdgePDFTakeover, $DisableTelemetry, $RemoveRegkeys, $UnpinStartMenuTiles, $RemoveOnedrive, $FixWhitelist, $RemoveBloatNoBlacklist, $InstallNet35, $EnableDarkMode, $DisableDarkMode))
|
||||
|
||||
$DebloatFolder = "C:\Temp\Windows10Debloater"
|
||||
If (Test-Path $DebloatFolder) {
|
||||
@ -1298,4 +1319,22 @@ $InstallNet35.Add_Click( {
|
||||
Write-Host ".NET 3.5 has been successfully installed!"
|
||||
} )
|
||||
|
||||
$EnableDarkMode.Add_Click( {
|
||||
Write-Host "Enabling Dark Mode"
|
||||
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||
Set-ItemProperty $Theme AppsUseLightTheme -Value 0
|
||||
Start-Sleep 1
|
||||
Write-Host "Enabled"
|
||||
}
|
||||
)
|
||||
|
||||
$DisableDarkMode.Add_Click( {
|
||||
Write-Host "Disabling Dark Mode"
|
||||
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||
Set-ItemProperty $Theme AppsUseLightTheme -Value 1
|
||||
Start-Sleep 1
|
||||
Write-Host "Disabled"
|
||||
}
|
||||
)
|
||||
|
||||
[void]$Form.ShowDialog()
|
||||
|
Loading…
Reference in New Issue
Block a user