Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Active Directory UDF - Help & Support


  • This topic is locked This topic is locked
781 replies to this topic

#481 paullauze

paullauze

    Seeker

  • Active Members
  • 26 posts

Posted 23 April 2012 - 06:55 PM

CN=LastName, FirstName X - TestUser,OU=Setup,DC=Work,DC=net

i could just use the SAM and get the same results







#482 UEZ

UEZ

    Never say never

  • MVPs
  • 4,838 posts

Posted 26 April 2012 - 07:38 PM

Hi water,

the functions _AD_ObjectExists() returns 0 although the ad group exists!

$oAD_RecordSet.RecordCount = 0.

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#483 UEZ

UEZ

    Never say never

  • MVPs
  • 4,838 posts

Posted 27 April 2012 - 07:48 AM

Forget it. The mistake is in the Group name (pre-Windows 2000)“ name which is different!

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#484 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 27 April 2012 - 12:05 PM

Hi UEZ,

is there anything I could add to the UDF to handle such a case? Return an error code or something?
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#485 jazzyjeff

jazzyjeff

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 334 posts

Posted 27 April 2012 - 01:14 PM

Water,

I have a script that checks the users AD group membership, and based on that membership they receive a GUI that removes or adds extra options. The script appears to operate fine, and when I log in as a domain admin account I receive no errors. If I log in with any other user that has a different group membership, I receive 3 AD error messages before the GUI opens.
I am running the latest AutoIT 3.3.8.1 with AD UDF 1.2.0. I have even tried downloading the 1.2.0 udf again. I have also tried the latest beta 3.3.9.4 and used your latest udf 1.2.1, but that also doesn't make a difference. In fact I actually get 5 error windows appear instead of 3.

Here is my script:
_AD_Open() If _AD_IsMemberOf("Domain Admins", @UserName, 1) Then _MainAdmin() Else _MainUser() EndIf _AD_Close()


Here are screenshots of the error messages I receive in order below:
1.jpg
2.jpg
3.jpg

Thanks for any help you can provide me with.

Jeff

#486 UEZ

UEZ

    Never say never

  • MVPs
  • 4,838 posts

Posted 27 April 2012 - 02:15 PM

Hi UEZ,

is there anything I could add to the UDF to handle such a case? Return an error code or something?


Yes please because the problem was hard to find! If there is a change to compare the name entered in "Group name (pre-Windows 2000)" and the display name?

Because when I used the string entered in Group name (pre-Windows 2000) it worked - the displayed name which is different doesn't work.

Maybe you can modify the function _AD_ObjectExists()

Thanks,
UEZ

Edited by UEZ, 27 April 2012 - 02:16 PM.

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#487 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 27 April 2012 - 02:30 PM

Can you run the script from SciTe so we can see the line numbers?
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#488 jazzyjeff

jazzyjeff

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 334 posts

Posted 27 April 2012 - 02:43 PM

I'm sorry. I ran it Scite as a different user and not issues. I compiled it, and not issues! Sorry I feel a bit of a time waster. Thanks for getting back to me.

#489 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 27 April 2012 - 02:57 PM

Maybe the problem is caused by user dependant data. The first error message you got is usually caused by an invalid FQDN passed as LDAP query.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#490 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 27 April 2012 - 03:35 PM

Yes please because the problem was hard to find! If there is a change to compare the name entered in "Group name (pre-Windows 2000)" and the display name?

Because when I used the string entered in Group name (pre-Windows 2000) it worked - the displayed name which is different doesn't work.

Maybe you can modify the function _AD_ObjectExists()

Thanks,
UEZ

Hi UEZ,

most of the functions in the AD UDF accept either SamAccountname or a Fully Qualified Domain Name (FQDN). If the function finds a "=" at position 3 it assumes a FQDN, else a SamAccountName. If you specify the DisplayName it is interpreted as SamAccountName. If the DisplayName does not equal the SamAccountName then you get a "not forund" error.
You will have to check the displayname - SamAccountName yourself because passing the DisplayName is not supported and the functions can't distinguish between DisplayName and SamAccountName.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#491 paullauze

paullauze

    Seeker

  • Active Members
  • 26 posts

Posted 27 April 2012 - 10:41 PM

is the format for path correct for the target OU ?

$sTargetOU = "OU=Users,OU=Blah,DC=Work,DC=net"
$sObject = "TESTUSER"

Global $iValue = _AD_MoveObject($sTargetOU, $sObject)

#492 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 27 April 2012 - 10:54 PM

Doesn't look bad. The first example was with an escaped comma in the name (FQDN) but now you have a SamAccountName. What's the Fully Qualified Domain name (FQDN) for "TESTUSER" - is there a special character in it too?
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#493 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 27 April 2012 - 11:02 PM

I searched google and checked the code: Maybe there is a problem with the cn - common name - property.
Can you please post the result of
#include <AD.au3> $aResult = _AD_GetObjectAttribute("TESTUSER", "cn") ConsoleWrite($aResult & @CRLF)

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#494 paullauze

paullauze

    Seeker

  • Active Members
  • 26 posts

Posted 27 April 2012 - 11:22 PM

i will do it Monday. i believe he result will be "CN=LastName, FirstName X - TestUser,OU=Setup,DC=Work,DC=net"

the CN and SAM get combined like that on some users.

#495 paullauze

paullauze

    Seeker

  • Active Members
  • 26 posts

Posted 30 April 2012 - 07:07 PM

I solved my problem using RunWait(@COMSPEC & $moveString)
i knew i could move the object at the command line so tried this a nd it works fine.


_AD_Open()
$sTargetOU = "OU=Users,OU=Blah,DC=Work,DC=net"
$sObject = _AD_SamAccountNameToFQDN("TESTUSER")
_AD_Close()

$moveString =" /c dsmove """ & $sObject & """ -newparent " & $sTargetOU RunWait(@COMSPEC & $moveString)

-or something like that

it too bad the MoveObject function would not work for me. all the other functions worked great.
any way thats for trying to help

#496 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 30 April 2012 - 07:54 PM

_AD_MoveObject has worked fine for many users. I think the problem is caused by the escaped comma.
Can you please post the result of _AD_SamAccountNameToFQDN("TESTUSER")?
So I can check the function and - hopefully - remove the bug?
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#497 paullauze

paullauze

    Seeker

  • Active Members
  • 26 posts

Posted 01 May 2012 - 04:57 PM

here ya go

CN=Last, First X - TESTUSER,OU=Blah,DC=Work,DC=net


moving user to
OU=Users,OU=Office,DC=Work,DC=net

#498 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 01 May 2012 - 05:10 PM

Thanks for the info.
I'm going to test as soon as I'm in my office again.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#499 paullauze

paullauze

    Seeker

  • Active Members
  • 26 posts

Posted 01 May 2012 - 06:50 PM

is it just me or is _AD_SetAccountExpire off by one day?


if i set a user to expire on 7/31/2012 , when i check the user in ADUC his expiration date is 7/30/2012.


i can just add a day the the date before i send it to the function i guess.
weird

#500 water

water

    ?

  • MVPs
  • 15,305 posts

Posted 01 May 2012 - 07:06 PM

You can find an explanation what's going on here.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users