Forum Discussion
Dfs Namespace folder properties error using powershell
LainRobertson
Thank you so much for your quick response.
however, I am still getting the same error after adding the double quotes.
get-dfsnroot : Cannot get DFS folder properties on "\\\-DFS"
At C:\install\DFS1.ps1:393 char:8
+ if(get-dfsnroot -path "\\$DomainShort\$DFSRootName-DFS" | get-dfs ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_DFSNamespace:ROOT\Microsoft\...FT_DFSNamespace) [Get-DfsnRoot], CimException
+ FullyQualifiedErrorId : Windows System Error 87,Get-DfsnRoot
get-dfsnroot : One or more parameter values passed to the method were invalid.
At C:\install\DFS1.ps1:393 char:8
+ if(get-dfsnroot -path "\\$DomainShort\$DFSRootName-DFS" | get-dfs ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_DFSNamespace:ROOT\Microsoft\...FT_DFSNamespace) [Get-DfsnRoot], CimException
+ FullyQualifiedErrorId : MI RESULT 4,Get-DfsnRoot
Okay, if you're running the following within both those lines and still getting that error then that means the $DomainShort and $DFSRootName variables are set to $null (or an empty string).
get-dfsnroot -path "\\$DomainShort\$DFSRootName-DFS"
As the error clearly states that what you're passing in via the "-path" parameter is a string value of "\\\-DFS".
Cheers,
Lain
- VinodkumarloharDec 04, 2023Copper Contributor
Here "abc" is the user input value which should be store in the $DFSRootName
so after execute the script it will create the path of namespace \\domainName\abc-DFS.
.DESCRIPTION
The script if for: Creating DFS roots in sites and for ABC roots for domain.
Installation Log will be created in C:\Install folderExample usage:
.\DFSroot.ps1 - It will create DFS root for site parsed from server hostname- e.g:
Executed on server: dc.net will create abc-DFS root.\DFSroot.ps1 ABC - It will create DFS root ABC-DFS
- LainRobertsonDec 04, 2023Silver Contributor
Error 87 is LDAP_FILTER_ERROR.
I'm unable to even begin to guess as to why you're receiving that.
But as I say, the bigger initial issue appears to be the string being passed in via "-path", as "\\\-DFS" is never going to work.
Cheers,
Lain
- VinodkumarloharDec 04, 2023Copper ContributorIs it possible to conclude this script by specifying the exact permissions needed, ensuring its compatibility to run in any domain environment for the creation of a namespace?
- LainRobertsonDec 04, 2023Silver Contributor
That might be how it's designed, but that's not how things are working for you at the moment. It's also worth pointing out that your call to New-DfsnRoot uses a different variable for the namespace, so if you're expecting the Get-DfsnRoot to find the same object, it won't unless $ComputerName equals $DomainShort.
Anyhow, based on the error text from calling "get-dfsnroot", those variables are empty or null.
Funnily enough though, when I try and reproduce the error, I get a different error code. I get an error 1722 (pictured below) while you're getting an 87, which implies something else is going on for you as well. But the first issue to solve is why you are passing in a string of "\\\-DFS".
Perhaps have a look at your log file and see if the line previous to "get-dfsnroot" is logging a value for $DFSRootName, as my assumption is that it will be null/empty in that logging line as well.
Cheers,
Lain