Last active
August 23, 2023 20:19
-
-
Save Jonathan727/cda70d8f71bb3c9962bb43447c950a86 to your computer and use it in GitHub Desktop.
Customize New Windows Install
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
function Get-CurrentRegistryValue ($path, $name) { | |
$value = Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue | |
if ($value -ne $null) { | |
Write-Host "Current value of '$name': $($value.$name)" | |
} else { | |
Write-Host "The registry entry '$name' does not currently exist." | |
} | |
} | |
function Confirm-Change ($settingName, $path, $name, $value) { | |
Get-CurrentRegistryValue -path $path -name $name | |
if ($null -eq $value) { | |
$confirmation = Read-Host "Do you want to set $settingName? (Y/N, default: Y)" | |
return $confirmation | |
} | |
Write-Host "Proposed setting '$name': '$value'" | |
$confirmation = Read-Host "Do you want to set $($settingName)? (Y/N, default: Y)" | |
if ($confirmation -eq "Y" -or $confirmation -eq "y" -or $confirmation -eq "") { | |
Set-ItemProperty -Path $path -Name $name -Value $value -ErrorAction SilentlyContinue | |
} | |
} | |
# Enable showing file extensions | |
Confirm-Change "show file extensions" "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "HideFileExt" 0 | |
# Show hidden files and folders | |
Confirm-Change "showing hidden files and folders" "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "Hidden" 1 | |
# Hide the search bar in the taskbar | |
Confirm-Change "hiding the search bar in the taskbar" "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" "SearchboxTaskbarMode" 0 | |
# Expand navigation pane to open folder | |
Confirm-Change "Expand navigation pane to open folder" "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "NavPaneExpandToCurrentFolder" 1 | |
# Prevent taskbar icons from being combined | |
Confirm-Change "preventing taskbar icons from being combined" "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "TaskbarGlomLevel" 2 | |
# Set short date format to yyyy-mm-dd | |
Confirm-Change "setting short date format to yyyy-MM-dd" "HKCU:\Control Panel\International" "sShortDate" "yyyy-MM-dd" | |
# Set time format to 24hr | |
Confirm-Change "setting short time format to 24-hour" "HKCU:\Control Panel\International" "sShortTime" "H:mm" | |
Confirm-Change "setting time format to 24-hour" "HKCU:\Control Panel\International" "sTimeFormat" "H:mm:ss" | |
# Ask if the user wants to refresh the Explorer shell | |
$refreshExplorer = Read-Host "Do you want to refresh the Explorer shell? (Y/N, default: Y)" | |
if ($refreshExplorer -eq "Y" -or $refreshExplorer -eq "y" -or $refreshExplorer -eq "") { | |
Stop-Process -Name "explorer" -Force | |
Start-Process -Name "explorer" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment