#157976 - 2006-03-01 05:06 AM
Re: UnJoin 20 Computers From Domain then Rejoin
|
Dmartin05
Fresh Scripter
Registered: 2006-02-01
Posts: 49
|
1st and foremost, thanks for you quick responses. It has been about 2 weeks of me trying to dab at this and to no victory.
Good News: In the begining I copied the script, it was not running at all, I then looked at my "Scripting with Kixtart" book and noticed that the %compspec needed an extra % at the end of it. once I did this I was able to start the netdom cmd. BAD NEWS Below is your script with my added netdom cmds: I know the netdom script is running b/c I placed an * for the pwds and after I enter them it says "Network Path could not be found" The command failed to complete successfully. I verified the computers.txt and the machine is in there just like you said "pcname" w/o the "". Its all in the same directory. Just to make sure it wasn't my netdom command that wasn't working, I went ahead and ran the netdom command manually from the server, and forced 1 of my client pc's to be removed from the domain. I then re-added it with the netdom command again. I have tested the netdom cmds exactly like you see above in the script and it works when I run it manually, but when I attempt to run it through kix it does not work.
Any Ideas?
Break On Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On') Dim $List,$Computer,$Computers $List = @ScriptDir+'\'+'computers.txt' $Computers = ReadFile($List) For Each $Computer In $Computers IF $Computer SHELL '%comspec% /c NETDOM Join $Computer /domain:testing /userd:administrator /passwordd:* /userO:administrator /passwordO:*' ;instead of example above you would put in something like this EndIf Next Function ReadFile($file) Dim $lf, $f, $_, $t $lf=CHR(10) $f=FreeFileHandle $_=Open($f,$file) If @ERROR Exit @ERROR EndIf Do $t=$t+$lf+ReadLine($f) Until @ERROR $_=Close($f) $ReadFile=Split(SubStr($t,2),$lf) EndFunction
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 493 anonymous users online.
|
|
|