lasthope
asked on
I need help with this VBScript. Want it to skip a folder in the enumeration process.
This is a great script to enumerate Folder Permissions on MS Server. It outputs to a txt file.
What I would like to be able to do is tell the script to skip a folder. I'm not up to speed on scripting so I need some help.
I attached the script in the "Code" area.
I am running the script in a folder called UserData (the script doesn't care what this folder name is).
This folder has many subfolders for different business units to store their files.
I want the script to skip (pass over) a specific subfolder in UserData.
Thanks in advance! Let me know if this isn't clear.
What I would like to be able to do is tell the script to skip a folder. I'm not up to speed on scripting so I need some help.
I attached the script in the "Code" area.
I am running the script in a folder called UserData (the script doesn't care what this folder name is).
This folder has many subfolders for different business units to store their files.
I want the script to skip (pass over) a specific subfolder in UserData.
Thanks in advance! Let me know if this isn't clear.
' ListACL.vbs
' ACL Modifications by CyberneticWraith, 2005
' Changed it to display ACL information for folders
' Uses "cacls.exe"
' Run with cscript!
'
'
' IndexScripts()
'
'
' Written by Keep Bertha Surfin Heavy Industries,
' a division of Keep Bertha Surfin Electrical Concern
' Version 1.0 - KeepBerthaSurfin@Hotmail.com
'
' First thing, check the argument list for a directory.
' If they didn't specify one, use the current directory.
' Run this on the File Server system you desire to get the ACL's from.
' To put this output into a file you just execute "cscript listacl.vbs > acl.txt".
option explicit
' Run the function :)
call IndexScripts
sub IndexScripts()
dim fso
set fso = createobject("scripting.filesystemobject")
dim loc
if WScript.Arguments.Count = 0 then
loc = fso.GetAbsolutePathName(".")
else
loc = WScript.Arguments(0)
end if
GetWorkingFolder loc, 0, 1, "|"
set fso = nothing
End Sub
' called recursively to get a folder to work in
function GetWorkingFolder(foldspec, foldcount, _
firsttime, spacer)
Dim objShell,oExec
Set objShell = CreateObject("WScript.Shell")
dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
dim fold
set fold = fso.GetFolder(foldspec)
dim foldcol
set foldcol = fold.SubFolders
'do the first folder stuff
if firsttime = 1 then
wscript.echo fold.path
foldcount = foldcol.count
firsttime = 0
end if
dim remaincount
remaincount = foldcol.count
'do the subfolder stuff
dim sf
for each sf in foldcol
'execute cacls to display ACL information
Set oExec = _
objShell.Exec("cacls " & chr(34) & sf.path & chr(34))
Do While Not oExec.StdOut.AtEndOfStream
str = oExec.StdOut.ReadAll
Dim str
Wscript.StdOut.WriteLine str
Loop
set oExec = nothing
remaincount = GetWorkingFolder (foldspec +"\"+sf.name, _
remaincount, firsttime, spacer)
next
'clean up
set fso = nothing
GetWorkingFolder = foldcount - 1
end function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked perfectly!!
Open in new window