none
Write-DfsrHealthReport with Variables RRS feed

  • Question

  • 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
    Thursday, April 30, 2015 4:40 PM

Answers

  • 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
    Thursday, April 30, 2015 6:46 PM

All replies

  • What's the purpose of creating a PSObject?


    -- Bill Stewart [Bill_Stewart]

    Thursday, April 30, 2015 5:15 PM
    Moderator
  • Create an array.  I'll be adding more servers with multiple properties for testing such as DFS02, DFS03, etc.
    Thursday, April 30, 2015 5:42 PM
  • 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
    Thursday, April 30, 2015 6:46 PM