Advertisement
Guest User

Rename workstations

a guest
Apr 11th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "This script will rename a remote computer, and it's Active Directory Account"
  2. #update domain and username in script before running
  3. #Will reboot system immediate upon completion. Remove -restart to allow machine to be manually rebooted.
  4. #If script fails - run set-execuitonPolicy unrestricted first.
  5. importsystemmodules
  6. $OldName = read-host "enter the name of the remote computer to RENAME now"
  7. $NewName = read-host "Enter the new computer name now"
  8. Rename-Computer -confirm -NewName $newName -Computername $oldName -domainCredential "DOMAIN\USERNAME" -restart
  9. Set-ExecutionPolicy restricted
  10. #If script fails - in an elevated command prompt or script, run this on Win7/8 hosts - netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable=yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement