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

2 thoughts on “Using Global Conditions to check the State of a Service with ConfigMgr 2012

  1. Peter,

    Hello.

    I am deploying Microsoft Office Professional Plus 2013 using a ConfigMgr 2012 R2 application with one deployment type where the User Experience’s “Logon requirement” is “Only when no user is logged on”. The application is deployed as “required” to a device collection so it will install when the user logs off.

    I would also like to make the application available on the Application Catalog without having to duplicate it.

    Is it possible to configure a deployment type that “knows” it’s being launched from the Application Catalog? Perhaps, using a Global Condition as a requirement.

    If it’s possible, this deployment deployment would have priority “1” with the User Experience’s “Login requirement” set to “Only when a user is logged on” and deployed to the Application Catalog as “Available”.

    I thought of using a requirement of “User’s Primary Device”, but if, for whatever reason, it resolved to false it could be problematic because device collections ignore it.

    Thank you in advance for any assistance you can provide.

    John Bull
    City of Santa Barbara

  2. Hi John,

    Using the primary user/ primary device would definitely be the easiest option. If you than use that option with both of the deployment types, and just differ the value, you can never install the same deployment type on the same device. Unless something changes in the primary user/ primary device…

    Peter

Leave a Comment