Discussion Locked

Need Help with script

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I tried the programming section (no replies).
I'd like to write a script to list Permissions on a folder and enumerate Users and members of Local & Global groups (and Domain if possible). I'm new at this, any help would be greatly appreciated. I'd like to output to Excel if possible.
My novice attempt listed below:
On Error Resume Next

Dim RowNumber, ColumnNumber, XL, MyPos
ColumnNumber=1
RowNumber=1
Set XL = CreateObject("Excel.Application")
XL.workbooks.add
XL.Visible = TRUE
XL.Cells(RowNumber, ColumnNumber+1).Value = "User ID"
XL.Cells(RowNumber, ColumnNumber+2).Value = "User Name"
RowNumber=RowNumber+2
XL.Cells(RowNumber, ColumnNumber).Value = "Server7/Source Group"
RowNumber=RowNumber+1

Set Group = GetObject("WinNT://Server7/Source Group")
For Each Member in Group.Members
MyPos = Instr(1, member.name, "$")
if MyPos = 0 then
XL.Cells(RowNumber, ColumnNumber+1).Value = member.name
XL.Cells(RowNumber, ColumnNumber+2).Value = member.fullname
RowNumber=RowNumber+1
end if
Next

RowNumber=RowNumber+1
XL.Cells(RowNumber, ColumnNumber).Value = "Others"
RowNumber=RowNumber+1
Set Group = GetObject("WinNT://Server/Domain Users")
For Each Member in Group.Members
MyPos = Instr(1, member.name, "$")
if MyPos = 0 then
if member.name = "123456" then
XL.Cells(RowNumber, ColumnNumber+1).Value = member.name
XL.Cells(RowNumber, ColumnNumber+2).Value = member.fullname
RowNumber=RowNumber+1
end if
end if
Next

XL.Cells.EntireColumn.AutoFit
Set XL=nothing
MsgBox ("Done")
WScript.Quit

10 replies

by jdow

Thats an impressive script, but there is actually a utility in the NT Resource Kit that will list all the permissions for you, if you add a > then a file name, you can import it into excel/access or whatever. I apologize, but I cant remember the name of the utility, but I have seen it in the RSK.

by lbischofs

I wish this system would just let you add comments to replies without having to rate them 1st.

by computerdude

What exactly isn't working? I was able to enumerate a group and output to a spreadsheet with you script.

Dave

by lbischofs

I'm trying to avoid hard coding the Groups etc. I'd like to just key in the folder name and path and have the script list permissions and enumerate the members of any local or global groups.
I wish there was another rating here... like Pending...

by lbischofs

Re:Answer 2... I'm trying to avoid hard coding the Groups etc. I'd like to just key in the folder name and path and have the script list permissions and enumerate the members of any local or global groups.

by lbischofs

re:Answer 1...
Thanks for the compliment... If you happen to think of the name of the util, please let me know. DumpACL can provide what I need but it's a multi-step/labor intensive process that I'd like to automate.

by -dag

There is a utility called SHOWACLS.EXE in the resource kit. If you run it with the /s parameter, it will tell show you who has what rights to what files.

You can redirect it with >filename.txt

by lbischofs

Thanks, but still not what I'm looking for. I really need something that is more automated and actually lists members of local and global groups.

re:showacls... The doc file for showacls, made it sound like it enumerated local and global members, but it doesn't. DumpACL does a much better job.

by lbischofs

I figured out a way to do this, but still having problem figuring out how to differentiate between User and Group. For the time being I'm just using an On error resume next.

This discussion is closed to new replies.