banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Active Directory

banshee/active-directory-collection/active-directory/winrm/

sysvol

The DFS Replication state of SYSVOL on a domain controller and its last error, by WinRM and PowerShell

  • active-directory
  • domain-controller
  • sysvol
  • dfsr
  • winrm
  • powershell

by banshee1 installation2 versions

v2Latest

Published on October 28, 2026. One naming convention across collections; documentation completed.

Keen 1.0.0 · 46 lines
// The DFS Replication of SYSVOL on a domain controller, by WinRM: the state of the replicated folder of the
// replication group "Domain System Volume", and the last error DFS Replication noted on it.
// Runs one PowerShell script that only reads the WMI class DfsrReplicatedFolderInfo (namespace
// root\MicrosoftDfs), which Microsoft documents: ReplicationGroupName, ReplicatedFolderName, State and
// LastErrorCode. State is a number that Microsoft names: 0 Uninitialized, 1 Initialized, 2 Initial Sync,
// 3 Auto Recovery, 4 Normal, 5 In Error.
// The backlog is not read: it is counted against the version vector of each partner, read on the partner
// itself, which a remote session cannot reach with the credentials of the account.
// The script is the one of active-directory/ssh/sysvol, without the powershell -Command "..." that cmd.exe
// needs there.
need('protocol:winrm');

output('state', 'text', array('label' => 'State'));
output('last-error', 'number', array('label' => 'Last error'));

watch.state('not-normal', 'SYSVOL not replicating', 'state', array(
    'warning' => array('uninitialized', 'initialized', 'initial-sync', 'auto-recovery'),
    'critical' => array('in-error'),
));

$read = winrm.run("$ErrorActionPreference = 'Stop'; "
    . "[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding; "
    . "ConvertTo-Json -Compress -Depth 4 -InputObject @{"
    . "folders = @(Get-CimInstance -Namespace root/MicrosoftDfs -ClassName DfsrReplicatedFolderInfo"
    . " | Where-Object ReplicationGroupName -eq 'Domain System Volume'"
    . " | Select-Object ReplicatedFolderName, State, LastErrorCode)}");
$answer = text.trim($read['output']);
if (list.count(text.match($answer, '^\{')) == 0) {
    fail('misconfigured', 'PowerShell did not return the DFS Replication of SYSVOL', $answer . $read['errors']);
}
$dfsr = json.read($answer);
if (list.count($dfsr['folders']) == 0) {
    fail('misconfigured', 'SYSVOL is not replicated by DFS Replication on this domain controller', $answer);
}

$states = array(
    '0' => 'uninitialized',
    '1' => 'initialized',
    '2' => 'initial-sync',
    '3' => 'auto-recovery',
    '4' => 'normal',
    '5' => 'in-error',
);
$folder = $dfsr['folders'][0];
value('state', list.get($states, $folder['State'], 'unknown'));
value('last-error', $folder['LastErrorCode']);