How to Check the Directory Permission recursively

Here’s a handy script that will check the folder permission on a directory recursively using the Windows PowerShell.

 Get-ChildItem -Recurse | where-object {($_.PsIsContainer)} | get-acl | format-list

First I used the Get-ChildItem command. The Get-ChildItem will works like a dir command in DOS. The -Recurse option will give you the File structure recursively. So, if you have a folder inside a folder you can see all the folders belows that folder. The where-object {($_.PsIsContainer)} will make sure only the directory is shown. Without this filter, all the files and folders will show up on your result.

Then, I used the get-acl command. Get-Act with format-list pipe will show you the permission of the folder.

You can then, write the results to a text file as well, like shown below.

 Get-ChildItem -Recurse | where-object {($_.PsIsContainer)} | get-acl | format-list > permission.txt

Then the results will be written to a filer called permission.txt


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s