Solved

vb.net and psexec

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now