List DFS replication groups:

dfsradmin rg list

List replicated folders in a replication group:

dfsradmin rf list /rgname:<REPL_GROUP>

List members of a replication group:

dfsradmin mem list /rgname:<REPL_GROUP>

List the local folders that correspond to replicated folders of a replication group:

dfsradmin membership list /rgname:<REPL_GROUP> /attr:RfName,MemName,LocalPath

Show backlog between 2 members of a replication group:

dfsrdiag backlog /rgname:<REPL_GROUP> /rfname:<REPL_FOLDER> /smem:<SRV_A> /rmem:<SRV_B> [/v]
dfsrdiag backlog /rgname:<REPL_GROUP> /rfname:<REPL_FOLDER> /smem:<SRV_B> /rmem:<SRV_A> [/v]

dfsrdiag can also be used for inspecting SYSVOL backlog when DFS-R SYSVOL replication is enabled:

dfsrdiag backlog /rgname:"Domain System Volume" /rfname:"SYSVOL Share" /smem:DC1 /rmem:DC2

A word of warning if you want to run commands like the one above in PowerShell: parameters with spaces are a major pain in the rear. Naïve approaches like

& dfsradmin rf new /rgname:MyGroup /rfname:"My Replicated Folder"


& dfsradmin rf new /rgname:MyGroup "/rfname:My Replicated Folder"


& dfsradmin rf new /rgname:MyGroup "/rfname:`"My Replicated Folder`""

or even

$cmd    = 'dfsradmin.exe'
$params = @('rf', 'new', '/rgname:MyGroup', '/rfname:"My Replicated Folder"')
& $cmd $params

won’t work, regardless of what recommendations you may find on the Internet. You need to work around this issue like this:

$env:rgname = 'MyGroup'
$env:rfname = 'My Replicated Folder'

& cmd /c 'dfsradmin rf new /rgname:%rgname% /rfname:"%rfname%"'

or (slightly more PoSh) like this:

$rgname = 'MyGroup'
$rfname = 'My Replicated Folder'

& cmd /c ("dfsradmin rf new /rgname:{0} /rfname:`"{1}`"" -f $rgname, $rfname)

In PowerShell v3 you could also do this:

$env:rgname = 'MyGroup'
$env:rfname = 'My Replicated Folder'

& dfsradmin --% rf new /rgname:%rgname% /rfname:"%rfname%"

Credit to “Six Demon Bag”

First start by forcing the creation of your PowerShell ISE profile file if it doesn’t exist

if (!(Test-Path -Path $PROFILE ))&amp;lt;br&amp;gt;&lt;br&gt;<br>
{ New-Item -Type File -Path $PROFILE -Force }

Second, within your ISE console, type the following

psEdit $profile

In the script pane, just copy/paste the below blue script

$StopWatch = [System.Diagnostics.StopWatch]::StartNew()

Function Test-Command ($Command)




Get-command $command -ErrorAction Stop

Return $True


Catch [System.SystemException]


Return $False



IF (Test-Command "Get-Mailbox") {Write-Host "Exchange cmdlets already present"}

Else {

$CallEMS = ". '$env:ExchangeInstallPath\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell "

Invoke-Expression $CallEMS

$msg = "`n`nThe script took $([math]::round($($StopWatch.Elapsed.TotalSeconds),2)) seconds to execute..."
Write-Host $msg
$msg = $null
$StopWatch = $null

#Add Exchange snapin if not already loadedif (!(Get-PSSnapin | where {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"}))


Write-Verbose "Loading the Exchange snapin"

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue

. $env:ExchangeInstallPath\bin\RemoteExchange.ps1

Connect-ExchangeServer -auto -AllowClobber

script by Paul Cunnigham.
Removes spam from exchange 2010 with powershell. Creates a log file in G:\s\Logs\exchange\  Edit the $spam var. Use “from:$spam” for From and “subject:$spam” for Subject.  
$spam = "pravinchauhan1991@yahoo.in"

$today = (get-date).tostring("MM-dd-yyyy")

$ExDBs = "db04","db08","db12","db16","db20","db24","db28"
Foreach($ExDB in $ExDBs)

#Defines source and destination
$outfile = 'G:\s\Logs\exchange\SpamCleanUp_' + $today + '_' + $spam + '_' + $ExDB + '.txt'
Get-mailbox -database $ExDB -resultsize unlimited | search-mailbox –searchquery “from:$spam” -LogLevel Full -TargetMailbox discovery -TargetFolder inbox -DeleteContent -force | ft displayname, resultitemscount, resultitemssize >> "$outfile"