Forum Discussion
Get-ACL , Is there a way to validate the UNC path folder by folder and assigning it to the variable
Joshua King Thank you for taking time to respond to this, I am currently using the same approach. My issue here is . Though the provided path is correct I get the value as false, but later if I try couple of times on same path I get "true", I tried the PSdrive way as well by mapping the path and testing the path, which works the same way. I have tried the Dot notation way as well. This issue is intermediate. Is there an advanced way we can achieve this. if you can provide me info on why I would get "false" that would also narrow my concern.
Thank you in advance
Huh, that is odd. I sometimes have issues when pinging servers that they don't reply on the first echo request (hence I always do a count of 2 just to be sure.)
I don't think I can diagnose the intermittent false negative, but it may be workable to throw in a workaround. If it's working after a couple of attempts you could implement a retry mechanic.
Here's an example from Adam Bertram: https://adamtheautomator.com/create-wait-anything-function-powershell/
And another from Prateek Singh, though this one relies on the command throwing an error: https://ridicurious.com/2019/02/01/retry-command-in-powershell/
Basically, retry say 5 times. If it's still false move onto the next path.