Skip to content

Instantly share code, notes, and snippets.

@mattchenderson
Last active May 12, 2020 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattchenderson/44815f2362b447aab39a7875dd27fd35 to your computer and use it in GitHub Desktop.
Save mattchenderson/44815f2362b447aab39a7875dd27fd35 to your computer and use it in GitHub Desktop.
PowerShell script for toggling the clock in the windows taskbar (needs to be run as administrator)
param (
[switch]$Revert
)
if ($Revert) {
# presence of the key will disable the ability to control this using the Settings app
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name HideClock
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name HideClock
}
else {
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name HideClock -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name HideClock -Value 1
}
Stop-Process -Name "explorer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment