Small script to determine the Exchange Server status

In this article there is once again a small script that can display the status of important Exchange parameters. The script clearly shows the status of the databases, queues, services and storage space. So you can get a first quick overview of the Exchange status in case of problems. The script can be downloaded from GitHub:

I run the script directly when starting the Exchange Shell, so the start of the shell takes a little longer, but I have a direct overview of the most important parameters. This is what the start of the Exchange Shell looks like on my test Exchange Server:

Small script to determine the Exchange Server status

For example, if one of the Exchange services is not running, I get the status displayed directly when I start the Exchange Server Management Shell:

Small script to determine the Exchange Server status

To run the script directly when starting the Management Shell, you only need to adjust the shortcut in the Start menu. To do this, the location of the shortcut must be opened from the Start menu:

Edit link

The target of the link can now be edited:

Edit link

In the default setting, the target of the link looks something like this:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'D:\Exchange Server\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell"

At the end you can now simply append the script that is to be executed when the shell is started:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'D:\Exchange Server\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell; . 'C:\Install\Get-ExchangeStatus.ps1'"

When adding the status scripts, the syntax must be observed: Semicolon, followed by a period and the path in apostrophe. Of course, the script can also be executed manually. The following command can be used for this:

.\Get-ExchangeStatus.ps1
Small script to determine the Exchange Server status

You are welcome to send me your suggestions as to which data you would like to see at first glance, as the script can be extended as required. You can also contribute directly on GitHub.

11 thoughts on “Kleines Script um den Exchange Server Status zu ermitteln”

  1. Hallo ,

    ich bekomme beim ausführen des Scriptes folgende fehler Meldung : The File C:\…….Get-ExchangeStatus.ps1 is not digitally signed. You cannot run this script on the current system.

    Danke im Vorfeld für die Hilfe

    Reply
  2. Hy ,

    ich würde gerne den Inhalt in eine Datei umleiten oder als Mail verschicken.
    Die foreach abfragen bekomme ich nicht geschrieben.

    hat einer eine Lösung dafür ?

    VG

    Sascha

    Reply
  3. Hallo Franky,

    wäre es viel Aufwand in dem Script die Ausgabe der aktuell installierten Version mit auszugeben?

    Reply
  4. Moin Frank,

    erstmal danke für das Skript ;)
    Beim Ausführen auf einer 2-Knoten-DAG bekomme ich nicht ganz schlüssige Ergebnisse.
    Ist das Skript nur für Standalone-Exchange-Server gedacht?

    Danke und Gruß
    Bent

    Reply
  5. bei mir ptasselt esd nur von Fehlermeldungenm was mache ich da falsch, hier ein ausschnitt:
    PS] C:\temp>./Get-ExchangeStatus.ps1
    In C:\temp\Get-ExchangeStatus.ps1:202 Zeichen:17
    + Sign up
    + ~
    Das kaufmännische Und-Zeichen (&) ist nicht zulässig. Der &-Operator ist für eine zukünftige Verwendung reserviert.
    Verwenden Sie das kaufmännische Und-Zeichen in doppelten Anführungszeichen („&“), um es als Teil einer Zeichenfolge zu
    übergeben.
    In C:\temp\Get-ExchangeStatus.ps1:207 Zeichen:209
    + … k Button–medium Button d-lg-none color-fg-inherit p-1″> <span cla …
    + ~
    Der Operator "<" ist für zukünftige Versionen reserviert.
    In C:\temp\Get-ExchangeStatus.ps1:425 Zeichen:13
    + CI/CD & Automation
    + ~
    Das kaufmännische Und-Zeichen (&) ist nicht zulässig. Der &-Operator ist für eine zukünftige Verwendung reserviert.
    Verwenden Sie das kaufmännische Und-Zeichen in doppelten Anführungszeichen ("&"), um es als Teil einer Zeichenfolge zu
    übergeben.
    In C:\temp\Get-ExchangeStatus.ps1:1364 Zeichen:96
    + … ="" data-disable-with="" data-dropdown-tracking="{"type":&q …
    + ~
    Das kaufmännische Und-Zeichen (&) ist nicht zulässig. Der &-Operator ist für eine zukünftige Verwendung reserviert.
    Verwenden Sie das kaufmännische Und-Zeichen in doppelten Anführungszeichen ("&"), um es als Teil einer Zeichenfolge zu
    übergeben.
    In C:\temp\Get-ExchangeStatus.ps1:1364 Zeichen:103
    + … a-disable-with="" data-dropdown-tracking="{"type":"blo …
    + ~
    Das kaufmännische Und-Zeichen (&) ist nicht zulässig. Der &-Operator ist für eine zukünftige Verwendung reserviert.
    Verwenden Sie das kaufmännische Und-Zeichen in doppelten Anführungszeichen ("&"), um es als Teil einer Zeichenfolge zu
    übergeben.
    In C:\temp\Get-ExchangeStatus.ps1:1364 Zeichen:146
    + … "type":"blob_edit_dropdown.more_options_click",&q …
    + ~
    Das kaufmännische Und-Zeichen (&) ist nicht zulässig. Der &-Operator ist für eine zukünftige Verwendung reserviert.
    Verwenden Sie das kaufmännische Und-Zeichen in doppelten Anführungszeichen ("&"), um es als Teil einer Zeichenfolge zu
    übergeben.
    In C:\temp\Get-ExchangeStatus.ps1:1364 Zeichen:153
    + … type":"blob_edit_dropdown.more_options_click","co …
    + ~
    Ausdruck fehlt nach dem unären Operator ",".
    In C:\temp\Get-ExchangeStatus.ps1:1364 Zeichen:153
    + … ype":"blob_edit_dropdown.more_options_click","con …
    + ~
    Unerwartetes Token "&" in Ausdruck oder Anweisung.
    In C:\temp\Get-ExchangeStatus.ps1:1364 Zeichen:166
    + … ot;blob_edit_dropdown.more_options_click","context":{& …

    Reply
  6. Skripte, die auch korrekte Zustände ausgeben, im Autostart(!) sind mMn gefährlich: man gewöhnt sich sehr schnell daran, dass da eine Menge Text durchrauscht, und schaut gar nicht mehr richtig hin… (bei uns müsste ich z.B 21 DBs in 6 Volumes und in einer DAG sowie drei Knoten prüfen, das wären dann mehrere Seiten Text :-O )

    Ausgaben sollten mE nur im WARN oder CRIT Fall erfolgen: dann fallen sie sofort auf ;-) Und ganz streng genommen sollte man eigentlich ein ordentliches Monitoring haben: wer Exchange betreibt hat ja mindestens auch ein AD, und dann ist man eigentlich schon an dem Punkt, dass man seine Infrastruktur überwachen sollte :-)

    Ich habe übrigens schon länger ein eigenes Startskript für die EMS, weil ich es immer schon doof fand, dass die Default-EMS eine Remote-PS-Verbindung zum lokalen Server aufbaut: das erschwert die Auswertung von Exceptions in eigenen Skripten deutlich.

    Reply
  7. Hi Frank,

    die Idee find ich super, überhaupt haben mir deine Skripts schon oft das Leben erleichtert. Kurze Frage zu diesem: Kann ich das auch mit einer Exchange Shell auf einer Client Workstation verwenden, oder muss das zwingend auf dem Exchange selbst ausgeführt werden?

    Reply

Leave a Comment