NTFS Stuff v1 – Eng
VBS WSH Script
Authors: Mirko Iodice, Luca Alberti
Tested on: Windows 2000 Server, Windows 2003 Server, Windows 2008 Server, Windows XP Professional, Windows Vista, Windows 7, Internet Explorer 6, Internet Explorer 7, Internet Explorer 8, Mozilla Firefox 3.X
What is NTFS Stuff?
It is hard for a Microsoft System Administrator to keep trace of all changes made to the "logical" structure of a fileserver, so many times we felt the need for a quick and easy tool that could help us to locate those "significant" folders that, in some way, affect the normal application of NTFS permissions based on the "inheritance" principle.
NTFS Stuff is an useful WSH script, written to be used on a fileserver, that generates an HTML report which displays the NTFS access permissions structure. Two different "verbosity" levels make possible to display only the details of "significant" folders or those of the entire folders tree. In addition to the DACL of each single folder the resultant report shows other information, such as: creation date, last modified date, owner, NTFS inheritance.
We have paid particular attention to the graphical representation of information, colours and symbols make easier to note changes in the normal application of NTFS permissions, precisely based, as we said before, on the “inheritance” principle.
The following screenshot highlights the main features of this script
- The details of each folder are hidden by default, it is possible to display them by clicking on their names; these details include: full path, creation date, last modified date, owner, DACL (both Allow and Deny options).
- "Expand All" and "Collapse All" links allow to display or hide all the details with a single mouse click.
- Inheritance state is highlighted by colourful symbols.
A green "=" means that permissions are inherited and not modified; folders identified by this symbol are not significant.
More important are instead "x" and "+" symbols, respectively red and blue. A red "x" means infact that inheritance is turned off, while a blue "+" means that there are some differences between the permissions of the folder and those of its parents (inheritance is turned on anyway).
- To make the output more readable, the details section of folders identified by "x" and "+" symbols displays also the parent folder's permissions.
- There is the chance to set two different execution methods: with "verbosity = 0" (default) only the folders identified by symbols "x" and "+" are displayed; with "verbosity = 1" the complete folders structure is displayed, graphically represented with the use of indentation.
- To offer more control is possible to specify the number of sub-levels (recursion) that have to be analyzed starting from the root folder; this feature can also reduce the execution time.
NTFS Stuff, only if started on Windows 2000, prompts the user for a task priority level (1 by default). This setting is used to limit the cpu usage during the execution. It is recommended to not set the 0 level when using this script on production servers or old computers, this is because the WSH Engine normally uses the most of the machine resources and this setting could cause a system freeze. Windows XP/2003 or higher are not affected by this problem, on these systems the script is able to automatically change his task priority level to "low", in this way the resource allocation is left to the operating system.
We noticed that is impossibile to correctly view the output file on Windows Server 2003 systems with the "Internet Explorer Enhanced Security" feature turned on. To fix this problem is necessary to add about:internet in the IE Trusted Sites Zone.
NTFS Stuff uses functions took from XCACLS.VBS (Windows Support Tools) to display the NTFS permissions in a more readable format.
To understand special permissions refer to the following legenda.
F = Full control
M = Modify
X = read & eXecute
R = Read
W = Write
E = Synchronize
D = Take Ownership
C = Change Permissions
B = Read Permissions
A = Delete
9 = Write Attributes
8 = Read Attributes
7 = Delete Subfolders and Files
6 = Traverse Folder / Execute File
5 = Write Extended Attributes
4 = Read Extended Attributes
3 = Create Folders / Append Data
2 = Create Files / Write Data
1 = List Folder / Read Data
The command line interface
The command line interface makes possibile to run NTFS Stuff remotely via "psexec" or locally as a scheduled task.
To get to the help screen open a command prompt and run "ntfsStuff.vbs" using the "cscript.exe" scripting engine and providing an input argument of your choice (for example the "?" character), for example:
cscript ntfsStuff.vbs ?
On Windows 2000 an additional argument named [PriorityLevel] is required
- The argument [RootFolderPath] is required and identifies the path which contains the folders to analyze.
- The argument [VerbosityLevel] is required and identifies how much information the graphical report should contain, a "0" value causes the display of the interesting/relevant folders only, "1" value causes the display of all the existing folders (the entire directory tree), even not interesting ones.
- The argument [PriorityLevel] (required and available only on Windows 2000) identifies the task priority level assigned to the script, the possible values are "0", "1" and "2", they respectively indicate the "low", "normal/moderate" and "high" task priority levels.
- The argument [RecursionLevel] is required and identifies the number of sub-levels (recursion) that have to be analyzed starting from the root folder, the value of "0" cause the analysis of the entire directory tree.
- The argument [/v] is optional and by activating it is possible to track the progress of the script.
cscript ntfsStuff.vbs "c:\Data" 0 0 cscript ntfsStuff.vbs "c:\Data" 0 0 /v
The command line also allows you to schedule the script execution via Windows scheduled tasks and to run it against remote servers using the psexec utility.
Example of remote execution via psexec:
psexec \\remote_server cscript C:\ntfsStuff.vbs "C:\Data" 0 0 /v
NTFS Stuff and UAC (User Account Control)
NTFS Stuff is able to automatically request an elevation of privileges when running on operating systems that support and make use of the User Account Control feature (Windows Vista, Windows 7, Windows 2008 Server).
Note: For obvious reasons, the elevation can be obtained automatically only when the script is running in graphical mode, to obtain administrator privileges when running via scheduled tasks or interactive via the command line you must use services or processes (for example: the command prompt) previously "runned as" Administrator.
For remote execution using "psexec" you must authenticate using the "built-in" administrative user (usually "Administrator") or disable the UAC access token filtering security feature.
Folders created by macintosh systems, especially those named with the use of special characters, can cause an unexpected error.
On Windows 2008 Server the script can cause an high CPU utilization by the processes lsass.exe and wmiprvse.exe.
- ntfs Stuff v1.0 - initial release
- ntfs Stuff v1.1 - fixed a CSS bug on Internet Explorer 8 and Firefox 3.5, new function added for better performance on Windows XP/2003 or higher
- ntfs Stuff v1.2 - folders that return an "Access Denied" error no longer cause the script to freeze/quit, added the ability to scan a whole drive starting at the root without the need to input a folder, Windows 2008 UAC bugfix (thanks to Helios Ciancio for feedback and source code), fixed a "Set Root Folder" input box bug, fixed some minor HTML bugs.
- ntfs Stuff v1.3 - new command line interface: starting from this release it is possible to run "ntfsStuff.vbs" via the command prompt using the "cscript" scripting engine, this feature makes possibile to run NTFS Stuff remotely via "psexec" or locally as a scheduled task. UAC support: NTFS Stuff is able to automatically request an elevation of privileges when running on operating systems that support and make use of the User Account Control feature (Windows Vista, Windows 7, Windows 2008 Server). "Access Denied" error handling further improved. Performance improvements: useless loops have been removed in order to improve the script execution speed.
mirko -at- notageek (.dot) it
- Mettere ordine alle autorizzazioni di un File Server utilizzando NTFS Stuff v1
- WSH - Windows Scripting Host