Kaseya Community

Identify Exchange Servers and Version

  • Hello,

    I have seen many topics on how to view Exchange servers and/or by version.  The general idea has usually been to view by store.exe version.  The problem with this is that store.exe could be left over, or there could be multiple versions of store.exe existing, or your customer may have Exchange installed (and store.exe exists) but have disabled it's services (SBS, for example).  I created this script that I thought I would share.  It's not perfect by any means, but it allows for identification of Exchange (either Active or Inactive) and version (2003, 2007, 2010, Role Server).  It requires a few custom fields which hold the version and Active/Inactive status.  Personally, I have a KPLM policy in place for my monitored servers which runs this script every 12 hours to actively identify changes to Exchange services or versioning.

    After running this, you can create views along the lines of "Exchange - Active - 2010" (and then other views for other versions or inactivity) using the Advanced agent data filter.

    Then, you can put a KPLM policy in place that uses these views to apply Exchange version-specific monitoring to servers that fall into the view.

    Overall this seems to be working out great for me.  It reduces the number of false-identifications and incorrect monitoring configurations.

    Hope you all find it useful!  You could even use the logic to expound upon other Windows services and service versions and activity...

  • Thanks, jhardee. Very kind of you to post that. It's not applicable to my situation but I could see where your technique might also be applied to other servers with multiple extent version - like SQL Server for instance. Very nice.

  • Hi jhardee,

    Thanks very much- they way I've done this in the past has been ugly.

    Would you be willing to export the script and paste it here, because it will be a chore for us to recreate your script from the screen grab! Hope I'm not sounding ungrateful.

    Mike

  • Mike,

    I'm glad you find it useful!  Below I have posted .xml with the Identification Script  The only thing I can't do for you is make your custom fields (Exchange and Exchange Version) and create your KPM policies to roll all of this out.  All of this is not perfect and I encourage contributed improvement with re-post, and we all will appreciate anything that the community can contribute in terms of making this better.  I think the Exchange 2010 identification might be reliant on the CAS role being installed, but really, who runs Exchange 2010 without the CAS role installed?  (none of our customers...).  Enjoy!

    Identification script:

      <?xml version="1.0" encoding="utf-8" ?>
    - <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
    - <Procedure name="Identify Exchange Servers" treePres="3" id="481191973" folderId="46191375223195891715111151">
    - <Body description="This script will query Windows services that are specific to certain versions of Microsoft Exchange. It will parse the services and determine the version of Microsoft Exchange running (or not running) on a server and put the version information into custom system fields.">
    - <Statement description="Attempts to return results of a shell command to a global variable '#global:cmdresults#'" name="Execute Shell Command - Get Results to Variable" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="Parameter1" value="sc query | find "Microsoft Exchange"" />
      <Parameter xsi:type="StringParameter" name="Parameter2" value="false" />
      <Parameter xsi:type="StringParameter" name="Parameter3" value="System" />
      </Statement>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="DoesNotContain" />
      <Parameter xsi:type="StringParameter" name="Value" value="Microsoft Exchange" />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange Version" />
      <Parameter xsi:type="StringParameter" name="Value" value="N/A" />
      </Statement>
      </Then>
    - <Else>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange Version" />
      <Parameter xsi:type="StringParameter" name="Value" value="Role Server" />
      </Statement>
      </Else>
      </If>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="Contains" />
      <Parameter xsi:type="StringParameter" name="Value" value="RPC Client Access" />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange Version" />
      <Parameter xsi:type="StringParameter" name="Value" value="2010" />
      </Statement>
      </Then>
      </If>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="Contains" />
      <Parameter xsi:type="StringParameter" name="Value" value="Replication Service" />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange Version" />
      <Parameter xsi:type="StringParameter" name="Value" value="2007" />
      </Statement>
      </Then>
      </If>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="Contains" />
      <Parameter xsi:type="StringParameter" name="Value" value="Routing Engine" />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange Version" />
      <Parameter xsi:type="StringParameter" name="Value" value="2003" />
      </Statement>
      </Then>
      </If>
    - <Statement description="Attempts to return results of a shell command to a global variable '#global:cmdresults#'" name="Execute Shell Command - Get Results to Variable" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="Parameter1" value="sc interrogate msexchangeis" />
      <Parameter xsi:type="StringParameter" name="Parameter2" value="false" />
      <Parameter xsi:type="StringParameter" name="Parameter3" value="System" />
      </Statement>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="Contains" />
      <Parameter xsi:type="StringParameter" name="Value" value="RUNNING" />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange" />
      <Parameter xsi:type="StringParameter" name="Value" value="Active" />
      </Statement>
      </Then>
      </If>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="Contains" />
      <Parameter xsi:type="StringParameter" name="Value" value="The service has not been started." />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange" />
      <Parameter xsi:type="StringParameter" name="Value" value="Inactive" />
      </Statement>
      </Then>
      </If>
    - <If description="">
    - <Condition name="CheckVariable">
      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:cmdresults#" />
      <Parameter xsi:type="EnumParameter" name="Condition" value="Contains" />
      <Parameter xsi:type="StringParameter" name="Value" value="The specified service does not exist" />
      </Condition>
    - <Then>
    - <Statement description="Update the selected System Info field with the specified value for the agent this procedure runs on." name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
      <Parameter xsi:type="StringParameter" name="ColumnName" value="Exchange" />
      <Parameter xsi:type="StringParameter" name="Value" value="N/A" />
      </Statement>
      </Then>
      </If>
      </Body>
      </Procedure>
      </ScriptExport>

     

     

     

  • Thanks very much

    We look after one install where the roles are separated, but I will definitely start from your script when I work on this.

  • If you could reply, and select RICH FORMATING (on the lower left when you click reply), you'll have an option on the top to attach a file, and you can attach the XML directly. I'd appreciate it if you'd do that, as cutting and pasting your XML that you posted above results in errors when I try. I'd like to use this script!

    Thx

  • Hi David - you can also copy and paste the xml into a notepad file. Then do a search/replace. Search for:

    - <

    Replace it with

    <

    Then copy and paste the results into the procedure. That should fix it up...

  • I tried that... still getting errors. Can someone post this properly?

  • Procedure Identify Exchange Servers.xml

    Here's the file

  • Thanks for posting. Works perfectly!

  • Thank you for posting this works great!

  • Amazing, thanks!

  • You could combine the two Custom Fields by making single Custom Field called "Machine Roles" and make the script figure out if Exchange is "active" or not, so that if it is not active it won't write anything to the Custom Field.

    You can also make it write a tag with the version in the Custom Field (Exch2003, Exch2007, Exch2010 etc...) and then you can re-use this "Machine Roles" Custom Field for other roles like for Backup, Database, Web server and etc...

  • Any update to identify Exchange 2013?

    Thanks!

  • Procedure Exchange- Get Build Number.xml

    Here you go.



    Added CU5 (Released May 27th)
    [edited by: SMason at 4:19 PM (GMT -7) on Jun 2, 2014]