Viewing folder permissions in VBA?

M

Mark Hanford

We are going to be migrating a whole bunch of stuff from one set of servers
to another soon, and on one of them (a web server) there is a whole mess of
folder- and file-permissions.

Is there a way of traversing a folder tree and reporting on the permissions
of each object? The results would either be saved in an Access MDB or saved
to a CSV or whatever.

I can find plenty of samples of using FSO, for example, to traverse a tree,
but nothing about extracting the current permissions.

It would be nice if I could set permissions too, but that's something I'm
not 100% sure I want to automate just yet, as I'm hoping to tidy up a lot of
the stuff anyway.

Any links or subtle hints appreciated! Google searches including "security"
or "permissions" always seem to result in a whole raft of irrelevent
links...

M
 
J

Jim Cone

Mark,

Re: "I can find plenty of samples of using FSO"
but nothing about extracting the current permissions"

Does the file "attributes" property do what you want?
(from the: script runtime - file system object - properties)...
'------------------------------------------------------
Sets or returns the attributes of files or folders. Read/write or read-only, depending on the attribute.

object:
Required. Always the name of a File or Folder object.
newattributes:
Optional. If provided, newattributes is the new value for the attributes of the specified object.
Settings:
The newattributes argument can have any of the following values or any logical combination of the following values:

Constant Value Description
Normal 0 Normal file. No attributes are set.
ReadOnly 1 Read-only file. Attribute is read/write.
Hidden 2 Hidden file. Attribute is read/write.
System 4 System file. Attribute is read/write.
Volume 8 Disk drive volume label. Attribute is read-only.
Directory 16 Folder or directory. Attribute is read-only.
Archive 32 File has changed since last backup. Attribute is read/write.
Alias 64 Link or shortcut. Attribute is read-only.
Compressed 128 Compressed file. Attribute is read-only.
'-------------------------------------------------------------
Regards,
Jim Cone
San Francisco, CA
 
M

Mark Hanford

Not really, I was looking for the actual users or groups (or even just their
SID's) and their permissions.

Jim Cone said:
Mark,

Re: "I can find plenty of samples of using FSO"
but nothing about extracting the current permissions"

Does the file "attributes" property do what you want?
(from the: script runtime - file system object - properties)...
'------------------------------------------------------
Sets or returns the attributes of files or folders. Read/write or
read-only, depending on the attribute.
object:
Required. Always the name of a File or Folder object.
newattributes:
Optional. If provided, newattributes is the new value for the attributes of the specified object.
Settings:
The newattributes argument can have any of the following values or any
logical combination of the following values:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top