How to create a DFSNfolder with no target in PowerShell

TLDR; to create an empty dfsnfolder you must create a dfsnfolder with a target underneath

I spent way too much time banging my head on this one. What I’m trying to do is automate DFS deployments on servers, so naturally I want to create DFSNfolders without targets in them so I can have a fancy-looking structure. The outcome should look something like this…

img 563fff5ee9db0

 

One would think that to accomplish this, the command in powershell would be :

new-dfsnfolder -path “$clientnamespace\FolderRedir\” -target none

Unfortunately there is no command like the one above. The only way to create a empty dfsnfolder is to create a structure underneath it.

So to do it the solution would look something like this.

new-dfsnfolder -path “$clientnamespace\FolderRedir\$facilityname” -target “\\$fileserver\dfsdata$\folderredir\$facilityname”

With the above command I get a DFSNfolder called FolderRedir that is empty, however the folder that will be created underneath will have a target.

This is the outcome of the command above if $facilityname = hillside

img 56400100ac74d

 

 

Leave a comment