Sign in to follow this  
Followers 0
Lori

Quick Try

5 posts in this topic

#1 ·  Posted (edited)

I've removed the user and domain details for posting on here,

everything works except the _RunDOS command.

But I can't see where it's going wrong?

Netdom is installed and it works under dos ok. (with the change to how varables are delt with)

#include <process.au3>

$return = MsgBox(0x4+48, "Rename?", "Would you like to rename this machine?", 10)

If $return=6 Then

$Machinename = Inputbox("Rename", "Rename me to...", "", "")

If @error then Exit

_RunDOS("netdom renamecomputer %computername% /NewName:" & $Machinename & "/Force /REBoot:2 /UserD: /PasswordD:")

EndIf

If $return=7 Then

$return = MsgBox(0x4+48, "Join Domain?", "Would you like to join the domain?", 10)

if @error then Exit

if $return=6 Then

_RunDOS("netdom join computername /Domain: /UserD: /PasswordD: /REBoot:2")

EndIf

If $return=7 Then

EndIf

EndIf

Exit

Edited by Lori

Share this post


Link to post
Share on other sites



Welcome to the forums.

Here you need a space between the new Machine Name and the /Force switch:

_RunDOS("netdom renamecomputer %computername% /NewName:" & $Machinename & "/Force /REBoot:2 /UserD: /PasswordD:")

computername should be %computername%

_RunDOS("netdom join computername /Domain: /UserD: /PasswordD: /REBoot:2")

_RunDOS doesn't have any debugging options.

Try one (or both) of these lines instead:

RunWait(@Comspec & " /k echo " & "Your Command Goes Here") ; View the command as it will be executed.
RunWait(@Comspec & " /k " & "Your Command Goes Here") ; Run the command and see the output (if any).

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

I wasn't aware netdom could rename computers while they aren't on a domain.

Share this post


Link to post
Share on other sites

I wasn't aware netdom could rename computers while they aren't on a domain.

It can't...

But whoever said that it could?


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

It can't...

But whoever said that it could?

The op's script example looks like the "rename" is before the "join" to me.

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