Question Process Output under other user

Santa

New member
Joined
Aug 22, 2008
Messages
1
Programming Experience
1-3
please move to: VB.NET General Discussion


Hello,

is it possibe to receive a StandardErrorOutput of a startet process if you start it under an other user?
I get an error message "invaild handle".

Here is my Code:

VB.NET:
Public prog As New System.Diagnostics.Process()
Public Sub start_process(ByVal from As String, ByVal dest As String)

        AddHandler prog.ErrorDataReceived, AddressOf ProcessErrorDataReceived

        With prog.StartInfo
            .FileName = "c:\download\programm.exe"
            .WorkingDirectory = "c:\download\"
            .Arguments = from + " " + dest
            .WindowStyle = ProcessWindowStyle.Hidden
            .UseShellExecute = False
            '.LoadUserProfile = False
            .CreateNoWindow = True
            .RedirectStandardError = True
            .RedirectStandardOutput = True
            .Domain = "laptop1"
            .UserName = "harry"
            .Password = make_secureString("geheim") 'Funktion zum Verschlüsseln des 
            ' SecureStrings
        End With

        Try
            prog.Start()
            prog.BeginErrorReadLine()
            tmrCheckProcess.Start()
            'End With
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub


When I comment out the StartInfo .Domain, . Username and . Password everything work.

Please help me! ;););)
 
Last edited:

Latest posts

Back
Top