Sign in to follow this  
Followers 0
erloyaamit

Rename domain computer

3 posts in this topic

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.

Share this post


Link to post
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)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0