Jump to content

Recommended Posts

Posted

Version 1.1.0 has been released.

Please test before using in production!

For download please see my signature.

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

 

  • 2 weeks later...
Posted

Hi all,

I think i found a bug. This script works well :

#include "AD.au3"
_AD_Open()
_AD_CreateOU($sAD_DNSDomain, "Temp")
_AD_CreateUser("OU=Temp," & $sAD_DNSDomain, "Utilisa.Test", "Utilisateur_Test")
If _AD_DeleteObject(_AD_SamAccountNameToFQDN("Utilisa.Test"), _AD_GetObjectClass("Utilisa.Test")) <> 1 Then ConsoleWrite("Erreur : " & @error & @CRLF)
_AD_Close()
Exit

@error is "0"

But if i add _AD_ListDomainControllers() before _AD_DeleteObject then _AD_DeleteObject does not work.

Example :

#include "AD.au3"
_AD_Open()
_AD_ListDomainControllers()
_AD_CreateOU($sAD_DNSDomain, "Temp")
_AD_CreateUser("OU=Temp," & $sAD_DNSDomain, "Utilisa.Test", "Utilisateur_Test")
If _AD_DeleteObject(_AD_SamAccountNameToFQDN("Utilisa.Test"), _AD_GetObjectClass("Utilisa.Test")) <> 1 Then ConsoleWrite("Erreur : " & @error & @CRLF)
_AD_Close()
Exit

@error is "-2147352567"

I tested on :

- Windows Server 2000 SP4, 2003 R2 SP2, 2008 SP2 and 2008 R2 SP1 (All french version)

- All versions of AD.au3

Thanks.

Regards.

Posted

Could you please run this modified version of your script and post the results?

#include "AD.au3"
$iAD_Debug = 2
_AD_Open()
ConsoleWrite("_AD_Open: @error = " & @error & @CRLF)
Global $aDCs = _AD_ListDomainControllers()
ConsoleWrite("_AD_ListDomainControllers: @error = " & @error & @CRLF)
_AD_CreateOU($sAD_DNSDomain, "Temp")
ConsoleWrite("_AD_CreateOU: @error = " & @error & @CRLF)
_AD_CreateUser("OU=Temp," & $sAD_DNSDomain, "Utilisa.Test", "Utilisateur_Test")
ConsoleWrite("_AD_CreateUser: @error = " & @error & @CRLF)
Global $sObjClass = _AD_GetObjectClass("Utilisa.Test")
ConsoleWrite("_AD_GetObjectClass: @error = " & @error & @CRLF)
ConsoleWrite("ObjClass: " & $sObjClass & @CRLF)
_AD_DeleteObject("Utilisa.Test", $sObjClass)
ConsoleWrite("_AD_DeleteObject: @error = " & @error & @CRLF)
_AD_Close()
Exit

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

 

Posted

I think I've found the problem. It's caused by escaping a character which shouldn't be escaped.

Could you please replace _AD_DeleteObject with the following code, test again and post the results?

Func _AD_DeleteObject($sAD_Object, $sAD_Class)
 
    If Not _AD_ObjectExists($sAD_Object) Then Return SetError(1, 0, 0)
    If StringMid($sAD_Object, 3, 1) <> "=" Then $sAD_Object = _AD_SamAccountNameToFQDN($sAD_Object) ; sAMAccountName provided
    Local $iAD_Index = StringInStr($sAD_Object, "OU=")
    Local $sAD_OU = StringTrimLeft($sAD_Object, $iAD_Index - 1) ; Strip OU from FQDN
    Local $sAD_DisplayName = "CN=" & _AD_FixSpecialChars(_AD_GetObjectAttribute($sAD_Object, "displayname"))
    Local $oAD_OU = _AD_ObjGet("LDAP://" & $sAD_HostServer & "/" & $sAD_OU)
    $oAD_OU.Delete($sAD_Class, $sAD_DisplayName)
    If @error <> 0 Then Return SetError(@error, 0, 0)
    Return 1
 
EndFunc   ;==>_AD_DeleteObject

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

 

Posted

Hi Water;

I tested and don't work.

With or without _AD_ListDomainControllers(), your change does not work.

The results (with Server Windows 2000 FR, 2003 FR and 2008 R2 FR and all mode in Domain and Forest) are :

_AD_Open: @error = 0
_AD_ListDomainControllers: @error = 0
_AD_CreateOU: @error = 0
_AD_CreateUser: @error = 0
_AD_GetObjectClass: @error = 0
ObjClass: user
_AD_DeleteObject: @error = -2147352567

post-37369-0-67325900-1317068532_thumb.j post-37369-0-40395400-1317068543_thumb.j

The all tests are performed with VirtualBox version 4.1.2 r73507 on guest Windows 7 64 bits FR .

Thanks.

Posted (edited)

In version 1.1.0 line number 1417 is in the middle of function _AD_ListDomainControllers

$aAD_SubNet = $oAD_Site.GetEx("siteObjectBL")
and line 2580 is in function _AD_DeleteObject
$oAD_OU.Delete($sAD_Class, $sAD_CN)

I will check it tomorrow when I have access to an AD.

Edit:

I googled the second message you got and I found some articles that point me to ADAM. Do you run the tests on an ADAM intallation?

http://technet.microsoft.com/fr-fr/library/cc782850%28WS.10%29.aspx

