Solved

Script to display explicit NTFS perm assignments

Posted on 2008-06-26
3
312 Views
Last Modified: 2013-12-04
Does anyone have a script (preferably a VB script) that I can run on a Windows Server 2003 that will prompt for a user name or group name and then print a list of every folder and file where that user or group has an explicit NTFS permissions assignment?

You would be king (or Queen as the case may be)
0
Comment
Question by:santaspores1
  • 2
3 Comments
 

Author Comment

by:santaspores1
ID: 21877877
Or.. maybe you know of an app that does this.  Not AccessEnum though - I want something that is user/group oriented.  AccessEnum just lets you point to a folder and lists the perms on that folder.  I want to enter a user and group and know ALL of the folders and files that user/group has EXPLICIT perm assignments for...
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 21879405
Here is a batch script which should accomplish what you want.

Paste the script below into a text file with a .cmd extension.  Customize the value of the "root" variable with the directory to search under.  Running the script will prompt for the user or group name and then echo back any files or folders with explicit permissions set.


@echo off

setlocal enabledelayedexpansion
 

set root=d:\files
 

echo Enter the user or group name to search for, e.g. YOURDOMAIN\jdoe

set /P name=Name: 
 

for /F "tokens=*" %%G in ('dir "%root%" /B /S') do (

 for /F "tokens=*" %%H in ('cacls "%%G"') do (

  set output=%%H

  set output=!output:*%name%=FOUND!

  if "!output:~0,5!"=="FOUND" echo %%G

 )

)
 

pause

Open in new window

0
 

Author Closing Comment

by:santaspores1
ID: 31471045
You rock!  Thanks ever so much Shift!
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
Users of Windows 10 Professional can disable automatic reboots using the policy editor. This tool is not included in the Windows home edition. But don't worry! Follow the instructions below to install (a Win7) policy editor on your Windows 10 Home e…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now