• 0

[VB.NET] Launch Remote Process


Question

I'm trying to write a program to let us install applications/Updates across an entire domain without having to go to every pc by itself and run the install.

from what I've read the following code should work but it doesn't

the Message box says Cannot connect to RPC Server.

any help would be greatly appreciated

        Dim coptions As ConnectionOptions = New ConnectionOptions
        coptions.Username = "administrator"
        coptions.Password = "*********"

        Dim workingdir As String = TextBox1.Text
        Dim mcommand As String = TextBox2.Text
        Dim servername As String = TextBox3.Text
        Dim scope As ManagementScope = New ManagementScope("\\" & servername & _
        "\root\cimv2", coptions)
        Try
            scope.Connect()
            Dim mp As ManagementPath = New ManagementPath("Win32_Process")
            Dim mo As ManagementClass = New ManagementClass(scope, mp, New _
            ObjectGetOptions(Nothing, New TimeSpan(0, 0, 0, 5), True))
            Dim inParams As ManagementBaseObject = mo.GetMethodParameters("Create")
            Dim options As InvokeMethodOptions = New InvokeMethodOptions
            inParams("CommandLine") = mcommand
            inParams("CurrentDirectory") = workingdir
            Dim mbo As ManagementBaseObject = mo.InvokeMethod("Create", inParams, _
            options)
            Dim rv As Object = mbo("returnvalue")
            Dim prid As Object = mbo("processid")
        Catch ex As Exception
            MsgBox("Failed to connect: " + ex.Message)
        End Try

Link to comment
https://www.neowin.net/forum/topic/297775-vbnet-launch-remote-process/
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  gameguy said:
Since you already have a domain, can't you simply push the install to every machine? :huh:

585637212[/snapback]

not yet.

Unless there are some domain tools none of us know about.

We've got two different domains and about 360 computers to manage.

and I'm sick and tired of letting end users install updates ;)

my goal is to secure our network before we get the new servers in April.

Clint

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

    • No registered users viewing this page.
  • Posts

    • A female Jem'Hadar makes no bloody sense whatsoever... They're a male only, genetically engineered, clone species...  Did the idiots making this not watch ANY of DS9, or bother to check a wiki, at ALL? This is going to be crap, isn't it?    
    • Internet Download Manager (IDM) 6.42 Build 42 by Razvan Serea Internet Download Manager (IDM) is a tool to increase download speeds by up to 5 times, resume and schedule downloads. Comprehensive error recovery and resume capability will restart broken or interrupted downloads due to lost connections, network problems, computer shutdowns, or unexpected power outages. IDM integrates seamlessly into Google Chrome, FireFox, Microsoft Edge, Opera, Safari, Internet Explorer, Maxthon and all other popular browsers to automatically handle your downloads. You can also drag and drop files, or use Internet Download Manager from command line. The program supports proxy servers, ftp and http protocols, firewalls, redirects, cookies, authorization, MP3 audio and video content processing. Changes in Internet Download Manager 6.42 Build 42: Updated Chrome extension to support Chrome manifest 3 Fixed bugs Download: Internet Download Manager 6.42 Build 42 | 11.7 MB (Shareware) Links: Internet Download Manager Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • I purchased, and that key is also not working. Well, it worked now.
    • Hello, In the past, I have purchased directly from Amazon, BestBuy, MicroCenter, Microsoft, and Newegg.  When purchasing, I have made sure the seller was either the store in question (not a third-party in their marketplace) or Microsoft. Regards, Aryeh Goretsky  
    • Right. And permission denied means it's still there, now just need to bypass authentication !!
  • Recent Achievements

    • One Month Later
      TheRingmaster earned a badge
      One Month Later
    • First Post
      smileyhead earned a badge
      First Post
    • One Month Later
      K V earned a badge
      One Month Later
    • Week One Done
      K V earned a badge
      Week One Done
    • Dedicated
      CarlosABC earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      639
    2. 2
      ATLien_0
      241
    3. 3
      Xenon
      175
    4. 4
      neufuse
      155
    5. 5
      +FloatingFatMan
      123
  • Tell a friend

    Love Neowin? Tell a friend!