?
Solved

vb.net and psexec

Posted on 2014-10-18
3
Medium Priority
?
182 Views
Last Modified: 2014-10-20
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

0
Comment
Question by:derek7467
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
louisfr earned 2000 total points
ID: 40389414
You need to put quotes before and after the command path
p.StartInfo.Arguments = "\\" & targetpc & " " & Chr(34) & "C:\Program Files (x86)\Internet Explorer\iexplore.exe" & Chr(34) & " " & "http://cnn.com"

Open in new window

0
 

Author Comment

by:derek7467
ID: 40391960
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

0
 

Author Comment

by:derek7467
ID: 40391995
nevermind, i fixed!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This video teaches viewers about errors in exception handling.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question