Jump to content

Rename domain computer


Recommended Posts

Hi , i m new 2 AutoIT & programming too. I have a scenario in which i want 2 rename few computers in my domain network. B4 we were using netdom 2 perform this task. Now, i want integrate netdom with autoit, to automate & make easier my task. I have created a sample script, which prompts me Current computer name & possible new computer name.

;; Script to Rename Domain computer

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#include <Process.au3>

$Currentname = InputBox("Change computer name","enter old name","")

$NewName = InputBox("Change computer name","Enter NEw Name","")

_RunDOS("netdom renamecomputer" & $Currentname & "/NewName:" & $NewName & "/ud:wsusad\administrator /PasswordD:user@123 /Force /REBoot:10")

;; End of Script

Now, when i run this script. Input box prompts me to enter "$Currentname" & "$NewName".But after this "_RunDos" not working. I m sure there is problem with almost script, Plz guide to make this script working.

Link to comment
Share on other sites

  • Developers

Think you are missing some spaces in your commandline, try:

Run(@ComSpec & " /c netdom renamecomputer " & $Currentname & " /NewName:" & $NewName & " /ud:wsusad\administrator /PasswordD:user@123 /Force /REBoot:10")

You can change /c to /k to keep your commandline open while debuging or capture the stdout with AutoIt3. (See helpfile for examples)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Think you are missing some spaces in your commandline, try:

Run(@ComSpec & " /c netdom renamecomputer " & $Currentname & " /NewName:" & $NewName & " /ud:wsusad\administrator /PasswordD:user@123 /Force /REBoot:10")

You can change /c to /k to keep your commandline open while debuging or capture the stdout with AutoIt3. (See helpfile for examples)

Thnak u very much 4 ur kind help. It worked fine. I was missing few spaces only.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...