Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

Script to display explicit NTFS perm assignments

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
santaspores1
Asked:
santaspores1
  • 2
1 Solution
 
santaspores1Author Commented:
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
 
Shift-3Commented:
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
 
santaspores1Author Commented:
You rock!  Thanks ever so much Shift!
0

Featured Post

Cyber Threats to Small Businesses (Part 2)

The evolving cybersecurity landscape presents SMBs with a host of new threats to their clients, their data, and their bottom line. In part 2 of this blog series, learn three quick processes Webroot’s CISO, Gary Hayslip, recommends to help small businesses beat modern threats.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now