Solved

vb.net and psexec

Posted on 2014-10-18
3
179 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
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
louisfr earned 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

749 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