alwaysuseperl has asked for the wisdom of the Perl Monks concerning the following question:
namespace WMISample { class Program { static void Main(string[] args) { string remoteMachine = "server"; ConnectionOptions connOptions = new ConnectionOptions( +); connOptions.Impersonation = ImpersonationLevel.Imperso +nate; connOptions.EnablePrivileges = true; ManagementScope manScope = new ManagementScope(String. +Format(@"\\{0}\ROOT\CIMV2", remoteMachine), connOptions); manScope.Connect(); ObjectGetOptions objectGetOptions = new ObjectGetOptio +ns(); ManagementPath managementPath = new ManagementPath("Wi +n32_Process"); ManagementClass processClass = new ManagementClass(man +Scope, managementPath, objectGetOptions); ManagementBaseObject inParams = processClass.GetMethod +Parameters("Create"); inParams["CommandLine"] = @"notepad.exe"; ManagementBaseObject outParams = processClass.InvokeMe +thod("Create", inParams, null); Console.WriteLine("Creation of the process returned: " + + outParams["returnValue"]); Console.WriteLine("Process ID: " + outParams["processI +d"]); Console.ReadLine(); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Convert from c# to Perl
by eyepopslikeamosquito (Archbishop) on Aug 10, 2010 at 02:57 UTC | |
by alwaysuseperl (Novice) on Aug 10, 2010 at 20:18 UTC | |
|
Re: Convert from c# to Perl
by repellent (Priest) on Aug 10, 2010 at 04:07 UTC | |
by alwaysuseperl (Novice) on Aug 10, 2010 at 17:44 UTC | |
by repellent (Priest) on Aug 10, 2010 at 22:38 UTC | |
by alwaysuseperl (Novice) on Aug 10, 2010 at 23:54 UTC | |
by repellent (Priest) on Aug 12, 2010 at 06:30 UTC | |
by alwaysuseperl (Novice) on Aug 10, 2010 at 23:27 UTC | |
|
Re: Convert from c# to Perl
by Anonymous Monk on Aug 10, 2010 at 02:38 UTC |