Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewbbrown/235611939e5051595a04fb7ec178ff1c to your computer and use it in GitHub Desktop.
Save andrewbbrown/235611939e5051595a04fb7ec178ff1c to your computer and use it in GitHub Desktop.
Boxstarter-Win-RenameComputer-DC1.ps1
try {
# Boxstarter options
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false # Is this a machine with no logon password?
$Boxstarter.AutoLogin=$true
Write-BoxstarterMessage "Ensuring Computer name is correct..."
$ServerName = "DC1"
$HostName = $($env:computername).ToUpper()
if ($HostName -ne $ServerName) { Rename-Computer -NewName $ServerName -restart }
Write-BoxstarterMessage "Computer renaming module complete..."
}
catch {
Write-ChocolateyFailure 'Boxstarter Error: ' $($_.Exception.Message)
throw
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment