This project is read-only.
1
Vote

Get-DFSRoot returns incorrect and extra information

description

With PowerShell 3.0 on Windows 7, dfsutl returns the following information which is parsed incorrectly by Get-DFSRoot.
[DBG]: PS C:\Windows\system32>> $return
Domain Root with 237 Links [Blob Size: 134954 bytes]


Root Name="\MYCOMPANY\TEAMWZ" Comment="My Company namepace files structure for all jobsites and home office." State="OK" Timeout="300"
SITECOSTING = "1" ROOTSCALABILITY = "1" TARGETFAILBACK = "1" 
Target="\\WZ-FAR-FS1\TEAMWZ" State="ONLINE"  [Site: WZ-FAR]


Link Name="Projects\727 - Some Project Name" State="OK" Timeout="1800" 
    Target="\\WZ-FAR-FS1\SomeShareName\Projects\727 - Some Project Name" State="ONLINE"  [Site: WZ-FAR]
....

The blob size is being returned as the "links" which is incorrect. The split statement to return the links should be $objreturn.links = $return[0].split(" ")[3]

Matching the target in the if statement also matches the line before (specifically SITECOSTING = "1" ROOTSCALABILITY = "1" TARGETFAILBACK = "1" ). The statement $lineNo = 4 should be changed to $lineNo = 5 to prevent the extra line being erroneously parsed which returns a null-valued expression error and [extra] almost blank record.

Steve

comments