Created
January 23, 2018 20:50
-
-
Save PCfromDC/64fed976bc482cc844fe396e67625783 to your computer and use it in GitHub Desktop.
Update Registry Computername with all CAPS
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
$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