Skip to content

Instantly share code, notes, and snippets.

@PCfromDC
Created January 23, 2018 20:50
Show Gist options
  • Save PCfromDC/64fed976bc482cc844fe396e67625783 to your computer and use it in GitHub Desktop.
Save PCfromDC/64fed976bc482cc844fe396e67625783 to your computer and use it in GitHub Desktop.
Update Registry Computername with all CAPS
$path1 = "HKLM:\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName"
$path2 = "HKLM:\SYSTEM\ControlSet001\Control\ComputerName\ComputerName"
$path3 = "HKLM:\SYSTEM\ControlSet002\Control\ComputerName\ComputerName"
$paths = @($path1,$path2,$path3)
foreach ($path in $paths) {
Set-ItemProperty -Path $path -Name ComputerName -Value $env:COMPUTERNAME.ToUpper()
(Get-ItemProperty -Path $path -Name ComputerName).ComputerName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment