Jump to content
Sign in to follow this  
ShawnW

_Net_Share_FileGetInfo() and _Net_Share_PermStr() question

Recommended Posts

ShawnW

I am trying to grab all permissions from all folders on one of our servers so they can be analyzed and possibly cleaned up and reorganized when we move to a new server. I took a look at these functions and they seem like they might help but I have 2 problems.

First, I am not sure if _Net_Share_FileGetInfo() can look at all files or if it can just look at open ones like in the example from the help file.

Second, _Net_Share_PermStr() although it only interprets data from _Net_Share_FileGetInfo() so the problem is there, does not seem to return proper permissions for folders.

I tried the example in the help file and looked at open files. I found if I have a file open I might see R--E---

but in the same directory (all inherited permissions) a folder would say only R------ even if it has execute permissions as well.

This might be a problem or limitation of the netapi32.dll call but I don't have a lot of knowledge about that dll. Is there any way to view full correct permissions on folders?

Before you suggest others though know that I already tried xcacls.exe and it is worse because even the files in the folder said 'R' only with no 'E'. I also tried SetACL.exe which returned only half of the listed users with permissions, and said they all had FULL permissions which they do not.

Share this post


Link to post
Share on other sites
99ojo

Hi,

for this kind of tasks, i always use dumpsec.

You can dump security information with various report options.

;-))

Stefan

Share this post


Link to post
Share on other sites
water

Hi,

for this kind of tasks, i always use dumpsec.

You can dump security information with various report options.

;-))

Stefan

And I have written a Script to display the dumpsec information in a treeview. It lets you search for directory names, groups, users and marks the directories the user/group can access.

If you like I can send you a copy.

It's been written quick&dirty so it's nothing I can post here without some cleaning up beforehand.

An old version with a screenshot has been posted here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
99ojo

Hi water,

i'm intersted. If you want PM me the script and maybe some description...

Thanks so far...

;-))

Stefan

Share this post


Link to post
Share on other sites
ShawnW

Thanks 99ojo! Just the tool I was looking for. I might have use for the script in the future water, for now this is ok but I'll know who to contact later if I need something like that =)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.