Click or drag to resize
PMService Class
Represents services installed on a server or workstation
Inheritance Hierarchy
SystemObject
  PM90SettingsAPIPMService

Namespace: PM90SettingsAPI
Assembly: PM90SettingsAPI (in PM90SettingsAPI.dll) Version: 9.0.23.534 (9.0.23.534)
Syntax
C#
public class PMService

The PMService type exposes the following members.

Constructors
  NameDescription
Public methodPMService
Initializes a new instance of the PMService class
Top
Methods
  NameDescription
Public methodStatic memberGetAllServices
Gets a collection of all active services
Public methodStatic memberGetServers
Gets a collection of all active services that are running on a Server, or are the Primary Install
Public methodStatic memberGetWorkstations
Gets a collection of all active services that are running on workstations
Public methodStatic memberLookupService
Looks up a service by name. Passing a null or empty string will return the Primary Installation service
Top
Properties
  NameDescription
Public propertyCondition
The current set of server condition flags
Public propertyDatabaseID
Database unique id for this server or workstation
Public propertyIsLicensed
true if there is no license issue with this server\workstation
Public propertyIsPrimaryServer
returns true if this is the Primary install which includes web portal\reporting
Public propertyIsServer
Returns true if the service is installed on a server
Public propertyIsWorkstation
Returns true if the service is installed on a workstation
Public propertyLastServiceStartUTC
Time stamp for last service start
Public propertyName
Name of server or workstation
Public propertyVersion
Last known service version.
Remarks
This string is updated each time the service starts and is able to write to the database.
Top
Examples
Listing and looking up Services
//Get the primary server
PMService primaryServer = PMService.LookupService(null);

if (primaryServer != null)
{
    Console.WriteLine("{0,20}{1,25}","Primary Server:",primaryServer.Name);
    Console.WriteLine("{0,20}{1,25}","Version:",primaryServer.Version);
    Console.WriteLine("{0,20}{1,25}", "Uptime:", DateTime.UtcNow - primaryServer.LastServiceStartUTC);
    Console.WriteLine("{0,20}{1,25}", "Condtion:", primaryServer.Condition);
    Console.WriteLine("{0,20}{1,25}", "Primary Install:", primaryServer.IsPrimaryServer);
    Console.WriteLine("{0,20}{1,25}", "Workstation:", primaryServer.IsWorkstation);
    Console.WriteLine("{0,20}{1,25}", "Licensed:", primaryServer.IsLicensed);
}


//Get a service by name
PMService serverByName = PMService.LookupService("SERVER42");


//Gets all services
IEnumerable<PMService> allServices = PMService.GetAllServices();


//Gets all servers
IEnumerable<PMService> servers = PMService.GetServers();


//Gets all workstations
IEnumerable<PMService> workstations = PMService.GetWorkstations();
See Also