param ( [Parameter(Mandatory=$true)][int]$daySegment2, # 0 = Day, 1 = Night [Parameter(Mandatory=$true)][int]$daySegment4, # -1 = N/A, 0 = Sunrise, 1 = Day, 2 = Sunset, 3 = Night [Parameter(Mandatory=$true)][bool]$nightMode, # True if night mode is enabled [Parameter(Mandatory=$false)][string]$imagePath # Path to current wallpaper image ) $registryPath = "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main" $dwordValue = If ($nightMode) {1} Else {$daySegment2} if ( Test-Path $registryPath ) { New-ItemProperty -Path $registryPath -Name "Theme" -Value $dwordValue -PropertyType DWORD -Force | Out-Null }