Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

ManagementObjectSearcher: Afficher les services Installés sur un ordinateur

Modifier,ou,créer,une,source,d'événement
{filelink=15685}

using System;
using System.Management;
 
public class AffichegeServices
{
    public static void Main(string[] args)
    {
        ManagementObjectSearcher service =
            new ManagementObjectSearcher(@"rootCIMV2",
            "SELECT * FROM Win32_Service",
            new EnumerationOptions(
            null, System.TimeSpan.MaxValue,
            1, true, false, true,
            true, false, true, true));
        // Afficher les Services
        Console.WriteLine("Les Services Installés sur l'ordinateur Sont:");
        foreach (ManagementObject elem in service.Get())
        {
            Console.WriteLine(elem.ToString());
        }
    }
}
 
 /* Affichage:
  *
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Alerter"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ALG"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="AppMgmt"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="aspnet_state"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="AudioSrv"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="AVP"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="BITS"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Browser"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="CiSvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ClipSrv"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="clr_optimization_v2.0.50727_32"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="clr_optimization_v4.0.30319_32"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="COMSysApp"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="CryptSvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="DcomLaunch"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Dhcp"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="dmadmin"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="dmserver"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Dnscache"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Dot3svc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="EapHost"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ERSvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Eventlog"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="EventSystem"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="FastUserSwitchingCompatibility"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="FontCache3.0.0.0"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="gupdate"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="gupdatem"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="gusvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="helpsvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="HidServ"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="hkmsvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="HTTPFilter"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="IDriverT"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="idsvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ImapiService"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="JavaQuickStarterService"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="lanmanserver"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="lanmanworkstation"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="LmHosts"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MDM"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Messenger"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="mnmsrvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MSDTC"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MsDtsServer100"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MSIServer"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MSSQLFDLauncher"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MSSQLSERVER"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MSSQLServerADHelper100"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MSSQLServerOLAPService"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="msvsmon90"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="MySQL"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="napagent"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="NetDDE"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="NetDDEdsdm"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Netlogon"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Netman"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="NetTcpPortSharing"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Nla"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="NtLmSsp"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="NtmsSvc"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="OracleJobSchedulerXE"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="OracleMTSRecoveryService"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="OracleServiceXE"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="OracleXEClrAgent"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="OracleXETNSListener"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ose"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="PlugPlay"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="PolicyAgent"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ProtectedStorage"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RasAuto"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RasMan"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RDSessMgr"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RemoteAccess"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RemoteRegistry"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="ReportServer"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RpcLocator"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RpcSs"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="RSVP"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="SamSs"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="SCardSvr"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="Schedule"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="seclogon"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="SENS"
\DEVELOPPEMENTrootCIMV2:Win32_Service.Name="SharedAccess"
.
.
.
    */

No comments yet.

Leave a Comment