shoris
asked on
Script (VBS or Batch)
I am in the process of a ADMT migration. I am migrating computers as is to the new domain. However, in the domain, I would like to run a batch file or script to rename the computer accounts to the new naming convention. In addition, I would like to include if possible from a file the old computer name and the new computer name. And return a result file whether the rename was successful or not so that I can troubleshoot the computers that didn't get renamed. Please advise.
ASKER
The problem with that is that, if it has to pick up a new name, it will need to dis-join from network first, then renamed, then rebooted then joined to the new name in the new domain.
That can be done all within the computer migration on the re-name without any issues?
That can be done all within the computer migration on the re-name without any issues?
Yes, it works during agent run. Of course reboot is required in this case as in standard computer rename process.
Just try with some test machine
Krzysztof
Just try with some test machine
Krzysztof
ASKER
I have attached the ADMT tool example, then are you saying, in a text format, I can have my old machines and new machine name..Then would the ADMT reboot this machine 3 times to do the final rename in the new domain?
I thought, if I migrate them as is, then run a netdom scripted utility that would be faster and work, but I need a netdom script that would have an include file and give me the results as well.
Example.docx
I thought, if I migrate them as is, then run a netdom scripted utility that would be faster and work, but I need a netdom script that would have an include file and give me the results as well.
Example.docx
yes, choose read object from input file. And there should be just 1 reboot as I remember.
I need to check that i my test environment as I'm not sure now :)
Krzysztof
I need to check that i my test environment as I'm not sure now :)
Krzysztof
ASKER
Unfortunately, I won't be able to test until another 2 weeks :( so if you do it in yours that would be great.. You see.. I heard there is only one reboot, but in a rename process, it requires two reboots so that's why I thought, if if I just migrate the machines as is with the naming convention and then do a netdom utility to do another rename.
Take it easy, there is no rush if you do not need it now :]
I will test that tomorrow morning and will let you know the results in short guide
Krzysztof
I will test that tomorrow morning and will let you know the results in short guide
Krzysztof
ASKER
You are awesome :)... Thank you so much. Of course everyone wants these migrations done quickly and efficiently.
ASKER
any news krzysztof..
Sorry, I had no chance to check that yet. I will do that as soon as possible and post an update.
Thank you in advance for understanding
Krzysztof
Thank you in advance for understanding
Krzysztof
OK, I found some issues during migration computers over input file with computer name change :/ Looks like there is need to change computer names before migration :|
Let me test this deeply
Krzysztof
Let me test this deeply
Krzysztof
ASKER
Yes, that's what I thought :(.. I was thinking if the computer name would be changed after migration with a netdom then that would work.
I'm just looking for the syntax to change a number of computers from an input file in a netdom command line.
I'm just looking for the syntax to change a number of computers from an input file in a netdom command line.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much.. I will try that for sure.
ASKER
I have been trying to do this on a command line on the DC
* -filter "(objectClass=computer)" -attr name -limit 0 | find /v "name" >>c:\comps.txt
changed to C:windows\system32 and ran that command and it came back as not an internal command..
* -filter "(objectClass=computer)" -attr name -limit 0 | find /v "name" >>c:\comps.txt
changed to C:windows\system32 and ran that command and it came back as not an internal command..
ASKER
this is what i get
C:\Users\Administrator>dsq uery * -filter "(objectClass=computer)" -attr name -limit 0 | find /v "name" >>c:\comps.txt
C:\Users\Administrator>1:
The system cannot find the drive specified.
Wierldy when i open up the Text file I get all the computer names.
C:\Users\Administrator>dsq
C:\Users\Administrator>1:
The system cannot find the drive specified.
Wierldy when i open up the Text file I get all the computer names.
ASKER
would this be the result in the text file ?
OldName,NewName
MSPC001,MXPC001
OldName,NewName
MSPC001,MXPC001
Yes sure. But if you use comma (,) as separator then you need to modify a little bit the syntax
the difference is that delims is defined to not use default space as separator but comma
And I'm really surprised that you saw an error and whole output was in a text file :/ Really strange
Krzysztof
for /f "tokens=1-2 delims=," %i in (c:\comps.txt) do netdom renamecomputer %i /NewName %j /UserD:DomainAdminAccount /PasswordD:ItsPassword /Force /REBoot:1
the difference is that delims is defined to not use default space as separator but comma
And I'm really surprised that you saw an error and whole output was in a text file :/ Really strange
Krzysztof
ASKER
I really appreciate your help. Thank you so much.
You're welcome :)
I hope I could help
Krzysztof
I hope I could help
Krzysztof
an example input file
SourceName,TargetName
oldName,newName
and ADMT syntax
Open in new window
Regards,
Krzysztof