Jump to content



Photo

Active Directory UDF - Help & Support


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

#21 neric77

neric77

    Seeker

  • Active Members
  • 6 posts

Posted 16 February 2010 - 08:07 AM

Works fine for me on locked objects.
Did you try the example script for _AD_IsObjectLocked? It first gets a list of locked objects and then uses _AD_IsObjectLocked on the first found object.
Or run _AD_GetObjectsLocked.au3 to get a list of all locked objects and check if your object is included.
Did you test the @error returned by _AD_IsObjectLocked in your script?

; Return values .: Success - 1, Specified object is locked ;   Failure - 0, sets @error to: ;   |0 - $sAD_Object is not locked ;   |1 - $sAD_Object could not be found

If you check a computer remember to append a "$" to the samaccountname - see the remarks in the helpfile for _AD_IsObjectLocked.

Hello water,
yes i tried the expample. It doesn't work.
_AD_GetObjectsLocked.au3 return "no objects locked".
I try this function on user account and it return 0 and @error is always at 0 too whereas the account is really locked.
_AD_UnlockObject works fine.
I don't know where to search.

Thx for your help







#22 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 16 February 2010 - 11:42 AM

Hello water,
yes i tried the expample. It doesn't work.
_AD_GetObjectsLocked.au3 return "no objects locked".
I try this function on user account and it return 0 and @error is always at 0 too whereas the account is really locked.
_AD_UnlockObject works fine.
I don't know where to search.

Thx for your help

If _AD_GetObjectsLocked doesn't find any locked objects then there are no locked objects in your AD.:mellow:
What makes you think that the user account is locked?
Could you please try _AD_GetObjectsDisabled? Maybe the user account isn't locked but disabled.

Another try: Download Sysinternals Active Directory Explorer. No installation required, just run the exe. Check if the user account is locked (attribute lockouttime has to be set). If the user account is disabled then the UserAccountControl is set to 514 (= normal account + disabled)

Edited by water, 16 February 2010 - 03:18 PM.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#23 neric77

neric77

    Seeker

  • Active Members
  • 6 posts

Posted 17 February 2010 - 09:53 AM

The function _AD_IsObjectLocked always return me that the account is not locked. when i verify with dsa.msc, it's really locked.
When i run _AD_UnlockObject on the same account it's working.

I tried adexplorer and userAccountControl is set to 512 and badpasswdcount is set to 3.

No one, had the same problem?

Edited by neric77, 17 February 2010 - 09:53 AM.


#24 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 17 February 2010 - 11:50 AM

I tried adexplorer and userAccountControl is set to 512 and badpasswdcount is set to 3.

512 means: Normal account. If it is locked it is BitOred with 0x10. A normal account which is locked hast 512+16 = 528.
If you get 512 as userAccountControl then the user isn't locked.
_AD_UnlockObject doesn't return an error when the object isn't locked before.

What does dsa.msc show (screenshot)? What's the value of userAccountControl? And what is the value of lockouttime?

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#25 neric77

neric77

    Seeker

  • Active Members
  • 6 posts

Posted 17 February 2010 - 01:38 PM

512 means: Normal account. If it is locked it is BitOred with 0x10. A normal account which is locked hast 512+16 = 528.
If you get 512 as userAccountControl then the user isn't locked.
_AD_UnlockObject doesn't return an error when the object isn't locked before.

What does dsa.msc show (screenshot)? What's the value of userAccountControl? And what is the value of lockouttime?

dsa.msc

adexplorer

Edited by neric77, 17 February 2010 - 01:46 PM.


#26 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 17 February 2010 - 02:09 PM

Oh, I see. I converted this function from a script I found on the internet - but unfortunately it doesn't seem to be so easy!
Can you please run this vbscript and check if it returns a valid result?

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#27 neric77

neric77

    Seeker

  • Active Members
  • 6 posts

Posted 18 February 2010 - 06:55 AM

Oh, I see. I converted this function from a script I found on the internet - but unfortunately it doesn't seem to be so easy!
Can you please run this vbscript and check if it returns a valid result?


Water

That works.

#28 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 18 February 2010 - 10:52 AM

OK, I will have to do some further investigation. The end of the lockout time has to be calculated (and needs a lot more code compared to just query an attribute).
With Windows 2008 it seems to be possible to have more than one password policy. At the moment I'm not sure how to get the correct values to calculate the end of the password time.
I fear you'll have to be patient till I come up with an accurate function :mellow:

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#29 neric77

neric77

    Seeker

  • Active Members
  • 6 posts

