vb.net process.start() netdom and arguments dont seem to work.

  • Thread starter Thread starter brett
  • Start date Start date
B

brett

Hey,

When I run this code i seem to always get exit code 87 or 1.
I am going to assume its an issue with the way the arguments string
(args) is setup but i cant for the life of me see whats wrong at this
moment. Anyone with a fresh set of eyes see the issue?

CODE:

Dim args = "RENAMECOMPUTER " & cn_orig & " /NewName:" & cn_label.Text
& " /UserD:" & x_un & " /PasswordD:" & x_pw & " /Force /Reboot:" &
shutdown_time

' create a new process
Dim myProcess As Process = System.Diagnostics.Process.Start("c:\windows
\system32\NETDOM.exe", args)

' wait until it exits
myProcess.WaitForExit()

' display results
MessageBox.Show("CMD was closed at: " & myProcess.ExitTime & "." &
System.Environment.NewLine & "Exit Code: " & myProcess.ExitCode)

myProcess.Close()
 
Back
Top