Jump to content
Sign in to follow this  
cmartin

get permissions for domain share

Recommended Posts

cmartin

I need to check whether current user has permission to access specific folders on a domain share (Window Active Directory). I have tested every _Net_Share function extensively but cannot seem to solve this problem. It could be syntactical (how to specify server and share).

Server name is ad.xyz.edu

There are multiple shares: share1, share2, etc.

There are multiple folders in each share: share1fold1, share1fold2, share2fold3, share1fold3. Some folder have subfolders as well. 

I have read access to each share (I can open it in Windows), but not necessarily to each folder in each share.

How do I check if the current user (me, for testing purposes) has access to a specific folder, say abc.xyz.edushare2folder1?

I tried this with every possible combination of $sServer ans $sShare

local $s, $sServer, $sShare, $aInfo

$sServer="ad.xyz.edu"

$sShare="med"

$aInfo = _Net_Share_ShareGetInfo ( $sServer, $sShare )

$s = "InfoName: " & $aInfo[0]) & @CRLF & "InfoType: " & $aInfo[1]) & @CRLF & "InfoPerm: " & $aInfo[3])
Msgbox($MB_SYSTEMMODAL, "Results", $s)

No matter what I specify, I get no error (@ERROR=0), and the value of each element in the array are empty.

Is it possible to test this, and if so, what is the correct syntax?

Using my examples:

If I have access to abc.xyz.edushare2folder1, how would I use _Net_Share_ShareGetInfo(), and what return values should I get in the array?

If I do not have access to abc.xyz.edushare2folder1, what return values should I get in the array?

Many thanks,

Chris M

 

Share this post


Link to post
Share on other sites
water

Do you know the names of the Active Directory groups where you have to be a member of to get access to those shares?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
cmartin

I don't know the names of the AD groups, but I can get the names. How would I use them?

Share this post


Link to post
Share on other sites
water

If you know the name then you could check if the user is a member of this AD group by using my AD UDF, function _AD_IsMemberOf.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
cmartin

Thanks, I will take a look at that function, since for this specific need I may be able to do that, but for long term I typically will not have the AD group names, so I was hoping to learn if it was possible to test if a user has read permission using the _Net_Share functions. Any other ideas along those lines would be very helpful. 

Chris M

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  

×