Author Posts

March 21, 2017 at 2:22 pm

Hi,

I was surprised to find, when doing a Test-Path check on UNC paths, that the result PowerShell gave was case-sensitive. The paths I'm testing are on a Nexenta storage device. Does the type of device or some response from the device affect the results of Test-Path?

Thanks,
Joel

March 21, 2017 at 2:45 pm

Yeah. The command just asks the file system if the path exists. If the file system cares about case, then it acts accordingly. Most *nix file systems are case sensitive.

March 21, 2017 at 3:11 pm

Thanks, Don. Good to know, though even better to know would be how to identify if the file system a path uses is *nix or not. I don't see that Get-Item returns anything that would shed light on this.

March 21, 2017 at 3:14 pm

The file systems actually have no interface for revealing that. And it's more nuanced because, for example, some Linux SMB layers abstract it and remove case sensitivity.

You could easily write a simple test tho. Just test for a known existing path using lowercase and uppercase. If both return true then it isn't sensitive. If only one returns true then it is.