Jump to content

Active Directory UDF - Help & Support


water
 Share

Recommended Posts

Hello Water and thank you for this outstanding UDF. Its really great.

I just have one question.

Im making a small program that will allow out users to modify the membership of the security groups that they own. So what i do is that i set the "manager" attibute of the group in AD to the specific user, and when he runs the program, he gets a list of groups that he currently is manager for. Form there he can delete and add new users to that group.

Evereything works perfectly for me. Its just that it wont work for the users. Since im domain-admin i have write-permission to all the groups. But for the users, the list is empty. So i changed the code a bit. First the program checks every group that the user is a member of. From there I use the _AD_HasGroupUpdateRights() on every group and then list every group for witch the condition is true. But yet again, works for me and the list is empty for the users.

So does that mean that even if i check the "manager can update mamber list" for the group in AD, he still doesnt get group update rights?

I tried just to type the simplest script.

_AD_HasGroupUpdateRights($groupname,$user) gives me 0 as result

_AD_HasGroupUpdateRights($groupname,$me) gives me 1 as result

Even if $user1 is manager of the group and the "update member list" is checked. Any Idees?

Thanks.

Link to comment
Share on other sites

What's the value of @error when you get 0 as a result for a user?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Haven't used those functions coping with permissions myself - nor did I write them.

So it will take some time to find the reason and will be a kind of question - answer - game between you and me.

First question: If a user, for which you get 0 returned by _AD_HasGroupUpdateRights, tries to add a user to the group does he get an error or does this work? So we know if the result by _AD_HasGroupUpdateRights is correct.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Sounds good.

First Answer:

I logged on to a PC using a dummy account that i have given "manager can change member list" permission to. I run the script and i got 0 and 0 again for that group. I then open ADUC and found the correct group. There i could add/remove users withaout any problems whatsoever.

Link to comment
Share on other sites

I had another look at the UDF and I think you need to give function _AD_GroupManagerCanModify a try. This function should return the result you want.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I tied _AD_GroupManagerCanModify($groupname) and still got 0 as answer.

I checked the @error and i got 2 (The manager can not modify the member list). But clearly (as i tested above) the manager CAN modify the list.

Update: I tried the same thing using my domainadmin account and i still get 2. I guess it checks if the "manger can modify" checkbox. regardless of who is running the command.

Edited by Tjalve
Link to comment
Share on other sites

I had a quick look at the functions and I got the impression that they might be buggy.

I need some more time to understand how they work and why they don't return the expected results.

I will come back when I have further questions or a solution.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hello.

May this has been discuss previously but I didn't find it.

I've an issue renaming Ad object in my case Ad-groups, group is correctly renamed but the Pre-Windows 2000 name continues with the previous name.

Pls, do you know how to fix that? I've renamed several groups and doing that manully is a paintfull.

I use this code:

#include <ad.au3>
_Ad_Open()
$result=_AD_RenameObject($dom[$i], $New_Name)

Thank you

Edited by xterix
Link to comment
Share on other sites

The function only renames the RDN (relative distinguished name) of the object. If you need to change other properties of the object you have to call _AD_ModifyAttribute.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The function only renames the RDN (relative distinguished name) of the object. If you need to change other properties of the object you have to call _AD_ModifyAttribute.

Thank you, I'm using _AD_ModifyAttribute to modify the "sAMAccountName"

Regards

Link to comment
Share on other sites

Water,

I have this script and I am trying to read the properties of an AD account. It works for mine (Domain and Enterprise Admin), but for a Domain User it gets an array error, which I am attributing to the fact that it is not pulling anything into the variable/array.

I thought that it's perhaps that the Domain Users can't read AD the same way as I can, so I used the _AD_Open function with my credentials, but this still did not make a difference.

Do you have any idea what could be causing the _AD_GetObjectProperties function to not work for standard users?

Thanks,

#include<AD.au3>

_AD_Open()
$sid = _AD_GetObjectProperties(@UserName, "")
;If IsArray($sid) Then
For $i = 1 To $sid[0][0]
If $sid[$i][0] = "objectSID" Then
$objectSID = $sid[$i][1]
EndIf
Next
RegWrite("HKLM\Software\Application", "SID", "REG_SZ", $objectSID)
;EndIf
_ArrayDisplay($sid)
MsgBox(0,"",$objectSID)
;ConsoleWrite(@CR & @CR & $objectSID & @CR & @CR)
_AD_Close()
Link to comment
Share on other sites

Can you please insert this line after the call to _AD_GetObjectProperties?

ConsoleWrite("Error: " & @error & ", IsArray: " & IsArray($sid) & @CRLF)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@error 1 means: Object not found.

What's the value of @Username?

Is there anything special with your AD environment (Read Only Domain Controllers etc.)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:) I don't think there is anything special with our AD environment.

The username is an active account in AD, and the value was expected.

Should I put "Domain" & @username?

I have never had to do that before, but maybe it'll work... I guess I'll try it.

Link to comment
Share on other sites

Domainusername won't work because the function only accepts SamAccountName or FQDN.

What version of the UDF do you use?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Then please add

$iAD_Debug = 2
before calling function _AD_GetObjectProperties.

If an error occurres you should get a MsgBox with debugging information.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...