winutil/functions/private/Invoke-WinUtilDarkMode.ps1
Chris Titus a56aeefc7f
Test 2023 7 20 (#917)
* Remove Edge from Start Menu and Desktop (#898)

* Update edgeremoval.bat

* Fix Edge not being deleted from Desktop

* Compile Winutil

* fix yubikey users service

* Compile Winutil

* AJRouter and Kiosk Disable

* Compile Winutil

* TermService enable

This service will hang when applying tweaks. Changing to Auto from Manual

* Compile Winutil

* Fix bug with Telemetry Tweak

services should NOT be tweaked here

* dupe tweak removal

* hibernate off and delete

* Compile Winutil

* Cleaning Windows Update Folder

* Compile Winutil

* GameDVR Fix

* Compile Winutil

* Fixed consistency in variable names and values inside edgeremoval.bat (#902)

* Compile Winutil

* add spdx license

* Compile Winutil

* Updated Dark mode check (#904)

* Compile Winutil

* Update Dark Mode Check

updated the theme check to use the existing function

* Description update

Updated Description

---------

Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com>

* Compile Winutil

* fixes #569

* Compile Winutil

* Added Bing Search toggle plus some support functions (#908)

* Compile Winutil

* Update winget.ps1

* Compile Winutil

* Fix Winget Install

* Compile Winutil

* Update Install-WinUtilWinget.ps1

* Compile Winutil

* Update Install-WinUtilWinget.ps1

* Compile Winutil

* Update Install-WinUtilWinget.ps1

* Compile Winutil

* Winget fixes

* Compile Winutil

---------

Co-authored-by: Antun Nitraj <antnitraj@gmail.com>
Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
Co-authored-by: DeveloperDurp <developerdurp@durp.info>
Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com>
2023-07-27 16:06:41 -05:00

33 lines
1.0 KiB
PowerShell

Function Invoke-WinUtilDarkMode {
<#
.DESCRIPTION
Sets Dark Mode on or off
#>
Param($DarkMoveEnabled)
Try{
if ($DarkMoveEnabled -eq $false){
Write-Host "Enabling Dark Mode"
$DarkMoveValue = 0
}
else {
Write-Host "Disabling Dark Mode"
$DarkMoveValue = 1
}
$Theme = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
Set-ItemProperty -Path $Theme -Name AppsUseLightTheme -Value $DarkMoveValue
Set-ItemProperty -Path $Theme -Name SystemUsesLightTheme -Value $DarkMoveValue
}
Catch [System.Security.SecurityException] {
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
}
Catch [System.Management.Automation.ItemNotFoundException] {
Write-Warning $psitem.Exception.ErrorRecord
}
Catch{
Write-Warning "Unable to set $Name due to unhandled exception"
Write-Warning $psitem.Exception.StackTrace
}
}