Schneller Weg um in Powershell XML Files zu lesen.
[xml]$books = (Get-Content -Path .\books.xml)
foreach ($item in $books.catalog.book)
{
Write-Output('ID : {0} - AUTOR : {1} - GENRE : {2}' -f $item.id , $item.author , $item.genre)
}
als beispiel xml habe ich
books.xml von microsoft verwendet
Ich hatte ja schon mal einen lokalen Check geschrieben der das ganze mit VBS monitored, jetzt hab ich das alles mal in Powershell übersetzt um auch einen Windows 2019 Server sauber überwachen zu können.
Hier gehts zum Repo :
https://github.com/Mokkujin/Checks-for-Check_MK/tree/main/FSRM-Quotas
Ich hab hier einen kleinen Check in Powershell für Mailstore gebaut. Hier wird ein Job überprüft ob das Ergebnis "succeeded" ist wenn ja ist der Job ok. Sollte etwas anderes als Rückgabewert kommen wird ein Fehler ausgegeben.
In der CheckMK Oberfläche sieht das ganze dann so aus:
Hier gehts zum github Repo :
https://github.com/Mokkujin/Checks-for-Check_MK
Quelle:
https://help.mailstore.com/de/server/PowerShell_API-Wrapper_Tutorial
https://help.mailstore.com/en/server/MailStore_Server_Service_Configuration
https://help.mailstore.com/de/server/Administration_API_-_Function_Reference
$ParaSetDis = @{
Identity = 'DISTRIBUTION-LIST-NAME'
WhatIf = $true
}
Set-DistributionGroup @ParaSetDis -EmailAddresses @{Add=
'EMail-Address-Alias1',
'EMail-Address-Alias2',
'EMail-Address-Alias3'}