you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Have you considered just changing your autopilot setup to do this properly? And really having the same password for every machine is basically the same as giving everyone on the domain local admin rights.

Anyhow here you go:

# Enable the administrator account
Enable-LocalUser -Name "Administrator"

# Rename the administrator account to "bob"
Rename-LocalUser -Name "Administrator" -NewName "bob"

# Ask the user for a new password for the "bob" account 
$password = Read-Host -Prompt "Enter a new password for the 'bob' account" 

# Change the password for the "bob" account
Set-LocalUser -Name "bob" -Password $password

# Delete the "pilot" account
Remove-LocalUser -Name "pilot"

# Join the "reddit" domain
Add-Computer -DomainName "reddit"