Link to home
Start Free TrialLog in
Avatar of derek7467
derek7467

asked on

vb.net and psexec

Attempting to launch an internet browser on a remote machine.  Im having issues concating the arguments line, can someone help?  If I don't specify a site to visit, the code works fine, but I want to pass a site to remotely launch.

IM having trouble on a similar script written in VB

Try
            Dim targetpc As String = "192.168.1.3"
            Dim internet As String = "http://cnn.com"
            Dim p As New Process()
            p.StartInfo.FileName = "C:\Users\king derek\Desktop\PSTools\psexec.exe"
            p.StartInfo.Arguments = "\\" & targetpc & " " & Chr(34) & "C:\Program Files (x86)\Internet Explorer\iexplore.exe" & " " & "http://cnn.com"
            p.Start()
            p.StartInfo.CreateNoWindow = True
            p.WaitForExit()
        Catch ex As Exception
            MsgBox("Shit didnt work")
        End Try

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of derek7467
derek7467

ASKER

Im now having issues with the arguments string, can you tell me what im doing wrong?  NO errors, runs like everything is fine but IE doesnt launch on remote computer

 Try
            Dim targetpc As String = TextBox1.Text
            Dim internet As String = "http://cnn.com"
            Dim p As New Process()
            'p.StartInfo.UseShellExecute = False
            p.StartInfo.FileName = "C:\Users\johndoe\Desktop\new backup\PSTools\psexec.exe"
            p.StartInfo.Arguments = "-s" & " " & "-i" & " " & "-d" & " " & "\\" & targetpc & " " & Chr(34) & "C:\Program Files (x86)\Internet Explorer\iexplore.exe" & Chr(34) & " " & internet
            p.Start()
            p.WaitForExit()
        Catch ex As Exception
            MsgBox("didnt work")
        End Try

Open in new window

nevermind, i fixed!