• 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

    • Using NASA’s IXPE telescope and a fleet of observatories, scientists discovered that the system’s intense X-rays don’t come from its glowing accretion disk as previously believed, but from a chaotic, high-speed wind of particles hurled out by the pulsar itself. The findings challenge old models and reveal a single, powerful mechanism behind the pulsar’s radiation. It’s a dramatic twist in our understanding of how dead stars can still light up the universe. A global team of astronomers has made a significant discovery about how the energetic remains of exploded stars interact with the space around them. Using NASA’s IXPE (Imaging X-ray Polarimetry Explorer) along with several other observatories, researchers gathered new insights into this dynamic cosmic behavior. The scientists, working across the United States, Italy, and Spain, focused their investigation on a puzzling stellar system known as PSR J1023+0038, or simply J1023. This system features a rapidly spinning neutron star that draws material from a smaller companion star. As a result, an accretion disk of matter has formed around the neutron star. The neutron star also functions as a pulsar, emitting intense beams of radiation from its magnetic poles as it spins, creating a pattern that resembles a lighthouse sweeping through space. What makes J1023 especially important is that it switches between two distinct phases. https://scitechdaily.com/nasa-just-discovered-where-these-mysterious-space-x-rays-really-come-from/    
    • Artifacts from the Iron Age have revealed an intense historical magnetic anomaly in the Middle East. Could using a similar approach elsewhere help us unravel the mysteries of Earth's magnetic field? Ben-Yosef, an archaeologist at Tel Aviv University, had been working in southern Jordan with Ron Shaar, who was analyzing archaeological materials around the Levant. Shaar, a geologist at The Hebrew University of Jerusalem, was building a record of the area's magnetic field. The hunk of copper slag — a waste byproduct of forging metals — they found recorded an intense spike in Earth's magnetic field around 3,000 years ago. Shaar worked hard to give them more evidence. After they had analyzed and described samples from around the region for more than a decade, the anomaly was accepted by the research community and named the Levantine Iron Age Anomaly (LIAA). From about 1100 to 550 B.C., the magnetic field emanating from the Middle East fluctuated in intense surges. https://www.livescience.com/archaeology/earths-magnetic-field-is-weakening-magnetic-crystals-from-lost-civilizations-could-hold-the-key-to-understanding-why
    • Designed by former F1 engineers. Pure danger. A company made up of former F1 racing engineers has unveiled an outrageous e-scooter that can reach a top speed of north of 100 miles per hour — and covers a whopping 150 miles on a single charge. The bizarre contraption, dubbed The Turbo, was developed by UK-based e-scooter company Bo, whose existing lineup targets the more premium end of the last-mile — or last 150 miles, in this case — mobility market. The Turbo's specs are borderline hard to believe. The metal-clad and girthy two-wheeler features a 24,000-watt dual-motor engine and an enormous 1,800-watt-hour battery. Aerodynamic air intakes funnel wind to keep everything cool. https://futurism.com/the-byte/100-mph-escooter-hazard    
    • Apple was waiting for Samsung to refine the technology. Now, they will ask Samsung to make their screen. Amazing...
  • Recent Achievements

    • Rookie
      Snake Doc went up a rank
      Rookie
    • First Post
      nobody9 earned a badge
      First Post
    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      495
    2. 2
      Michael Scrip
      203
    3. 3
      ATLien_0
      197
    4. 4
      Xenon
      136
    5. 5
      +FloatingFatMan
      116
  • Tell a friend

    Love Neowin? Tell a friend!