Monitoring with PowerShell: Monitoring DFSR status

There were a couple of projects I was working on, one of them being a method to upload intune applications to all tenants in a CSP. Turns out that someone else already made that so I won’t be blogging about it directly. If your interested in that you can check out this link. This did swallow most of my time, so instead I figured I’d publish a smaller blog today.

So instead we’re going to focus on monitoring something else entirely; DFS Replication. DFS is somewhat dated when compared to cool new tech like Azure File Sync, and others like that but still used in a lot of environments. Even in our move to cloud only environments I still think we have a handful of DFS servers running.

This small script will assist you in finding DFS machines that are having an increased backlog, connection issues, or folder issues.

$MaxBackLog = "100"
$DFSFiles = Get-DfsrState
$DFSBackLogHealth = if ($DFSFiles.count -gt $Maxbacklog) { "There are more than $Maxbacklog in the backlog" } else { "Healthy" }

$connections = Get-DfsrConnection | Where-Object {$_.state -ne  'normal'}
$DFSConnectionHealth = if($Connections) { "Fault connections found. Please investigate" } else { "Healthy" }


$Folders = Get-DfsReplicatedFolder | Where-Object {$_.state -ne  'normal'}
$DFSFolderHealth = if($Folders) { "Faulty folder found. Please investigate" } else { "Healthy" }

I know it’s a little shorter than my normal blogs. I just couldn’t find a new cool subject to talk about. If you have any suggestions please let me know. I’m still doing requests 🙂

1 thought on “Monitoring with PowerShell: Monitoring DFSR status

  1. Charly

    Hi,

    I am looking for a powershell script to use in a RMM in order to get information of a specific KB if it is installed or missing.

    What i would like to do:
    put 2 KB number in the script and get the result if they are installed or not on the device targeted.

    Thanks for all your hard work and your information sharing!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.