wright1968
Member
Ok... this is driving me nuts.
I have the following code that works perfectly to disable an account in active directory using DSMOD in an application. But in another application, the exact same code results in failure. I'm absolutely confused as to why it works in App A and not in App B.
I've done tons of troubleshooting, and have even tried removing all the string references and replacing them with the actual text to make sure nothing weird is being passed to the arguments.
I have similar code for DSQUERY.EXE in the same app that returns results perfectly, but this block of code for DSMOD.EXE and another for DSRM.EXE doesn't seem to run correctly.
Here is the code in question
I have the following code that works perfectly to disable an account in active directory using DSMOD in an application. But in another application, the exact same code results in failure. I'm absolutely confused as to why it works in App A and not in App B.
I've done tons of troubleshooting, and have even tried removing all the string references and replacing them with the actual text to make sure nothing weird is being passed to the arguments.
I have similar code for DSQUERY.EXE in the same app that returns results perfectly, but this block of code for DSMOD.EXE and another for DSRM.EXE doesn't seem to run correctly.
Here is the code in question
VB.NET:
Dim myProcess As New Process
Dim sReturnData As String = Nothing
myProcess.StartInfo.FileName = "dsmod.exe"
myProcess.StartInfo.Arguments = "computer " & Chr(34) & sLDAP & Chr(34) & " -desc " & Chr(34) & sNewDesc & Chr(34) & " -disabled yes"
myProcess.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System)
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.UseShellExecute = False
myProcess.Start()
Do Until myProcess.StandardOutput.EndOfStream = True 'Code breaks here (albeit with no exception, and jumps to the message box.
sReturnData = myProcess.StandardOutput.ReadToEnd
Loop
MsgBox(sReturnData)
myProcess.Dispose()