Example #1
0
        private void Test10()
        {
            System.Management.ManagementObjectCollection mg =
                WIN32.WmiAccess.GetInstancesOfClass("svapl02-36", "Win32_Process");
            foreach (System.Management.ManagementObject m in mg)
            {

                Console.WriteLine(m.Properties["Name"].Value);
                System.Management.ManagementObjectCollection mg2 = m.GetRelationships();
                foreach (System.Management.ManagementObject mm in mg2)
                {
                    Console.WriteLine(mm.ClassPath);
                    System.Management.ManagementObjectCollection mg3 = mm.GetRelated();
                    foreach (System.Management.ManagementObject mm2 in mg2)
                    {
                        Console.WriteLine(mm2.ClassPath);
                    }
                }

                WIN32.Win32_Process prc = new DotNet.Tools.WIN32.Win32_Process(m);
                string user; string domain;
                WIN32.Win32API.ProcessReturnCode rs = prc.GetOwner(out user,out domain);
                Console.WriteLine(rs.ToString());
                Console.WriteLine(user);
                Console.WriteLine(domain);

            }
        }
Example #2
0
        public static Win32_Process[] GetWin32_Processes(string machineName)
        {
            List <Win32_Process> lst = new List <Win32_Process>();

            System.Management.ManagementObjectCollection mg =
                WIN32.WmiAccess.GetInstancesOfClass(machineName, "Win32_Process");
            foreach (System.Management.ManagementObject m in mg)
            {
                WIN32.Win32_Process prc = new DotNet.Tools.WIN32.Win32_Process(m);
                lst.Add(prc);
            }
            return(lst.ToArray());
        }
Example #3
0
        public static Win32_Process[] GetWin32_Processes(string machineName)
        {
            List<Win32_Process> lst = new List<Win32_Process>();
            System.Management.ManagementObjectCollection mg =
                WIN32.WmiAccess.GetInstancesOfClass(machineName, "Win32_Process");
            foreach (System.Management.ManagementObject m in mg)
            {

                WIN32.Win32_Process prc = new DotNet.Tools.WIN32.Win32_Process(m);
                lst.Add(prc);

            }
            return lst.ToArray();
        }
Example #4
0
        private void Test14()
        {
            string machineName = "svapl02-36";
            string name = @"d:\\Web\\Facilities.Instalaciones.BS.WS\\web.config";

            WIN32.Win32_Process proc =new DotNet.Tools.WIN32.Win32_Process(WIN32.WmiAccess.GetInstanceByName("svapl02-36", "Win32_Process", "Infomallorca.Facilities.Instalaciones.SVC.exe"));

            System.Management.ManagementObjectCollection results = WIN32.WmiAccess.GetAssociatorsByClassName(machineName, "Win32_Process=" + proc.ProcessId.ToString() + "", "CIM_DataFile");
            foreach (System.Management.ManagementObject mo in results)
            {
                Console.WriteLine(mo.ClassPath);
            }
        }