Created
November 28, 2023 10:19
-
-
Save thenikk/a20b0903501be87ddcbf3a37b7e612a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations" | |
$registryName = "DWMFRAMEINTERVAL" | |
$desiredValue = 15 | |
if (Test-Path -Path $registryPath) { | |
$keyValue = Get-ItemProperty -Path $registryPath -Name $registryName -ErrorAction SilentlyContinue | |
if ($keyValue -ne $null -and $keyValue.$registryName -eq $desiredValue) { | |
Write-Output "Registry key '$registryName' exists with value $($keyValue.$registryName)" | |
exit 0 | |
} | |
elseif ($keyValue -ne $null) { | |
Write-Output "Registry key '$registryName' exists but has a different value: $($keyValue.$registryName)" | |
exit 1 | |
} | |
else { | |
Write-Output "Registry key '$registryName' exists but has no value set." | |
exit 1 | |
} | |
} | |
else { | |
Write-Output "Registry key '$registryPath' does not exist." | |
exit 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations" | |
$registryName = "DWMFRAMEINTERVAL" | |
$desiredValue = 15 | |
# Check if the registry path exists, and if not, create it | |
if (-not (Test-Path -Path $registryPath)) { | |
New-Item -Path $registryPath -Force | |
} | |
# Set the registry key value with the desired decimal value (no need to specify type) | |
Set-ItemProperty -Path $registryPath -Name $registryName -Value $desiredValue | |
Write-Output "Registry key '$registryName' has been set to decimal value $desiredValue." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment