ei00004
asked on
icacls syntax to list only folders that has a specific group and it's permissions to that folder.
I need to know the icacls syntax that will list only the folders that a specific group and the groups permissions to that folder. For example, I already have
[icacls C:\*. /findsid "domain\group" /t /c"] this will list only the folders that "domain\group" has access to. But I also need to be able to list the permission that group has on the folder.
What would be even better, if there is icacls syntax that would only list the folder if the "domain\group" has a specific permissions. For Example, only list the folder C:\temp for "domain\group" if it's permission on the folder is modify
[icacls C:\*. /findsid "domain\group" /t /c"] this will list only the folders that "domain\group" has access to. But I also need to be able to list the permission that group has on the folder.
What would be even better, if there is icacls syntax that would only list the folder if the "domain\group" has a specific permissions. For Example, only list the folder C:\temp for "domain\group" if it's permission on the folder is modify
ASKER
Thanks, I'll test it.
ASKER
Ok your script does work, it will list all files and folders with the perms based on the "domain\user". Would it be possible for you to modify this script to only list folders and not files?
sure.
$dirs = dir c:\scripts -Directory
foreach( $dir in $dirs )
{
icacls $dir.FullName /findsid admin-dell\michael /c | % {
if( $_.StartsWith( 'SID Found: ' ) )
{
icacls $dir.FullName
}
}
}
ASKER
This works great! Just one little change, is there a way to make it also scan the sub-folders?
ASKER
But not the files?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! Thank you sir!
Open in new window
You can use a variation on this technique to do your other request (save the result from the second icacls into a temp file and only output it if you find your desired string in the output file).