• 0

[VB.NET] Remote Shell Command Help (please!)


Question

Hello All, just found out about Neowin, looks fantastic!

I have what I think is a very simple question in VB.NET, I'm just starting out with the language.

To run a standard application, I typically run:

Shell(mxcl -d)

within a button to launch the program in question. I'd like however to be able to run this command to a comptuer on my lan (remote computer). I've tried PsExec with no luck. I've tried something along the lines of:

Shell(psexec \\computerName -u "my name" -p Password "mxcl -d")

Not sure if I'm using PsExec correctly, but that's besides the point. I don't need to use PsExec at all, just want my remote computers to launch these programs!

Thanks for reading, any help would be greatly appreciated!

hahaha: "Resident One Post Wonder"... i'm new!

4 answers to this question

Recommended Posts

  • 0
  cicero38 said:
Hello All, just found out about Neowin, looks fantastic!

I have what I think is a very simple question in VB.NET, I'm just starting out with the language.

To run a standard application, I typically run:

Shell(mxcl -d)

within a button to launch the program in question. I'd like however to be able to run this command to a comptuer on my lan (remote computer). I've tried PsExec with no luck. I've tried something along the lines of:

Shell(psexec \\computerName -u "my name" -p Password "mxcl -d")

Not sure if I'm using PsExec correctly, but that's besides the point. I don't need to use PsExec at all, just want my remote computers to launch these programs!

Thanks for reading, any help would be greatly appreciated!

hahaha: "Resident One Post Wonder"... i'm new!

Welcome!

For me, the shell command never seems to pass arguments correctly.

You can try using the System.Diagnostics.Process class to start a new process and pass arguments to it.

You use the Process.StartInfo.FileName attribute to launch your application.

Use the Process.StartInfo.Arguments attribute to list the program arguments.

Process.Start() starts the application.

To point you in the right direction, it would look something like this:

Imports System.Diagnostics 'At the top of your code

Dim p As New Process()

p.StartInfo.FileName = "psexec"
p.StartInfo.Arguments =  "\\computerName -u "my name" -p Password "mxcl -d"
p.Start()

For more information, see the MSDN documentation.

  • 0

Thanks xcguy87 and Rudy.

Going to try making a new Process, sounds very straightforward, thanks for the tip! Will post my results even if it works.

But what does it mean, when one says "you need to start escaping stuff"? Sorry, still learning the programming lingo.

  • 0
  cicero38 said:
Thanks xcguy87 and Rudy.

Going to try making a new Process, sounds very straightforward, thanks for the tip! Will post my results even if it works.

But what does it mean, when one says "you need to start escaping stuff"? Sorry, still learning the programming lingo.

He's referring to the fact that I didn't use escape characters when showing you the code examples...

It should have been:

Dim p As New Process()

p.StartInfo.FileName = "psexec"
p.StartInfo.Arguments =  "\\computerName -u ""my name"" -p Password ""mxcl"" -d"
p.Start()

(notice the double quotation marks?)

The VB.NET compiler associates a quotation mark with the end of a string. Double quotation marks indicate to insert a quotation mark character, instead of indicating the end of the string. The example I gave early would produce compiler errors.

Sorry about that, I usually develop in c# and couldn't remember visual basic's escape character's off hand.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Damn no doubt this is gonna be good, can't think of many franchises as consistent as RE (apart from 3 remake)
    • There are two version of qbittorrent 5.1.0 The normal version which I think is based of QT5 & the QT6 lt20 version. I'm currently using the QT6 LT20 version of 5.1.0 and it downloaded an ubuntu iso perfectly fine.
    • Are we forgetting the hardware degradation on 13th and 14th gen??
    • Cry more. The Ukrainians who had internet access because of Starlink were trash too, huh?
    • RoboForm 9.7.5 by Razvan Serea RoboForm is the top-rated Password Manager and Web Form Filler that completely automates password entering and form filling. RoboForm makes logging into Web sites and filling forms faster, easier, and more secure. RoboForm memorizes and securely stores each user name and password the first time you log into a site, then automatically supplies them when you return. RoboForm's powerful Logins feature eliminates the manual steps of logging into any online account. With just one click RoboForm will navigate to a Web site, enter your username and password and click the submit button for you. Completing long registration or checkout forms is also a breeze. Simply click on your RoboForm Identity and RoboForm fills-in the entire form for you. You no longer need to remember all your passwords. You remember one Master Password, and RoboForm remembers the rest. This allows you to use stronger passwords, making your online experience more secure. RoboForm uses strong AES encryption for complete data security. The all new RoboForm comes with Chrome and Safari browser support, iPhone/iPad and Android support, as well a brand new RoboForm Everywhere license for use on unlimited computers and mobile devices. RoboForm 9.7.5 changelog: Prepared for the upcoming RoboForm browser extension with New Auth. Download: RoboForm 9.7.5 | 42.1 MB (Free, paid upgrade available) View: RoboForm Website Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Year In
      Vladimir Migunov earned a badge
      One Year In
    • One Month Later
      daelos earned a badge
      One Month Later
    • Week One Done
      daelos earned a badge
      Week One Done
    • Mentor
      Karlston went up a rank
      Mentor
    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      494
    2. 2
      snowy owl
      252
    3. 3
      +FloatingFatMan
      250
    4. 4
      ATLien_0
      225
    5. 5
      +Edouard
      181
  • Tell a friend

    Love Neowin? Tell a friend!