I am trying to write a program to check all links in a dfs-namespace. Sometimes those folders are deleted, but the link is still there. Eg.
mkdir \home1\userb dfscmd /map \\domain.com\home\userb \\server\home1$\userb
“userb” leaves the organisation,
del \server\home1$\userb /sThe link \domain.com\home\userb is still there…pointing to nowhere.
This example is with users, but also applies to data or groupdata, or whatever.
So I want to enumerate, and check all folders/links if they point to existing targets.
get-dfsnroot to find the dfsn-root object. Then something like “EnumerateFolders”, but
get-dfsnroot “\domain.com\home” | gmgives nothing usefull.
get-dfsnfolder could do the trick, but you need a path to the folder (which I do not have yet).
A long time ago, in W2008R2 time, one could do [blockquote]dfscmd /view \domain.com\home /batch[/blockquote], and you receive all dfs-folders. I could still use this, but can I use powershell to find the same info ?
[hr]
This is also an option, but very,very slow if you have a lot of data:
Get-ChildItem -Attributes Reparsepoint -Directory -Path "\\domain.com\home" -Recurse
There is a need for recursion because it is possible to have directories of links in a DFS namespace, eg.
dfscmd /map \domain.com\home\special\userX \server\home2$\userXUnder the home, there is now a directory “special”, with just one dfs-link in it. If it is enumerated with get-childitem without recursion, it does not have the Resparse attribute, and the link in it, is not found.
How can I efficiently enumerate ALL dfs-links in a DFS namespace ? dfscmd can do it, why can’t powershel do it ?