Posted 18 February 2010 - 03:15 PM

OK, I will have to do some further investigation. The end of the lockout time has to be calculated (and needs a lot more code compared to just query an attribute).
With Windows 2008 it seems to be possible to have more than one password policy. At the moment I'm not sure how to get the correct values to calculate the end of the password time.
I fear you'll have to be patient till I come up with an accurate function :mellow:


No problem Water.I'll be wait.

Many Thanks.

#30 chipDE

chipDE

    Seeker

  • Active Members
  • 20 posts

Posted 22 February 2010 - 01:42 PM

Hi,

how do I get with _AD_GetObjectsInOU() only the pc?

#31 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 22 February 2010 - 01:56 PM

Hi,

how do I get with _AD_GetObjectsInOU() only the pc?

First thing you have to know is that the SamAccountName of a PC (written in Autoit): @Computername & "$".
So the statement should look like:
$sComputer = @ComputerName & "$" $aObjects = _AD_GetObjectsInOU($sOU, "(&(objectclass=computer)(samaccountname=" & $sComputer & "))" , 2, "sAMAccountName,distinguishedName")

Edited by water, 22 February 2010 - 01:57 PM.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#32 chipDE

chipDE

    Seeker

  • Active Members
  • 20 posts

Posted 22 February 2010 - 02:03 PM

Not only my pc, i need all objecty from typ PC in the OU but not the usergroups, user, ect..

Edit:

ok, i have it:

$test = _AD_GetObjectsInOU($OU, "(&(objectclass=computer))", 2, "sAMAccountName,distinguishedName")

Edited by chipDE, 22 February 2010 - 02:12 PM.


#33 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 22 February 2010 - 04:23 PM

$test = _AD_GetObjectsInOU($OU, "(&(objectclass=computer))", 2, "sAMAccountName,distinguishedName")

You can strip it down to:
$test = _AD_GetObjectsInOU($OU, "(objectclass=computer)", 2, "sAMAccountName,distinguishedName")


BTW: A good place to start with LDAP is this M$ article.

Edited by water, 22 February 2010 - 04:36 PM.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#34 chipDE

chipDE

    Seeker

  • Active Members
  • 20 posts

Posted 23 February 2010 - 06:26 AM

Hi,

how can I activate/disable a GPO in an OU?

#35 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 23 February 2010 - 06:42 AM

Hi,

how can I activate/disable a GPO in an OU?

With the AD UDF you can't - at the moment. This would be a complete new area for the UDF - and for me.
To start with such a new task

  • there should be a need for this by many users
  • there should be some users providing examples in visual basic so I can convert them
  • there should be some users willing to test the readonly and the update/change functions
At the moment the Email functions - and debugging - have a higher priority.

@Everyone: Please post here if you'd like to see GPO functions in the AD UDF and what you can contribute.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#36 chipDE

chipDE

    Seeker

  • Active Members
  • 20 posts

Posted 23 February 2010 - 09:24 AM

I have many vbs scripts to manage the GPO, but I can not upload here. Here is the link to the German thread with the examples:

http://autoit.de/index.php?page=Thread&postID=140369#post140369

Edited by chipDE, 23 February 2010 - 09:36 AM.


#37 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 23 February 2010 - 10:55 AM

Ok, I will have a look at it.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#38 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 01 March 2010 - 08:03 AM

Hi chipDE,
I had a look at the GPO scripts. Seems rather complex. I have no knowledge of GPO and the VBScript/Javascript code that is used.
Maybe it's a better idea to check the need for GPO functions first. If enough users need them then convert them to AutoIt.

Edited by water, 01 March 2010 - 09:29 AM.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#39 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 08 March 2010 - 12:42 PM

Version 0.37 has been released. Starting next Monday I will be on vacation for two weeks. Therefore I wanted to release the new version some days in advance.
For download please see signature.

Edited by water, 10 March 2010 - 07:50 AM.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#40 water

water

    ?

  • MVPs
  • 10,695 posts

Posted 13 March 2010 - 01:19 PM

Function _AD_DisablePasswordExpire doesn't work :mellow: Can Somebody fix it ???

Could you please check @error and @extended after the function call:
$Result = _AD_DisablePasswordExpire("SamAccountName or FQDN") MsgBox(0,"","Result: " & $Result & ", error: " & @error & ", extended: " & @extended)

What do you get?

N.B: Starting Monday I will be on vacation for 2 weeks.

Edited by water, 14 March 2010 - 12:48 PM.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users