Using Global Conditions to check the State of a Service with ConfigMgr 2012

This week my post will be about using a Global Condition to check the State of a service. I came to this, as I was once again deploying my UE-V Agent, like here, but this time via a normal Deployment. This installation will only run, without failure, when the Offline Files Service (CscService) is running. So a Requirement for the Deployment Type should be that the service is running. As I like to find ways to do things without the need of scripts/ scripting, I came to using a standard Global Condition.

Configuration

Now lets take a look at how we can configure a Global Condition, in such a way, that it checks for the State of a service. During the configuration steps I will use the Offline Files Service (CscService) as an example.

  • GlobCondStatServIn the Configuration Manager Console, navigate to Software Library > Overview > Application Management > Global Condition.
  • On the Home tab, click Create > Create Global Condition and the Create Global Condition –popup will show.
  • Now fill in the following information and click Ok.
    • Fill in as Name <aName>.
    • Select as Device type Windows.
    • Select as Condition type Setting.
    • Select as Setting type WQL query.
    • Select as Data type String.
    • Fill in as Namespace root\cimv2.
    • Fill in as Class Win32_Service.
    • Fill in as Property State.
    • Fill in as WQL query WHERE clause: Name=’CscService’.

After configuring the Global Condition, lets add it as a Requirement on a Deployment Type. During these configuration steps I will use the UE-V Agent as an example.

    • AddRequStatServIn the Configuration Manager Console, navigate to Software Library > Overview > Application Management > Applications.
    • Select the UE-V Agent Application and on the Deployment Types –tab double-click <aDeploymentType>.
    • On the Requirements –tab, click.Add… and the Create Requirement –popup will show.
    • Now fill in the following information and click Ok.
      • Select as Category: Custom.
      • Select as Condition: <aName>.
      • Select as Rule type: Value.
      • Select as Operator: Equals.
      • Fill in as Value: Running.

Result

As always, now it’s time to show the results. In this case I’m not going to show any log files, but I’m going to use the Simulate Deployment option. This option is specifically designed for testing the Requirements for an Application. I like to think that the best way to test a custom Requirement/ Global Condition is to test it with a wrong Value. The reason for that is that it will show the results of the Requirement in the Requirements Not Met –tab of the Deployment Status. In my case I tested it with the Value Stopping, while I knew that it was Running. See here the results of that test.AsseDetaStatServ