TestimoX

API Reference

Class

ServicesQuery

Namespace ComputerX.Services
Assembly ComputerX

Provides service management queries.

Inheritance

  • Object
  • ServicesQuery

Constructors

public ServicesQuery() #

Methods

public Boolean AreServicesRunning(String[] serviceNames, String[] machineNames = null, InternalLogger logger = null) #
Returns: Boolean

Synchronous wrapper for [[cref:ComputerX.Services.ServicesQuery.AreServicesRunningAsync(System.String[],System.String[],ComputerX.Logging.InternalLogger)]].

Parameters

serviceNames System.String[] requiredposition: 0
machineNames System.String[] = null optionalposition: 1
logger ComputerX.Logging.InternalLogger = null optionalposition: 2
public async Task<Boolean> AreServicesRunningAsync(String[] serviceNames, String[] machineNames = null, InternalLogger logger = null) #
Returns: Task<Boolean>

Returns true when all specified services are running on each target machine.

Parameters

serviceNames System.String[] requiredposition: 0
Service names to verify.
machineNames System.String[] = null optionalposition: 1
Optional list of machines; defaults to local.
logger ComputerX.Logging.InternalLogger = null optionalposition: 2
Optional logger.
public Boolean EnsureServicesRunning(String[] serviceNames, String[] machineNames = null, InternalLogger logger = null) #
Returns: Boolean

Synchronous version of [[cref:ComputerX.Services.ServicesQuery.EnsureServicesRunningAsync(System.String[],System.String[],ComputerX.Logging.InternalLogger)]].

Parameters

serviceNames System.String[] requiredposition: 0
machineNames System.String[] = null optionalposition: 1
logger ComputerX.Logging.InternalLogger = null optionalposition: 2
public Task<Boolean> EnsureServicesRunningAsync(String[] serviceNames, String[] machineNames = null, InternalLogger logger = null) #
Returns: Task<Boolean>

Ensures that the specified services are running on each target machine by querying their status.

Parameters

serviceNames System.String[] requiredposition: 0
Service names to validate.
machineNames System.String[] = null optionalposition: 1
Optional list of machines; defaults to the local machine.
logger ComputerX.Logging.InternalLogger = null optionalposition: 2
Optional logger for diagnostics.

Returns

True when every named service is in the Running state on all targets.

GetServiceStartupType(System.ServiceProcess.ServiceController arg1, ComputerX.Logging.InternalLogger arg2) #

Determines the service startup type using native SCM first, then falls back to local registry or WMI when necessary.

Parameters

arg1 System.ServiceProcess.ServiceController required
arg2 ComputerX.Logging.InternalLogger required
QueryAllAsync 2 overloads
public Task<List<ServiceInfo>> QueryAllAsync(String[] machineNames = null, InternalLogger logger = null) #
Returns: Task<List<ServiceInfo>>

Queries all services on one or more machines.

Parameters

machineNames System.String[] = null optionalposition: 0
logger ComputerX.Logging.InternalLogger = null optionalposition: 1
public Task<List<ServiceInfo>> QueryAllAsync(String[] machineNames = null, Nullable<TimeSpan> perMachineTimeout = null, CancellationToken ct = null, InternalLogger logger = null, Boolean includeDetails = true) #
Returns: Task<List<ServiceInfo>>

Queries all services on one or more machines with optional per‑machine timeout and cancellation.

Parameters

machineNames System.String[] = null optionalposition: 0
Machines to query; defaults to local machine.
perMachineTimeout System.Nullable{System.TimeSpan} = null optionalposition: 1
Optional timeout per machine; empty for no timeout.
ct System.Threading.CancellationToken = null optionalposition: 2
Cancellation token.
logger ComputerX.Logging.InternalLogger = null optionalposition: 3
Optional logger.
includeDetails System.Boolean = true optionalposition: 4
When true, attempts to enrich with WMI details.
public async Task<List<ServiceInfo>> QueryAllViaCimAsync(String[] machineNames = null, InternalLogger logger = null) #
Returns: Task<List<ServiceInfo>>

Query all services using CIM.

Parameters

machineNames System.String[] = null optionalposition: 0
logger ComputerX.Logging.InternalLogger = null optionalposition: 1
public Task<List<ServiceInfo>> QueryAllViaWmiAsync(String[] machineNames = null, InternalLogger logger = null) #
Returns: Task<List<ServiceInfo>>

Query all services using WMI.

Parameters

machineNames System.String[] = null optionalposition: 0
logger ComputerX.Logging.InternalLogger = null optionalposition: 1
public List<ServiceInfo> QueryServices(String[] serviceNames, String[] machineNames = null, InternalLogger logger = null) #
Returns: List<ServiceInfo>

Synchronous wrapper for [[cref:ComputerX.Services.ServicesQuery.QueryServicesAsync(System.String[],System.String[],ComputerX.Logging.InternalLogger)]].

Parameters

serviceNames System.String[] requiredposition: 0
machineNames System.String[] = null optionalposition: 1
logger ComputerX.Logging.InternalLogger = null optionalposition: 2
public async Task<List<ServiceInfo>> QueryServicesAsync(String[] serviceNames, String[] machineNames = null, InternalLogger logger = null) #
Returns: Task<List<ServiceInfo>>

Queries the specified services on one or more machines and returns their status/info.

Parameters

serviceNames System.String[] requiredposition: 0
Service names to query.
machineNames System.String[] = null optionalposition: 1
Optional list of machines; defaults to local machine.
logger ComputerX.Logging.InternalLogger = null optionalposition: 2
Optional logger for diagnostics.
public IAsyncEnumerable<ServiceInfo> QueryServicesAsyncEnumerable(String[] serviceNames, IEnumerable<String> machineNames = null, Int32 degreeOfParallelism = 4, CancellationToken cancellationToken = null, InternalLogger logger = null) #
Returns: IAsyncEnumerable<ServiceInfo>

Streams service info for the specified services across many machines with bounded parallelism.

Parameters

serviceNames System.String[] requiredposition: 0
machineNames System.Collections.Generic.IEnumerable{System.String} = null optionalposition: 1
degreeOfParallelism System.Int32 = 4 optionalposition: 2
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
logger ComputerX.Logging.InternalLogger = null optionalposition: 4