So here is my script:
$Checks = Get-WmiObject -Namespace root\microsoftdfs -Class dfsrreplicatedfolderinfo|Select State,ReplicatedFolderName
Foreach($Check in $Checks)
{
$Name = ($Check).ReplicatedFolderName
if(($Check).State -eq 5)
{
Echo “2 DFS-State - Replicationfolder ‘$Name’ DFS State is degraded.”
}
elseif (($Check).State -eq 3)
{
Echo “1 DFS-State - Replicationfolder ‘$Name’ DFS State is in Auto Repair.”
}
elseif (($Check).State -eq 2)
{
Echo “1 DFS-State - Replicationfolder ‘$Name’ DFS is in initial Sync.”
}
else
{
echo “0 DFS-State - Replicationfolder ‘$Name’ DFS State is fine.”
}
}
The script works fine and checkmk is discovering the Service. My Problem is it is just showing the first Output of the Script and not all the other ones as another Service.
Anyone able to help?