Tag Archives: permissions

List directories where object have explicit permissions set.

Today I got a case from a user who wanted to know which directories that would be effected if he deleted a security group. This is a typical case that that often end up on second or third-line, therefor I wrote a function so that help-desk easily can do it the next time a user adds a similar case. First it lists all sub directories of the  path specified, it then uses a foreach loop  to find out if the object specified exists in  the IdentityReference property and list the pspath. since pspath includes “Microsoft.PowerShell.Core\FileSystem::” when you try to export to csv i had to do a replace with nothing to get a clean path. when trying to replace i got an error “The regular expression pattern”…”is not valid”  since there is a “\” and -replace parses the string as an regular expression you need to escape it by putting another “\” in front of it. I made the export to file so my colleagues would get a file to mail to the user.