When execute this script the text is not displayed. Instead PRTG shows "Ung�ltige Eingabe".
How do i show the Exchange Version?
<# =================================================================================== Paessler PRTG Sensor to check Exchange Server Version =================================================================================== Autor: Stefan Redlin Script: CheckExchangeVersion.ps1 Version: 1.0 Date: 26.04.2019 Environment: Windows Server 2016/Exchange2016 Scriptpath: C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML Scripttype: EXE/Script Advanced #> $result = Invoke-Command -ComputerName EX-01 {$query = Get-Command Exsetup.exe | select Version $query} $Version = $result.version.ToString() $output= switch ($Version){ 15.1.225.16 {"Exchange Server 2016 Preview"} 15.1.225.42 {"Exchange Server 2016 RTM"} 15.1.396.30 {"Exchange Server 2016 Cumulative Update 1 (CU1)"} 15.1.466.34 {"Exchange Server 2016 Cumulative Update 2 (CU2)"} 15.1.544.27 {"Exchange Server 2016 Cumulative Update 3 (CU3)"} 15.1.669.32 {"Exchange Server 2016 Cumulative Update 4 (CU4)"} 15.1.845.34 {"Exchange Server 2016 Cumulative Update 5 (CU5)"} 15.1.1034.26 {"Exchange Server 2016 Cumulative Update 6 CU6"} 15.1.1261.35 {"Exchange Server 2016 Cumulative Update 7 (CU7)"} 15.1.1415.2 {"Exchange Server 2016 Cumulative Update 8 (CU8)"} 15.1.1466.3 {"Exchange Server 2016 Cumulative Update 9 (CU9)"} 15.1.1531.3 {"Exchange Server 2016 Cumulative Update 10 (CU10)"} 15.1.1591.01 {"Exchange Server 2016 Cumulative Update 11 (CU11)"} 15.1.1713.5 {"Exchange Server 2016 Cumulative Update 12 (CU12)"} default {"Ungültige Eingabe"} } Write-Host @" <prtg> <result> <channel>Exchange Version</channel> <value>0</value> </result> <text>$output</text> </prtg> "@
Output looks like
<prtg> <result> <channel>Exchange Version</channel> <value>0</value> </result> <text>Exchange Server 2016 Cumulative Update 6 CU6</text> </prtg>
Add comment