# Centreon Exchange monitoring

**URL:** <https://community.icinga.com/t/centreon-exchange-monitoring/6827>\
**Category:** Service Monitoring\
**Tags:** centreon, icinga2\
**Created:** [March 2, 2021, 9:00am UTC](https://community.icinga.com/t/centreon-exchange-monitoring/6827 "2021-03-02T09:00:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bouglax](https://community.icinga.com/letter_avatar_proxy/v4/letter/b/6de8d8/32.png) [@bouglax](https://community.icinga.com/u/bouglax)\
**Post date:** [March 2, 2021, 9:00am UTC](https://community.icinga.com/t/centreon-exchange-monitoring/6827/1 "2021-03-02T09:00:38Z")

</div>

Hi guys,

I’m trying to use the Centreon Exchange plugin to monitor our Exchange servers, but the checks I’ve configured so far return “$ENV{ExchangeInstallPath} is undefined. Please install PowerShell extensions for Exchange”, but there isn’t much out there for people experiencing this error, so I’m a little stuck and hoping someone can help me out here.

My check command is:

```
object CheckCommand "check_exchange" {
    import "plugin-check-command"
    command = [PluginDir + "/centreon-plugins-master/centreon_plugins.pl",]
    arguments = {
        "--plugin" = "apps::exchange::2010::local::plugin"
        "--mode" = "$check_mode$"
        "--remote-host" = "$address$"
        "--critical" = "$critical$"
        "--warning" = "$warning$"
        "--remote-user" = "$user$"
        "--remote-password" = "$userpass$"
        "--command" = "powershell.exe; Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn"
        "--ps-display" = "--ps-display"
    }
}

```

I’ve tried a few variations upon the command - originally it was just “powershell.exe”, I tried this one, and I’ve also tried a much longer and more convoluted one to import the modules manually. All three yield the same results, so I’m pretty confused by now.

My check is defined as follows, but I think it’s pretty safe to assume that

```
apply Service "Centreon Exchange Replication" {
  import "check_exchange"
  vars.check_mode = "replication-health"
  vars.warning = "8"
  vars.critical = "10"
  assign where "exchange-servers" in host.groups
}

```

Could somebody point out where I’m going wrong here please?

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![0xliam](https://community.icinga.com/user_avatar/community.icinga.com/0xliam/32/1513_2.png) [@0xliam](https://community.icinga.com/u/0xliam)\
**Post date:** [March 2, 2021, 11:46am UTC](https://community.icinga.com/t/centreon-exchange-monitoring/6827/2 "2021-03-02T11:46:19Z")

</div>

If you open a PS shell and type `$env:exchangeinstallpath` does it return a value?

It looks like that plugin is looking for that environment variable to be set.

---

<div class="post-metadata">

**Author:** ![bouglax](https://community.icinga.com/letter_avatar_proxy/v4/letter/b/6de8d8/32.png) [@bouglax](https://community.icinga.com/u/bouglax)\
**Post date:** [March 4, 2021, 1:33pm UTC](https://community.icinga.com/t/centreon-exchange-monitoring/6827/3 "2021-03-04T13:33:43Z")

</div>

Thanks Liam, getting that variable does work (at least for me).

Running the command defined in the check command as myself on the Windows box also works, and I can then run Exchange Powershell commands, but I’m drawing a blank on testing the same functionality with our Icinga WMI service account because it seems not to be allowed to open a Powershell session (when I try doing start powershell -credential “”)

Thoughts and next steps would be much appreciated 🙂
