0

I am trying to start a process a a different user but it keeps telling me that the "The directory name is invalid".

Dim info As New ProcessStartInfo("notepad")
        info.UseShellExecute = False

        Dim password As String = "Password"
        Dim securePassword As New SecureString()

        For i As Integer = 0 To password.Length - 1
            securePassword.AppendChar(Convert.ToChar(password(i)))
        Next

        info.UserName = "Goku"
        info.Password = securePassword
        info.Domain = "Castle"

        Try
            Process.Start(info)

        Catch ex As System.ComponentModel.Win32Exception
            Console.WriteLine(ex.Message)
        End Try

If I comment out info.username it will launch notepad just not as Goku

1
Contributor
1
Reply
7
Views
3 Years
Discussion Span
Last Post by Spyderbane
0

So I solved this I needed to add

info.WorkingDirectory = "c:\somewhere"
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.