locked
Notepad Window is not opening on remote machine. RRS feed

  • Question

  •   

     

    System.Management.ConnectionOptions connOptions = new System.Management.ConnectionOptions(); connOptions.Impersonation = System.Management.ImpersonationLevel.Impersonate; connOptions.EnablePrivileges = true; string compName = "***.**.1.***"; connOptions.Username = @"domain\sujays"; connOptions.Password = "****"; System.Management.ManagementScope manScope = new System.Management.ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", compName), connOptions); manScope.Connect(); System.Management.ObjectGetOptions objectGetOptions = new System.Management.ObjectGetOptions(); System.Management.ManagementPath managementPath = new System.Management.ManagementPath("Win32_Process"); System.Management.ManagementClass processClass = new System.Management.ManagementClass(manScope, managementPath, objectGetOptions); System.Management.ManagementBaseObject inParams = processClass.GetMethodParameters("Create"); inParams["CommandLine"] = @"c:\windows\system32\notepad.exe"; System.Management.ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null); Console.WriteLine(outParams["processId"]);

    Hi All,

    I am trying open a notepad process on a remote machine. I wrote the code snippet.

    It establish the connection. But notepad window doesn't open on remote computer.

    Please help.

    Thanks & Regards,

    Sujay Sahay

    Tuesday, October 16, 2012 3:25 PM