Solved

vb.net and psexec

Posted on 2014-10-18
3
178 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to App 4 83
how to Classify of email (pdf attachments) 7 36
Following an example - Why do I need to click Save button twice? 3 26
parsing JSON help 1 11
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This video teaches viewers about errors in exception handling.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

825 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