Jump to content
Sign in to follow this  
water

Active Directory UDF - Help & Support (II)

Recommended Posts

Water,

After selecting the OU in the tree view I am attempting to return the FQDN of the OU as the location for where to create the computer object.

If I output $sOU in a MsgBox, then copy/paste the OU to manually specify the FQDN in the _AD_CreateComputer, it seems to work fine.

If I use $sOU directly as it is returned to create the computer object, this error occurs:

C:\Program Files (x86)\AutoIt3\Include\AD.au3 (594) : ==> The requested action with this object has failed.:

Local $oAD_RecordSet = $__oAD_Command.Execute

Local $oAD_RecordSet = $__oAD_Command.Execute^ ERROR

Do you know why this might be?

Share this post


Link to post
Share on other sites

Which version of the UDF do you use?

Line 594 is somewhere in function _AD_GetSchemaAttributes :think:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Sorry, that's my bad.

I slightly modified AD.au3 to do some checking with _AD_HasRequiredRights when we were working on it and had some commented lines. Just now, I replaced it with the original 1.3.0.0 version, then added the _AD_HasRequiredRights__GivenMembers directly under _AD_HasRequiredRights.

Local $oAD_RecordSet = $__oAD_Command.Execute is the line it's having problems with, in the Func _AD_ObjectExists. In both the one I modified and the original, that is line 541.

Edited by chaoticyeshua

Share this post


Link to post
Share on other sites

Can you post the OU you pass to the function? Maybe there are spaces at the start and/or end or a character that needs to be escaped (comma etc.)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

When I copy/paste from MsgBox, here's what I get:

---------------------------

---------------------------

OU=New Computers,OU=Drane Hall - Desktop,OU=helpdesk,DC=domain,DC=com

---------------------------

OK

---------------------------

Just edited the DC= parts... According to that, no starting/trailing white space. There are spaces in the OUs but like I said, if I take exactly what is shown above and manually enter it into _AD_CreateComputer instead of passing it to it via a variable, it works.

Share this post


Link to post
Share on other sites

Dump question: Are you sure you pass the correct variable and the variable is passed as parameter 1 to _AD_CreateComputer?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

I named the function for the tree view GUI as GUI2.

In GUI2, where you had MsgBox(64, $sTitle & " - Selected OU", "Name: " & $sSelection & @CRLF & "FQDN: " & $sOU) I replaced it with Return $sOU

So I do this:

$sSelectedOU = GUI2()
MsgBox(0,"",$sSelectedOU)
If $sSelectedOU <> "" Then
   _AD_CreateComputer($sSelectedOU, $sComputerName, $sTUsername)
EndIf

The MsgBox outputs the correct FQDN. The _AD_CreateComputer gives the error I listed above.

Share this post


Link to post
Share on other sites

But if you run

_AD_CreateComputer("OU=New Computers,OU=Drane Hall - Desktop,OU=helpdesk,DC=domain,DC=com", $sComputerName, $sTUsername)
it doesn't crash?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Duh, I'm an idiot. At the bottom of the tree view GUI:

If $bIsADOpen = False Then _AD_Close()

...commented it out, and now it works. I open AD in another part of the script so I need to account for that in your GUI too ;)

Edited by chaoticyeshua

Share this post


Link to post
Share on other sites

If the connection to AD has already been opened when you call _AD_GetOUTreeView then simply pass True as parameter three to _AD_GetOUTreeView.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Hi there. Ive written a small program that we use for keeping track of equipment. Who has what and when they need to return it. Its more or less finished and it works great. I use this UDF to connect to AD and get a lite of our current domain users. The problem is that the receptionists what to use the program also, but when they try to run it, they get an AD connection error. I debuged the program and found out that its the _AD_open() function thats the problem. On my account (as a domain admin) it works perfectly. But on the "other" accounts i get @error = 4. Same thing when i try to use "runas" on my computer and run the program as another user.

The strange thing is that ive used this UDF in another program to do the exact same thing. That program connects to AD and downloads the data from all the users and create outlook contaacts for all the users. And that program works. Any iddees anyone?

Share this post


Link to post
Share on other sites

What's the value of @extended after _AD_Open?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

This is 0x80070035 - The network path was not found

Do you specify any arguments when calling _AD_Open?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

The receptionists PC is joined to the domain and the receptionists user has logged on to the domain?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-09-05 - Version 1.5.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - 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
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...