Exemplo n.º 1
0
        /// <summary>根据计算机获取Win32_Process</summary>>
        /// <param name="computerName"></param>
        /// <returns></returns>
        public static Win32_Process GetWin32_Process(string computerName)
        {
            WMIProvider wmiProvider = new WMIProvider("devsvr");
            wmiProvider.Connect();
            ManagementClass managementClass = wmiProvider.GetManagementClass("Win32_Process");

            return new Win32_Process(managementClass);
        }
Exemplo n.º 2
0
        public static void RemoteExec(string computerName, string commandLine, string currentDirectory, ref uint processId)
        {

            WMIProvider wmiProvider = new WMIProvider(computerName);
            ManagementClass mc = wmiProvider.GetManagementClass("Win32_Process");

            object[] methodArgs = { commandLine, currentDirectory, null, processId };
            mc.InvokeMethod("Create", methodArgs);
            processId = Convert.ToUInt32(methodArgs[3]); 
        }