Edited by water

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

 

Posted

Water,

I found the problem.

I write this litle script :

#include "Array.au3"
#include "AD.au3"
_AD_Open()
$aDCs = _AD_ListDomainControllers()
For $i = 0 To $aDCs[0][1] - 1
ConsoleWrite("Col" & $i & " : " & $aDCs[1][$i] & @CRLF)
Next
_AD_Close()
Exit

The array result for $aDCs = _AD_ListDomainControllers() is :

Col0 : WIN-EU9OR6FPPTR

Col1 : CN=WIN-EU9OR6FPPTR,OU=Domain Controllers,DC=mydomaine,DC=ad

Col2 : WIN-EU9OR6FPPTR.mydomaine.ad

Col3 : Default-First-Site-Name

Col4 : CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=mydomaine,DC=ad

Col5 :

Col6 : True

No result for "Col5" (list of subnet).

post-37369-0-86862800-1317073315_thumb.j

I added a subnet in "Active Directory Sites and Services" and it works.

_AD_DeleteObject() works after _AD_ListDomainControllers()

The problem is that the subnet is not required in AD.

Thanks and good night ;-)

Posted (edited)

The "problem" in _AD_ListDomainControllers isn't a real problem. When there is no siteObjectBL property the UDF handles the COM error properly (it just pops up now because we've set the debug switch).

What I don't understand is why _AD_DeleteObject should be affected by _AD_ListDomainControllers!

Could you please run this modified version of your script and post the result?

#include "AD.au3"
_AD_Open()
_AD_ListDomainControllers()
_AD_CreateOU($sAD_DNSDomain, "Temp")
_AD_CreateUser("OU=Temp," & $sAD_DNSDomain, "Utilisa.Test", "Utilisateur_Test")
Consolewrite(_AD_SamAccountNameToFQDN("Utilisa.Test") & @CRLF)
If _AD_DeleteObject(_AD_SamAccountNameToFQDN("Utilisa.Test"), _AD_GetObjectClass("Utilisa.Test")) <> 1 Then ConsoleWrite("Erreur : " & @error & @CRLF)
_AD_Close()
Exit
Edited by water

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

 

Posted (edited)

Could you please run this modified version of your script and post the result?

Hi Water,

Without subnet :

CN=Utilisateur_Test,OU=Temp,DC=mydomaine,DC=ad

Erreur : -2147352567

>Exit code: 0 Time: 0.668

With subnet :

CN=Utilisateur_Test,OU=Temp,DC=mydomaine,DC=ad

>Exit code: 0 Time: 0.669

Edit : If I delete the subnet, the error is back

I check too.

Thanks.

Edited by FernandG
Posted

I have searched the code and the internet high and low but couldn't find a solution.

Is it possible that an AD configuration without a subnet isn't complete and hence leads to the error we see (because as soon as you add a subnet it works).

I'm no AD guru and have to admit that I have come to the end of my (limited) wisdom.

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

 

Posted

This is not the subnet but the empty array with this command : $oAD_XXX.GetEx

Try this :

#include "AD.au3"
_AD_Open()
_AD_CreateOU($sAD_DNSDomain, "Temp")
_AD_CreateUser("OU=Temp," & $sAD_DNSDomain, "Utilisa.Test", "Utilisateur_Test")
_AD_GetUserGroups("Utilisa.Test")
If _AD_DeleteObject(_AD_SamAccountNameToFQDN("Utilisa.Test"), _AD_GetObjectClass("Utilisa.Test")) <> 1 Then ConsoleWrite("Erreur : " & @error & @CRLF)
_AD_Close()
Exit

Result :

Erreur : -2147352567

>Exit code: 0 Time: 0.665

The user does not have a group and i also an error. If I add a group, no error.

I check ...

Posted

According to MSDN the GetEx method works with the cache to retrieve data.

Could you please split your skript into two parts and try again?

#include "AD.au3"
_AD_Open()
_AD_CreateOU($sAD_DNSDomain, "Temp")
_AD_CreateUser("OU=Temp," & $sAD_DNSDomain, "Utilisa.Test", "Utilisateur_Test")
_AD_Close()
Exit
and
#include "AD.au3"
_AD_Open()
_AD_GetUserGroups("Utilisa.Test")
If _AD_DeleteObject(_AD_SamAccountNameToFQDN("Utilisa.Test"), _AD_GetObjectClass("Utilisa.Test")) <> 1 Then ConsoleWrite("Erreur : " & @error & @CRLF)
_AD_Close()
Exit
Does it make a difference if you run it in two separat scripts?

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

 

Posted

Could you please split your skript into two parts and try again?

Done

Does it make a difference if you run it in two separat scripts?

Error : -2147352567

Don't work :-(

Posted

Could you please insert after _AD_Open

_AD_SetADOProperties("Cache results=False")
and try again?

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

 

Posted (edited)

I have absolutely no idea what's going on here :graduated:

I will have to think about it. I will be off tomorrow and hope to be online on thursday again.

Edited by water

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

 

Posted

Hi Water,

Have you looked at the concerns of GetEx ?

I searched but found nothing. I still blocks using functions with GetEx.

I tried to find other solutions, but without effect.

Good luck.

Thank you.

Regards.

Guest
This topic is now closed to further replies.
×
×
  • Create New...