Write-DfsrHealthReport with Variables

I am trying to create DFSR Reporting running on Windows 2012 R2 against Windows 2008 R2 DFS Servers.

When I run commands individually without variables, they work fine.  When I use variables, it's not working.

ERROR: Cannot retrieve inbound version vectors from this computer.
Inbound backlog calculations cannot be performed because the following error occurred while the reporting mechanism attempted to retrieve version vectors from this member: The parameter is incorrect. Version vectors are used to compare how up-to-date this server is compared to the reference server. If version vectors cannot be processed, then the backlog, if any, cannot be determined.

SERVERS UNAVAILABLE FOR REPORTING:  Cannot connect to reporting DCOM server.

Working command:

#Write-DfsrHealthReport -GroupName Test -ReferenceComputerName srv01 -MemberComputerName srv01, srv02, srv03 -Path D:\Temp

None Working Script:

$RepPath="D:\Temp"
$DFS01 =  New-object PSObject
$DFS01 | Add-Member -Name "Group" -Membertype NoteProperty -Value "Test"
$DFS01 | Add-Member -Name "RefComp" -Membertype NoteProperty -Value "srv01"
$DFS01 | Add-Member -Name "MemComp" -Membertype NoteProperty -Value "srv02, srv03, srv04"

$DFS = @($DFS01)

ForEach ($DFSSrv in $DFS) 
{

#Write-Output of variables are correct

Write-Output -GroupName $DFSSrv.Group -ReferenceComputerName $DFSSrv.RefComp -MemberComputerName $DFSSrv.MemComp -Path $RepPath

#Create Report - not working

Write-DfsrHealthReport -GroupName $DFSSrv.Group -ReferenceComputerName $DFSSrv.RefComp -MemberComputerName $DFSSrv.MemComp -Path $RepPath

}


  • Edited by JT_CP Thursday, April 30, 2015 5:43 PM
April 30th, 2015 4:40pm

Found a work around.....looks like inside the loop doesn't work right, executed it in via powershell.exe.

$Group = $DFSSrv.Group
$Ref = $DFSSrv.RefComp 
$Mem = $DFSSrv.MemComp 

$run = "Write-DfsrHealthReport -GroupName $Group -ReferenceComputerName $Ref -MemberComputerName $Mem -Path $RepPath"

powershell.exe $run

  • Marked as answer by JT_CP Thursday, April 30, 2015 6:46 PM
Free Windows Admin Tool Kit Click here and download it now
April 30th, 2015 6:46pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics