Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Any one who can answer my question in detail!!!

Any one who can answer my question in detail!!!

Scheduled Pinned Locked Moved C#
helpalgorithmsquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saaaaz
    wrote on last edited by
    #1

    I actually want to open Notepad on a remote machine. By writing the following code, I am able to run it, but the problem is that it is runs in background. I can only see it by opening up the windows task manager of the remote machine. ConnectionOptions objConnectionOptions = new ConnectionOptions(); objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate; objConnectionOptions.EnablePrivileges = true; objConnectionOptions.Username = strUserName; objConnectionOptions.Password = strPassword; ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions); objManagementScope.Connect(); ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null); ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create"); inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe"; ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null); Is there anyone who could help me in sorting out this problem Thanks. Sarfraz

    D 1 Reply Last reply
    0
    • S Saaaaz

      I actually want to open Notepad on a remote machine. By writing the following code, I am able to run it, but the problem is that it is runs in background. I can only see it by opening up the windows task manager of the remote machine. ConnectionOptions objConnectionOptions = new ConnectionOptions(); objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate; objConnectionOptions.EnablePrivileges = true; objConnectionOptions.Username = strUserName; objConnectionOptions.Password = strPassword; ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions); objManagementScope.Connect(); ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null); ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create"); inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe"; ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null); Is there anyone who could help me in sorting out this problem Thanks. Sarfraz

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      I already told you[^] WMI cannot be used to launch an interactive process on a remote machine and what you had to use to accomplish it. How many times are you going to ask this question in one day??

      Dave Kreskowiak Microsoft MVP - Visual Basic

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups