General discussion

Locked

Need Help with script

By lbischofs ·
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

This conversation is currently closed to new comments.

10 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Need Help with script

by jdow In reply to Need Help with script

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.

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

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

Collapse -

Need Help with script

by ComputerDude In reply to Need Help with script

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

Dave

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

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...

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

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.

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

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.

Collapse -

Need Help with script

by -DaG In reply to Need Help with script

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

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

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.

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

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.

Collapse -

Need Help with script

by lbischofs In reply to Need Help with script

This question was closed by the author

Back to Windows Forum
10 total posts (Page 1 of 1)  

Related Discussions

Related Forums