Jump to content
water

Active Directory UDF - Help & Support (III)

Recommended Posts

The UDF keeps the connection open until you close it.

Could you use a

Consolewrite(@MIN & ":" & @SEC & "." & @MSEC & @LF)

after each call to a _AD_* function so we know where the time is being spent?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi, the function _AD_IsObjectLocked does always return 0
 

This code ist working:

Func _IsObjectLocked($sFQDN)
    $objuser = ObjGet("LDAP://" & $sFQDN)
    $objLockout = $objUser.get("lockouttime")

    If Not IsObj($objLockout) Then Return ;not locked

    If $objLockout.lowpart = 0 And $objLockout.highpart = 0 Then
        Return ;not locked
    Else
        Return 1 ;locked
    EndIf
EndFunc

Maybe you can merge this somehow...

Share this post


Link to post
Share on other sites

Which version of the UDF do you use?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Did it work with an older version of the UDF?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Did it work with an older version of the UDF?

 

I don't have an older version...where can I get?

Share this post


Link to post
Share on other sites

Never mind. It should work with the current version anyway.

Can you please post the code you use with _AD_IsObjectLocked?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Never mind. It should work with the current version anyway.

Can you please post the code you use with _AD_IsObjectLocked?

#include <AD.au3>

_AD_Open()

If _AD_IsObjectLocked("timtest") Then
    ConsoleWrite("locked" & @CRLF)
Else
    ConsoleWrite("not locked" & @CRLF)
EndIf

_AD_Close()

Always "not locked" !!!

BTW the other function _AD_UnlockObject() works fine.

Edited by Tim33

Share this post


Link to post
Share on other sites

Could you try this and post the result?

#include <AD.au3>

_AD_Open()

If _AD_IsObjectLocked("timtest") Then
    ConsoleWrite("locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
Else
    ConsoleWrite("not locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
EndIf

_AD_Close()

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Could you try this and post the result?

#include <AD.au3>

_AD_Open()

If _AD_IsObjectLocked("timtest") Then
    ConsoleWrite("locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
Else
    ConsoleWrite("not locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
EndIf

_AD_Close()

 

 

>"C:ProgrammeAutoIt3SciTEAutoIt3WrapperAutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:AutoItislockedtest.au3" /UserParams    

+>13:06:31 Starting AutoIt3Wrapper v.2.2.0.0 SciTE v.3.4.1.0   Keyboard:00000407  OS:WIN_XP/Service Pack 3  CPU:X64 OS:X86    Environment(Language:0407)

+>         SciTEDir => C:ProgrammeAutoIt3SciTE

>Running AU3Check (3.3.10.2)  from:C:ProgrammeAutoIt3  input:C:AutoItislockedtest.au3

+>13:06:31 AU3Check ended.rc:0

>Running:(3.3.10.2):C:ProgrammeAutoIt3autoit3.exe "C:AutoItislockedtest.au3"    

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop

not locked. @error = 0, @extened = 0

+>13:06:32 AutoIt3.exe ended.rc:0

+>13:06:32 AutoIt3Wrapper Finished.

>Exit code: 0    Time: 1.028

Share this post


Link to post
Share on other sites

OK. So no error happened.

Another try to get better error information:

#include <AD.au3>
 _AD_Open()
 If _AD_IsObjectLockedEX("timtest") Then
     ConsoleWrite("locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
 Else     
ConsoleWrite("not locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
_AD_Close()
EndIf

Func _AD_IsObjectLockedEX($sObject = @UserName)

    If Not _AD_ObjectExists($sObject) Then Return SetError(1, 0, 0)
    Local $sProperty = "sAMAccountName"
    If StringMid($sObject, 3, 1) = "=" Then $sProperty = "distinguishedName"; FQDN provided
    $__oAD_Command.CommandText = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(" & $sProperty & "=" & $sObject & ");ADsPath;subtree"
    Local $oRecordSet = $__oAD_Command.Execute ; Retrieve the ADsPath for the object
    Local $sLDAPEntry = $oRecordSet.fields(0).Value
    Local $oObject = __AD_ObjGet($sLDAPEntry) ; Retrieve the COM Object for the object
    Local $oLockoutTime = $oObject.LockoutTime
    ; Object is not locked out
    If Not IsObj($oLockoutTime) Then Return SetError(10, 0, 0)
    ; Calculate lockout time (UTC)
    Local $sLockoutTime = _DateAdd("s", Int(__AD_LargeInt2Double($oLockoutTime.LowPart, $oLockoutTime.HighPart) / (10000000)), "1601/01/01 00:00:00")
    ; Object is not locked out
    If $sLockoutTime = "1601/01/01 00:00:00" Then Return SetError(11, 0, 0)
    ; Get password info - Account Lockout Duration
    Local $aTemp = _AD_GetPasswordInfo($sObject)
    ; if lockout duration is 0 (= unlock manually by admin needed) then no calculation is necessary. Set @error to -1 (minutes till the account is unlocked)
    If $aTemp[5] = 0 Then Return SetError(-1, 0, 1)
    ; Calculate when the lockout will be reset
    Local $sResetLockoutTime = _DateAdd("n", $aTemp[5], $sLockoutTime)
    ; Compare to current date/time (UTC)
    Local $sNow = _Date_Time_GetSystemTime()
    $sNow = _Date_Time_SystemTimeToDateTimeStr($sNow, 1)
    If $sResetLockoutTime >= $sNow Then Return SetError(_DateDiff("n", $sNow, $sResetLockoutTime), 0, 1)
        Return SetError(12, 0, 0)

EndFunc   ;==>_AD_IsObjectLocked

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

 

OK. So no error happened.

Another try to get better error information:

#include <AD.au3>
 _AD_Open()
 If _AD_IsObjectLockedEX("timtest") Then
     ConsoleWrite("locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
 Else     
ConsoleWrite("not locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
_AD_Close()
EndIf

Func _AD_IsObjectLockedEX($sObject = @UserName)

    If Not _AD_ObjectExists($sObject) Then Return SetError(1, 0, 0)
    Local $sProperty = "sAMAccountName"
    If StringMid($sObject, 3, 1) = "=" Then $sProperty = "distinguishedName"; FQDN provided
    $__oAD_Command.CommandText = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(" & $sProperty & "=" & $sObject & ");ADsPath;subtree"
    Local $oRecordSet = $__oAD_Command.Execute ; Retrieve the ADsPath for the object
    Local $sLDAPEntry = $oRecordSet.fields(0).Value
    Local $oObject = __AD_ObjGet($sLDAPEntry) ; Retrieve the COM Object for the object
    Local $oLockoutTime = $oObject.LockoutTime
    ; Object is not locked out
    If Not IsObj($oLockoutTime) Then Return SetError(10, 0, 0)
    ; Calculate lockout time (UTC)
    Local $sLockoutTime = _DateAdd("s", Int(__AD_LargeInt2Double($oLockoutTime.LowPart, $oLockoutTime.HighPart) / (10000000)), "1601/01/01 00:00:00")
    ; Object is not locked out
    If $sLockoutTime = "1601/01/01 00:00:00" Then Return SetError(11, 0, 0)
    ; Get password info - Account Lockout Duration
    Local $aTemp = _AD_GetPasswordInfo($sObject)
    ; if lockout duration is 0 (= unlock manually by admin needed) then no calculation is necessary. Set @error to -1 (minutes till the account is unlocked)
    If $aTemp[5] = 0 Then Return SetError(-1, 0, 1)
    ; Calculate when the lockout will be reset
    Local $sResetLockoutTime = _DateAdd("n", $aTemp[5], $sLockoutTime)
    ; Compare to current date/time (UTC)
    Local $sNow = _Date_Time_GetSystemTime()
    $sNow = _Date_Time_SystemTimeToDateTimeStr($sNow, 1)
    If $sResetLockoutTime >= $sNow Then Return SetError(_DateDiff("n", $sNow, $sResetLockoutTime), 0, 1)
        Return SetError(12, 0, 0)

EndFunc   ;==>_AD_IsObjectLocked

 

Yes custimzed SORRY :)

now it works:

>Running AU3Check (3.3.10.2)  from:C:ProgrammeAutoIt3  input:C:AutoItislockedtest.au3

+>14:16:29 AU3Check ended.rc:0

>Running:(3.3.10.2):C:ProgrammeAutoIt3autoit3.exe "C:AutoItislockedtest.au3"    

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop

not locked. @error = 12, @extened = 0

+>14:16:30 AutoIt3.exe ended.rc:0

+>14:16:30 AutoIt3Wrapper Finished.

>Exit code: 0    Time: 1.192

Edited by Tim33

Share this post


Link to post
Share on other sites

I copied your code and it runs just fine here. I use AutoIt 3.3.1.0.2 as well.

Do you have a custimzed version of the AD UDF lying around somewhre?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Water,

I outputted the _AD_ timings to a VAR and then dumped it results to a file. Please find the contents below. Also, I used _AD_Open only once.

The times for Windows 8:

09:10:30.444 - _AD_GetGroupMembers - Start
09:10:30.694 - _AD_GetGroupMembers - End
09:10:30.694 - _AD_GetObjectProperties For 115 Users.
09:10:30.694 - _AD_GetObjectProperties For User 1 - Start
09:10:42.913 - _AD_GetObjectProperties For User 1 - End
09:10:42.913 - _AD_GetObjectProperties For User 2 - Start
09:10:49.038 - _AD_GetObjectProperties For User 2 - End
09:10:49.038 - _AD_GetObjectProperties For User 3 - Start
09:11:01.304 - _AD_GetObjectProperties For User 3 - End
09:11:01.304 - _AD_GetObjectProperties For User 4 - Start
09:11:10.570 - _AD_GetObjectProperties For User 4 - End
09:11:10.570 - _AD_GetObjectProperties For User 5 - Start
09:11:18.461 - _AD_GetObjectProperties For User 5 - End
09:11:18.461 - _AD_GetObjectProperties For User 6 - Start
09:11:27.759 - _AD_GetObjectProperties For User 6 - End
09:11:27.759 - _AD_GetObjectProperties For User 7 - Start
09:11:41.431 - _AD_GetObjectProperties For User 7 - End
09:11:41.431 - _AD_GetObjectProperties For User 8 - Start
09:11:51.213 - _AD_GetObjectProperties For User 8 - End
09:11:51.213 - _AD_GetObjectProperties For User 9 - Start
09:12:00.026 - _AD_GetObjectProperties For User 9 - End
09:12:00.026 - _AD_GetObjectProperties For User 10 - Start
09:12:11.058 - _AD_GetObjectProperties For User 10 - End
09:12:11.058 - _AD_GetObjectProperties For User 11 - Start
09:12:20.730 - _AD_GetObjectProperties For User 11 - End
09:12:20.730 - _AD_GetObjectProperties For User 12 - Start
09:12:24.793 - _AD_GetObjectProperties For User 12 - End
09:12:24.793 - _AD_GetObjectProperties For User 13 - Start
09:12:35.278 - _AD_GetObjectProperties For User 13 - End
09:12:35.278 - _AD_GetObjectProperties For User 14 - Start
09:12:47.263 - _AD_GetObjectProperties For User 14 - End
09:12:47.263 - _AD_GetObjectProperties For User 15 - Start
09:12:59.795 - _AD_GetObjectProperties For User 15 - End
09:12:59.795 - _AD_GetObjectProperties For User 16 - Start
09:13:03.576 - _AD_GetObjectProperties For User 16 - End
09:13:03.576 - _AD_GetObjectProperties For User 17 - Start
09:13:16.389 - _AD_GetObjectProperties For User 17 - End
09:13:16.389 - _AD_GetObjectProperties For User 18 - Start
09:13:26.890 - _AD_GetObjectProperties For User 18 - End
09:13:26.890 - _AD_GetObjectProperties For User 19 - Start
09:13:37.749 - _AD_GetObjectProperties For User 19 - End
09:13:37.749 - _AD_GetObjectProperties For User 20 - Start
09:13:45.328 - _AD_GetObjectProperties For User 20 - End
09:13:45.328 - _AD_GetObjectProperties For User 21 - Start
09:13:56.735 - _AD_GetObjectProperties For User 21 - End
09:13:56.735 - _AD_GetObjectProperties For User 22 - Start
09:14:10.579 - _AD_GetObjectProperties For User 22 - End
09:14:10.579 - _AD_GetObjectProperties For User 23 - Start
09:14:21.595 - _AD_GetObjectProperties For User 23 - End
09:14:21.595 - _AD_GetObjectProperties For User 24 - Start
09:14:32.049 - _AD_GetObjectProperties For User 24 - End
09:14:32.049 - _AD_GetObjectProperties For User 25 - Start
09:14:43.112 - _AD_GetObjectProperties For User 25 - End
09:14:43.112 - _AD_GetObjectProperties For User 26 - Start
09:14:55.113 - _AD_GetObjectProperties For User 26 - End
09:14:55.113 - _AD_GetObjectProperties For User 27 - Start
09:15:06.066 - _AD_GetObjectProperties For User 27 - End
09:15:06.066 - _AD_GetObjectProperties For User 28 - Start
09:15:14.551 - _AD_GetObjectProperties For User 28 - End
09:15:14.551 - _AD_GetObjectProperties For User 29 - Start
09:15:22.911 - _AD_GetObjectProperties For User 29 - End
09:15:22.911 - _AD_GetObjectProperties For User 30 - Start
09:15:31.755 - _AD_GetObjectProperties For User 30 - End
09:15:31.755 - _AD_GetObjectProperties For User 31 - Start
09:15:41.287 - _AD_GetObjectProperties For User 31 - End
09:15:41.287 - _AD_GetObjectProperties For User 32 - Start
09:15:49.303 - _AD_GetObjectProperties For User 32 - End
09:15:49.303 - _AD_GetObjectProperties For User 33 - Start
09:15:59.506 - _AD_GetObjectProperties For User 33 - End
09:15:59.506 - _AD_GetObjectProperties For User 34 - Start
09:16:09.647 - _AD_GetObjectProperties For User 34 - End
09:16:09.647 - _AD_GetObjectProperties For User 35 - Start
09:16:20.085 - _AD_GetObjectProperties For User 35 - End
09:16:20.085 - _AD_GetObjectProperties For User 36 - Start
09:16:31.727 - _AD_GetObjectProperties For User 36 - End
09:16:31.727 - _AD_GetObjectProperties For User 37 - Start
09:16:41.899 - _AD_GetObjectProperties For User 37 - End
09:16:41.899 - _AD_GetObjectProperties For User 38 - Start
09:16:52.618 - _AD_GetObjectProperties For User 38 - End
09:16:52.618 - _AD_GetObjectProperties For User 39 - Start
09:17:05.775 - _AD_GetObjectProperties For User 39 - End
09:17:05.775 - _AD_GetObjectProperties For User 40 - Start
09:17:17.494 - _AD_GetObjectProperties For User 40 - End
09:17:17.494 - _AD_GetObjectProperties For User 41 - Start
09:17:26.511 - _AD_GetObjectProperties For User 41 - End
09:17:26.511 - _AD_GetObjectProperties For User 42 - Start
09:17:37.605 - _AD_GetObjectProperties For User 42 - End
09:17:37.605 - _AD_GetObjectProperties For User 43 - Start
09:17:51.262 - _AD_GetObjectProperties For User 43 - End
09:17:51.262 - _AD_GetObjectProperties For User 44 - Start
09:18:01.325 - _AD_GetObjectProperties For User 44 - End
09:18:01.325 - _AD_GetObjectProperties For User 45 - Start
09:18:11.935 - _AD_GetObjectProperties For User 45 - End
09:18:11.935 - _AD_GetObjectProperties For User 46 - Start
09:18:20.498 - _AD_GetObjectProperties For User 46 - End
09:18:20.498 - _AD_GetObjectProperties For User 47 - Start
09:18:30.107 - _AD_GetObjectProperties For User 47 - End
09:18:30.107 - _AD_GetObjectProperties For User 48 - Start
09:18:41.874 - _AD_GetObjectProperties For User 48 - End
09:18:41.874 - _AD_GetObjectProperties For User 49 - Start
09:18:53.905 - _AD_GetObjectProperties For User 49 - End
09:18:53.905 - _AD_GetObjectProperties For User 50 - Start
09:19:03.296 - _AD_GetObjectProperties For User 50 - End
09:19:03.296 - _AD_GetObjectProperties For User 51 - Start
09:19:14.203 - _AD_GetObjectProperties For User 51 - End
09:19:14.203 - _AD_GetObjectProperties For User 52 - Start
09:19:25.985 - _AD_GetObjectProperties For User 52 - End
09:19:25.985 - _AD_GetObjectProperties For User 53 - Start
09:19:40.517 - _AD_GetObjectProperties For User 53 - End
09:19:40.517 - _AD_GetObjectProperties For User 54 - Start
09:19:52.580 - _AD_GetObjectProperties For User 54 - End
09:19:52.580 - _AD_GetObjectProperties For User 55 - Start
09:20:01.956 - _AD_GetObjectProperties For User 55 - End
09:20:01.956 - _AD_GetObjectProperties For User 56 - Start
09:20:11.315 - _AD_GetObjectProperties For User 56 - End
09:20:11.315 - _AD_GetObjectProperties For User 57 - Start
09:20:21.378 - _AD_GetObjectProperties For User 57 - End
09:20:21.378 - _AD_GetObjectProperties For User 58 - Start
09:20:32.504 - _AD_GetObjectProperties For User 58 - End
09:20:32.504 - _AD_GetObjectProperties For User 59 - Start
09:20:43.692 - _AD_GetObjectProperties For User 59 - End
09:20:43.692 - _AD_GetObjectProperties For User 60 - Start
09:20:55.646 - _AD_GetObjectProperties For User 60 - End
09:20:55.646 - _AD_GetObjectProperties For User 61 - Start
09:21:09.178 - _AD_GetObjectProperties For User 61 - End
09:21:09.178 - _AD_GetObjectProperties For User 62 - Start
09:21:20.787 - _AD_GetObjectProperties For User 62 - End
09:21:20.787 - _AD_GetObjectProperties For User 63 - Start
09:21:32.241 - _AD_GetObjectProperties For User 63 - End
09:21:32.241 - _AD_GetObjectProperties For User 64 - Start
09:21:45.523 - _AD_GetObjectProperties For User 64 - End
09:21:45.523 - _AD_GetObjectProperties For User 65 - Start
09:21:57.524 - _AD_GetObjectProperties For User 65 - End
09:21:57.524 - _AD_GetObjectProperties For User 66 - Start
09:22:11.556 - _AD_GetObjectProperties For User 66 - End
09:22:11.556 - _AD_GetObjectProperties For User 67 - Start
09:22:23.228 - _AD_GetObjectProperties For User 67 - End
09:22:23.228 - _AD_GetObjectProperties For User 68 - Start
09:22:33.478 - _AD_GetObjectProperties For User 68 - End
09:22:33.478 - _AD_GetObjectProperties For User 69 - Start
09:22:47.010 - _AD_GetObjectProperties For User 69 - End
09:22:47.010 - _AD_GetObjectProperties For User 70 - Start
09:22:59.605 - _AD_GetObjectProperties For User 70 - End
09:22:59.605 - _AD_GetObjectProperties For User 71 - Start
09:23:13.340 - _AD_GetObjectProperties For User 71 - End
09:23:13.340 - _AD_GetObjectProperties For User 72 - Start
09:23:27.481 - _AD_GetObjectProperties For User 72 - End
09:23:27.481 - _AD_GetObjectProperties For User 73 - Start
09:23:39.435 - _AD_GetObjectProperties For User 73 - End
09:23:39.435 - _AD_GetObjectProperties For User 74 - Start
09:23:52.904 - _AD_GetObjectProperties For User 74 - End
09:23:52.904 - _AD_GetObjectProperties For User 75 - Start
09:24:03.936 - _AD_GetObjectProperties For User 75 - End
09:24:03.936 - _AD_GetObjectProperties For User 76 - Start
09:24:14.405 - _AD_GetObjectProperties For User 76 - End
09:24:14.405 - _AD_GetObjectProperties For User 77 - Start
09:24:25.250 - _AD_GetObjectProperties For User 77 - End
09:24:25.250 - _AD_GetObjectProperties For User 78 - Start
09:24:35.969 - _AD_GetObjectProperties For User 78 - End
09:24:35.969 - _AD_GetObjectProperties For User 79 - Start
09:24:47.985 - _AD_GetObjectProperties For User 79 - End
09:24:47.985 - _AD_GetObjectProperties For User 80 - Start
09:25:02.033 - _AD_GetObjectProperties For User 80 - End
09:25:02.033 - _AD_GetObjectProperties For User 81 - Start
09:25:13.767 - _AD_GetObjectProperties For User 81 - End
09:25:13.767 - _AD_GetObjectProperties For User 82 - Start
09:25:27.518 - _AD_GetObjectProperties For User 82 - End
09:25:27.518 - _AD_GetObjectProperties For User 83 - Start
09:25:38.972 - _AD_GetObjectProperties For User 83 - End
09:25:38.972 - _AD_GetObjectProperties For User 84 - Start
09:25:53.473 - _AD_GetObjectProperties For User 84 - End
09:25:53.473 - _AD_GetObjectProperties For User 85 - Start
09:26:08.114 - _AD_GetObjectProperties For User 85 - End
09:26:08.114 - _AD_GetObjectProperties For User 86 - Start
09:26:23.802 - _AD_GetObjectProperties For User 86 - End
09:26:23.802 - _AD_GetObjectProperties For User 87 - Start
09:26:36.037 - _AD_GetObjectProperties For User 87 - End
09:26:36.037 - _AD_GetObjectProperties For User 88 - Start
09:26:52.100 - _AD_GetObjectProperties For User 88 - End
09:26:52.100 - _AD_GetObjectProperties For User 89 - Start
09:27:04.257 - _AD_GetObjectProperties For User 89 - End
09:27:04.257 - _AD_GetObjectProperties For User 90 - Start
09:27:20.680 - _AD_GetObjectProperties For User 90 - End
09:27:20.680 - _AD_GetObjectProperties For User 91 - Start
09:27:36.806 - _AD_GetObjectProperties For User 91 - End
09:27:36.806 - _AD_GetObjectProperties For User 92 - Start
09:27:52.588 - _AD_GetObjectProperties For User 92 - End
09:27:52.588 - _AD_GetObjectProperties For User 93 - Start
09:28:08.432 - _AD_GetObjectProperties For User 93 - End
09:28:08.432 - _AD_GetObjectProperties For User 94 - Start
09:28:25.058 - _AD_GetObjectProperties For User 94 - End
09:28:25.058 - _AD_GetObjectProperties For User 95 - Start
09:28:41.699 - _AD_GetObjectProperties For User 95 - End
09:28:41.699 - _AD_GetObjectProperties For User 96 - Start
09:28:57.716 - _AD_GetObjectProperties For User 96 - End
09:28:57.716 - _AD_GetObjectProperties For User 97 - Start
09:29:15.045 - _AD_GetObjectProperties For User 97 - End
09:29:15.045 - _AD_GetObjectProperties For User 98 - Start
09:29:30.061 - _AD_GetObjectProperties For User 98 - End
09:29:30.061 - _AD_GetObjectProperties For User 99 - Start
09:29:45.812 - _AD_GetObjectProperties For User 99 - End
09:29:45.812 - _AD_GetObjectProperties For User 100 - Start
09:30:01.891 - _AD_GetObjectProperties For User 100 - End
09:30:01.891 - _AD_GetObjectProperties For User 101 - Start
09:30:17.813 - _AD_GetObjectProperties For User 101 - End
09:30:17.813 - _AD_GetObjectProperties For User 102 - Start
09:30:34.252 - _AD_GetObjectProperties For User 102 - End
09:30:34.252 - _AD_GetObjectProperties For User 103 - Start
09:30:50.049 - _AD_GetObjectProperties For User 103 - End
09:30:50.049 - _AD_GetObjectProperties For User 104 - Start
09:31:07.722 - _AD_GetObjectProperties For User 104 - End
09:31:07.722 - _AD_GetObjectProperties For User 105 - Start
09:31:23.676 - _AD_GetObjectProperties For User 105 - End
09:31:23.676 - _AD_GetObjectProperties For User 106 - Start
09:31:38.864 - _AD_GetObjectProperties For User 106 - End
09:31:38.864 - _AD_GetObjectProperties For User 107 - Start
09:31:54.849 - _AD_GetObjectProperties For User 107 - End
09:31:54.849 - _AD_GetObjectProperties For User 108 - Start
09:32:10.866 - _AD_GetObjectProperties For User 108 - End
09:32:10.866 - _AD_GetObjectProperties For User 109 - Start
09:32:26.929 - _AD_GetObjectProperties For User 109 - End
09:32:26.929 - _AD_GetObjectProperties For User 110 - Start
09:32:43.305 - _AD_GetObjectProperties For User 110 - End
09:32:43.305 - _AD_GetObjectProperties For User 111 - Start
09:32:59.056 - _AD_GetObjectProperties For User 111 - End
09:32:59.056 - _AD_GetObjectProperties For User 112 - Start
09:33:15.275 - _AD_GetObjectProperties For User 112 - End
09:33:15.275 - _AD_GetObjectProperties For User 113 - Start
09:33:31.557 - _AD_GetObjectProperties For User 113 - End
09:33:31.557 - _AD_GetObjectProperties For User 114 - Start
09:33:47.667 - _AD_GetObjectProperties For User 114 - End
09:33:47.667 - _AD_GetObjectProperties For User 115 - Start
09:34:03.887 - _AD_GetObjectProperties For User 115 - End

The same script times for Windows 7:

09:51:43.737 - _AD_GetGroupMembers - Start
09:51:44.017 - _AD_GetGroupMembers - End
09:51:44.017 - _AD_GetObjectProperties For 115 Users.
09:51:44.017 - _AD_GetObjectProperties For User 1 - Start
09:51:44.259 - _AD_GetObjectProperties For User 1 - End
09:51:44.259 - _AD_GetObjectProperties For User 2 - Start
09:51:44.357 - _AD_GetObjectProperties For User 2 - End
09:51:44.357 - _AD_GetObjectProperties For User 3 - Start
09:51:44.522 - _AD_GetObjectProperties For User 3 - End
09:51:44.522 - _AD_GetObjectProperties For User 4 - Start
09:51:44.690 - _AD_GetObjectProperties For User 4 - End
09:51:44.690 - _AD_GetObjectProperties For User 5 - Start
09:51:44.863 - _AD_GetObjectProperties For User 5 - End
09:51:44.863 - _AD_GetObjectProperties For User 6 - Start
09:51:45.038 - _AD_GetObjectProperties For User 6 - End
09:51:45.038 - _AD_GetObjectProperties For User 7 - Start
09:51:45.264 - _AD_GetObjectProperties For User 7 - End
09:51:45.264 - _AD_GetObjectProperties For User 8 - Start
09:51:45.438 - _AD_GetObjectProperties For User 8 - End
09:51:45.438 - _AD_GetObjectProperties For User 9 - Start
09:51:45.608 - _AD_GetObjectProperties For User 9 - End
09:51:45.609 - _AD_GetObjectProperties For User 10 - Start
09:51:45.783 - _AD_GetObjectProperties For User 10 - End
09:51:45.783 - _AD_GetObjectProperties For User 11 - Start
09:51:45.959 - _AD_GetObjectProperties For User 11 - End
09:51:45.959 - _AD_GetObjectProperties For User 12 - Start
09:51:46.057 - _AD_GetObjectProperties For User 12 - End
09:51:46.057 - _AD_GetObjectProperties For User 13 - Start
09:51:46.238 - _AD_GetObjectProperties For User 13 - End
09:51:46.238 - _AD_GetObjectProperties For User 14 - Start
09:51:46.444 - _AD_GetObjectProperties For User 14 - End
09:51:46.444 - _AD_GetObjectProperties For User 15 - Start
09:51:46.622 - _AD_GetObjectProperties For User 15 - End
09:51:46.622 - _AD_GetObjectProperties For User 16 - Start
09:51:46.768 - _AD_GetObjectProperties For User 16 - End
09:51:46.768 - _AD_GetObjectProperties For User 17 - Start
09:51:46.992 - _AD_GetObjectProperties For User 17 - End
09:51:46.992 - _AD_GetObjectProperties For User 18 - Start
09:51:47.172 - _AD_GetObjectProperties For User 18 - End
09:51:47.172 - _AD_GetObjectProperties For User 19 - Start
09:51:47.351 - _AD_GetObjectProperties For User 19 - End
09:51:47.351 - _AD_GetObjectProperties For User 20 - Start
09:51:47.527 - _AD_GetObjectProperties For User 20 - End
09:51:47.528 - _AD_GetObjectProperties For User 21 - Start
09:51:47.707 - _AD_GetObjectProperties For User 21 - End
09:51:47.707 - _AD_GetObjectProperties For User 22 - Start
09:51:47.886 - _AD_GetObjectProperties For User 22 - End
09:51:47.886 - _AD_GetObjectProperties For User 23 - Start
09:51:48.083 - _AD_GetObjectProperties For User 23 - End
09:51:48.083 - _AD_GetObjectProperties For User 24 - Start
09:51:48.258 - _AD_GetObjectProperties For User 24 - End
09:51:48.258 - _AD_GetObjectProperties For User 25 - Start
09:51:48.435 - _AD_GetObjectProperties For User 25 - End
09:51:48.435 - _AD_GetObjectProperties For User 26 - Start
09:51:48.614 - _AD_GetObjectProperties For User 26 - End
09:51:48.614 - _AD_GetObjectProperties For User 27 - Start
09:51:48.789 - _AD_GetObjectProperties For User 27 - End
09:51:48.789 - _AD_GetObjectProperties For User 28 - Start
09:51:48.973 - _AD_GetObjectProperties For User 28 - End
09:51:48.973 - _AD_GetObjectProperties For User 29 - Start
09:51:49.144 - _AD_GetObjectProperties For User 29 - End
09:51:49.144 - _AD_GetObjectProperties For User 30 - Start
09:51:49.319 - _AD_GetObjectProperties For User 30 - End
09:51:49.319 - _AD_GetObjectProperties For User 31 - Start
09:51:49.492 - _AD_GetObjectProperties For User 31 - End
09:51:49.492 - _AD_GetObjectProperties For User 32 - Start
09:51:49.665 - _AD_GetObjectProperties For User 32 - End
09:51:49.665 - _AD_GetObjectProperties For User 33 - Start
09:51:49.839 - _AD_GetObjectProperties For User 33 - End
09:51:49.839 - _AD_GetObjectProperties For User 34 - Start
09:51:50.007 - _AD_GetObjectProperties For User 34 - End
09:51:50.007 - _AD_GetObjectProperties For User 35 - Start
09:51:50.195 - _AD_GetObjectProperties For User 35 - End
09:51:50.195 - _AD_GetObjectProperties For User 36 - Start
09:51:50.371 - _AD_GetObjectProperties For User 36 - End
09:51:50.371 - _AD_GetObjectProperties For User 37 - Start
09:51:50.548 - _AD_GetObjectProperties For User 37 - End
09:51:50.548 - _AD_GetObjectProperties For User 38 - Start
09:51:50.725 - _AD_GetObjectProperties For User 38 - End
09:51:50.725 - _AD_GetObjectProperties For User 39 - Start
09:51:50.898 - _AD_GetObjectProperties For User 39 - End
09:51:50.898 - _AD_GetObjectProperties For User 40 - Start
09:51:51.073 - _AD_GetObjectProperties For User 40 - End
09:51:51.073 - _AD_GetObjectProperties For User 41 - Start
09:51:51.273 - _AD_GetObjectProperties For User 41 - End
09:51:51.273 - _AD_GetObjectProperties For User 42 - Start
09:51:51.471 - _AD_GetObjectProperties For User 42 - End
09:51:51.471 - _AD_GetObjectProperties For User 43 - Start
09:51:51.678 - _AD_GetObjectProperties For User 43 - End
09:51:51.678 - _AD_GetObjectProperties For User 44 - Start
09:51:51.865 - _AD_GetObjectProperties For User 44 - End
09:51:51.865 - _AD_GetObjectProperties For User 45 - Start
09:51:52.043 - _AD_GetObjectProperties For User 45 - End
09:51:52.043 - _AD_GetObjectProperties For User 46 - Start
09:51:52.256 - _AD_GetObjectProperties For User 46 - End
09:51:52.256 - _AD_GetObjectProperties For User 47 - Start
09:51:52.433 - _AD_GetObjectProperties For User 47 - End
09:51:52.433 - _AD_GetObjectProperties For User 48 - Start
09:51:52.614 - _AD_GetObjectProperties For User 48 - End
09:51:52.614 - _AD_GetObjectProperties For User 49 - Start
09:51:52.816 - _AD_GetObjectProperties For User 49 - End
09:51:52.816 - _AD_GetObjectProperties For User 50 - Start
09:51:52.995 - _AD_GetObjectProperties For User 50 - End
09:51:52.995 - _AD_GetObjectProperties For User 51 - Start
09:51:53.191 - _AD_GetObjectProperties For User 51 - End
09:51:53.191 - _AD_GetObjectProperties For User 52 - Start
09:51:53.382 - _AD_GetObjectProperties For User 52 - End
09:51:53.382 - _AD_GetObjectProperties For User 53 - Start
09:51:53.580 - _AD_GetObjectProperties For User 53 - End
09:51:53.580 - _AD_GetObjectProperties For User 54 - Start
09:51:53.777 - _AD_GetObjectProperties For User 54 - End
09:51:53.777 - _AD_GetObjectProperties For User 55 - Start
09:51:53.954 - _AD_GetObjectProperties For User 55 - End
09:51:53.954 - _AD_GetObjectProperties For User 56 - Start
09:51:54.160 - _AD_GetObjectProperties For User 56 - End
09:51:54.160 - _AD_GetObjectProperties For User 57 - Start
09:51:54.337 - _AD_GetObjectProperties For User 57 - End
09:51:54.338 - _AD_GetObjectProperties For User 58 - Start
09:51:54.531 - _AD_GetObjectProperties For User 58 - End
09:51:54.531 - _AD_GetObjectProperties For User 59 - Start
09:51:54.728 - _AD_GetObjectProperties For User 59 - End
09:51:54.728 - _AD_GetObjectProperties For User 60 - Start
09:51:54.924 - _AD_GetObjectProperties For User 60 - End
09:51:54.924 - _AD_GetObjectProperties For User 61 - Start
09:51:55.124 - _AD_GetObjectProperties For User 61 - End
09:51:55.124 - _AD_GetObjectProperties For User 62 - Start
09:51:55.321 - _AD_GetObjectProperties For User 62 - End
09:51:55.321 - _AD_GetObjectProperties For User 63 - Start
09:51:55.522 - _AD_GetObjectProperties For User 63 - End
09:51:55.522 - _AD_GetObjectProperties For User 64 - Start
09:51:55.714 - _AD_GetObjectProperties For User 64 - End
09:51:55.714 - _AD_GetObjectProperties For User 65 - Start
09:51:55.916 - _AD_GetObjectProperties For User 65 - End
09:51:55.916 - _AD_GetObjectProperties For User 66 - Start
09:51:56.120 - _AD_GetObjectProperties For User 66 - End
09:51:56.120 - _AD_GetObjectProperties For User 67 - Start
09:51:56.320 - _AD_GetObjectProperties For User 67 - End
09:51:56.320 - _AD_GetObjectProperties For User 68 - Start
09:51:56.518 - _AD_GetObjectProperties For User 68 - End
09:51:56.518 - _AD_GetObjectProperties For User 69 - Start
09:51:56.715 - _AD_GetObjectProperties For User 69 - End
09:51:56.715 - _AD_GetObjectProperties For User 70 - Start
09:51:56.913 - _AD_GetObjectProperties For User 70 - End
09:51:56.913 - _AD_GetObjectProperties For User 71 - Start
09:51:57.113 - _AD_GetObjectProperties For User 71 - End
09:51:57.113 - _AD_GetObjectProperties For User 72 - Start
09:51:57.313 - _AD_GetObjectProperties For User 72 - End
09:51:57.313 - _AD_GetObjectProperties For User 73 - Start
09:51:57.508 - _AD_GetObjectProperties For User 73 - End
09:51:57.508 - _AD_GetObjectProperties For User 74 - Start
09:51:57.711 - _AD_GetObjectProperties For User 74 - End
09:51:57.711 - _AD_GetObjectProperties For User 75 - Start
09:51:57.917 - _AD_GetObjectProperties For User 75 - End
09:51:57.917 - _AD_GetObjectProperties For User 76 - Start
09:51:58.133 - _AD_GetObjectProperties For User 76 - End
09:51:58.133 - _AD_GetObjectProperties For User 77 - Start
09:51:58.340 - _AD_GetObjectProperties For User 77 - End
09:51:58.340 - _AD_GetObjectProperties For User 78 - Start
09:51:58.542 - _AD_GetObjectProperties For User 78 - End
09:51:58.542 - _AD_GetObjectProperties For User 79 - Start
09:51:58.750 - _AD_GetObjectProperties For User 79 - End
09:51:58.750 - _AD_GetObjectProperties For User 80 - Start
09:51:58.970 - _AD_GetObjectProperties For User 80 - End
09:51:58.970 - _AD_GetObjectProperties For User 81 - Start
09:51:59.182 - _AD_GetObjectProperties For User 81 - End
09:51:59.182 - _AD_GetObjectProperties For User 82 - Start
09:51:59.383 - _AD_GetObjectProperties For User 82 - End
09:51:59.383 - _AD_GetObjectProperties For User 83 - Start
09:51:59.583 - _AD_GetObjectProperties For User 83 - End
09:51:59.583 - _AD_GetObjectProperties For User 84 - Start
09:51:59.789 - _AD_GetObjectProperties For User 84 - End
09:51:59.789 - _AD_GetObjectProperties For User 85 - Start
09:51:59.985 - _AD_GetObjectProperties For User 85 - End
09:51:59.985 - _AD_GetObjectProperties For User 86 - Start
09:52:00.194 - _AD_GetObjectProperties For User 86 - End
09:52:00.194 - _AD_GetObjectProperties For User 87 - Start
09:52:00.390 - _AD_GetObjectProperties For User 87 - End
09:52:00.390 - _AD_GetObjectProperties For User 88 - Start
09:52:00.595 - _AD_GetObjectProperties For User 88 - End
09:52:00.595 - _AD_GetObjectProperties For User 89 - Start
09:52:00.785 - _AD_GetObjectProperties For User 89 - End
09:52:00.785 - _AD_GetObjectProperties For User 90 - Start
09:52:00.976 - _AD_GetObjectProperties For User 90 - End
09:52:00.976 - _AD_GetObjectProperties For User 91 - Start
09:52:01.167 - _AD_GetObjectProperties For User 91 - End
09:52:01.167 - _AD_GetObjectProperties For User 92 - Start
09:52:01.359 - _AD_GetObjectProperties For User 92 - End
09:52:01.359 - _AD_GetObjectProperties For User 93 - Start
09:52:01.559 - _AD_GetObjectProperties For User 93 - End
09:52:01.559 - _AD_GetObjectProperties For User 94 - Start
09:52:01.759 - _AD_GetObjectProperties For User 94 - End
09:52:01.759 - _AD_GetObjectProperties For User 95 - Start
09:52:01.957 - _AD_GetObjectProperties For User 95 - End
09:52:01.957 - _AD_GetObjectProperties For User 96 - Start
09:52:02.158 - _AD_GetObjectProperties For User 96 - End
09:52:02.158 - _AD_GetObjectProperties For User 97 - Start
09:52:02.354 - _AD_GetObjectProperties For User 97 - End
09:52:02.354 - _AD_GetObjectProperties For User 98 - Start
09:52:02.561 - _AD_GetObjectProperties For User 98 - End
09:52:02.561 - _AD_GetObjectProperties For User 99 - Start
09:52:02.753 - _AD_GetObjectProperties For User 99 - End
09:52:02.753 - _AD_GetObjectProperties For User 100 - Start
09:52:02.959 - _AD_GetObjectProperties For User 100 - End
09:52:02.959 - _AD_GetObjectProperties For User 101 - Start
09:52:03.153 - _AD_GetObjectProperties For User 101 - End
09:52:03.153 - _AD_GetObjectProperties For User 102 - Start
09:52:03.362 - _AD_GetObjectProperties For User 102 - End
09:52:03.362 - _AD_GetObjectProperties For User 103 - Start
09:52:03.560 - _AD_GetObjectProperties For User 103 - End
09:52:03.560 - _AD_GetObjectProperties For User 104 - Start
09:52:03.770 - _AD_GetObjectProperties For User 104 - End
09:52:03.770 - _AD_GetObjectProperties For User 105 - Start
09:52:03.968 - _AD_GetObjectProperties For User 105 - End
09:52:03.968 - _AD_GetObjectProperties For User 106 - Start
09:52:04.193 - _AD_GetObjectProperties For User 106 - End
09:52:04.193 - _AD_GetObjectProperties For User 107 - Start
09:52:04.405 - _AD_GetObjectProperties For User 107 - End
09:52:04.405 - _AD_GetObjectProperties For User 108 - Start
09:52:04.620 - _AD_GetObjectProperties For User 108 - End
09:52:04.620 - _AD_GetObjectProperties For User 109 - Start
09:52:04.850 - _AD_GetObjectProperties For User 109 - End
09:52:04.850 - _AD_GetObjectProperties For User 110 - Start
09:52:05.060 - _AD_GetObjectProperties For User 110 - End
09:52:05.060 - _AD_GetObjectProperties For User 111 - Start
09:52:05.268 - _AD_GetObjectProperties For User 111 - End
09:52:05.268 - _AD_GetObjectProperties For User 112 - Start
09:52:05.472 - _AD_GetObjectProperties For User 112 - End
09:52:05.472 - _AD_GetObjectProperties For User 113 - Start
09:52:05.695 - _AD_GetObjectProperties For User 113 - End
09:52:05.695 - _AD_GetObjectProperties For User 114 - Start
09:52:05.892 - _AD_GetObjectProperties For User 114 - End
09:52:05.892 - _AD_GetObjectProperties For User 115 - Start
09:52:06.091 - _AD_GetObjectProperties For User 115 - End

Just for reference.

Share this post


Link to post
Share on other sites

Wow, that's quite a big difference!

Do you access the same Domain Controller with Windows 7 and Windows 8?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yes, our master DC which is in this building. Both machines are on the same subnet and everything. It is strange. I am new to PowerShell, so I took the same process and converted the _AD_GetObjectProperties to a PowerShell command, that process takes about 5 minutes in Windows 7 and about 12 minutes in Windows 8.

Share this post


Link to post
Share on other sites

So it looks like the problem isn't caused by the AD UDF. I haven't used WIndows 8 so unfortunately I know nothing about it.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

 

OK. So no error happened.

Another try to get better error information:

#include <AD.au3>
 _AD_Open()
 If _AD_IsObjectLockedEX("timtest") Then
     ConsoleWrite("locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
 Else     
ConsoleWrite("not locked. @error = " & @error & ", @extened = " & @extended & @CRLF)
_AD_Close()
EndIf

Func _AD_IsObjectLockedEX($sObject = @UserName)

    If Not _AD_ObjectExists($sObject) Then Return SetError(1, 0, 0)
    Local $sProperty = "sAMAccountName"
    If StringMid($sObject, 3, 1) = "=" Then $sProperty = "distinguishedName"; FQDN provided
    $__oAD_Command.CommandText = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(" & $sProperty & "=" & $sObject & ");ADsPath;subtree"
    Local $oRecordSet = $__oAD_Command.Execute ; Retrieve the ADsPath for the object
    Local $sLDAPEntry = $oRecordSet.fields(0).Value
    Local $oObject = __AD_ObjGet($sLDAPEntry) ; Retrieve the COM Object for the object
    Local $oLockoutTime = $oObject.LockoutTime
    ; Object is not locked out
    If Not IsObj($oLockoutTime) Then Return SetError(10, 0, 0)
    ; Calculate lockout time (UTC)
    Local $sLockoutTime = _DateAdd("s", Int(__AD_LargeInt2Double($oLockoutTime.LowPart, $oLockoutTime.HighPart) / (10000000)), "1601/01/01 00:00:00")
    ; Object is not locked out
    If $sLockoutTime = "1601/01/01 00:00:00" Then Return SetError(11, 0, 0)
    ; Get password info - Account Lockout Duration
    Local $aTemp = _AD_GetPasswordInfo($sObject)
    ; if lockout duration is 0 (= unlock manually by admin needed) then no calculation is necessary. Set @error to -1 (minutes till the account is unlocked)
    If $aTemp[5] = 0 Then Return SetError(-1, 0, 1)
    ; Calculate when the lockout will be reset
    Local $sResetLockoutTime = _DateAdd("n", $aTemp[5], $sLockoutTime)
    ; Compare to current date/time (UTC)
    Local $sNow = _Date_Time_GetSystemTime()
    $sNow = _Date_Time_SystemTimeToDateTimeStr($sNow, 1)
    If $sResetLockoutTime >= $sNow Then Return SetError(_DateDiff("n", $sNow, $sResetLockoutTime), 0, 1)
        Return SetError(12, 0, 0)

EndFunc   ;==>_AD_IsObjectLocked

 

>Running AU3Check (3.3.10.2)  from:C:ProgrammeAutoIt3  input:C:AutoItislockedtest.au3

+>14:16:29 AU3Check ended.rc:0

>Running:(3.3.10.2):C:ProgrammeAutoIt3autoit3.exe "C:AutoItislockedtest.au3"    

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop

not locked. @error = 12, @extened = 0

+>14:16:30 AutoIt3.exe ended.rc:0

+>14:16:30 AutoIt3Wrapper Finished.

>Exit code: 0    Time: 1.192

Share this post


Link to post
Share on other sites

If you run _AD_GetObjectProperties for the user, what's the value of property "lockouttime"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
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 (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Stormgrade
      Hello,
      I'm searching the UDF GDIpProgress.au3 from ProgAndy
      None of the links in topic
       works
      Can't someone upload it please ?
    • By water
      Extensive library to control and manipulate Microsoft Active Directory.

      Threads: Development - General Help & Support - Example Scripts - Wiki
      Previous downloads: 30467
       
      Known Bugs: (last changed: 2019-08-19)
      None
        Things to come: (last changed: 2019-08-19)
      None
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    • By ozymandius257
      This is probably a very simple question (I hope!)
      I'm looking to use a UDF to access a SQL database, and have found ADO.au3, but I can't seem to work out how to use it.
      I've copied the files ado.au3 and ado_constants.au3 into the folder C:\Program Files (x86)\AutoIt3\Include, then opened SciTe and started a new project.
      But when I type #include<AD - I don't get offered ADO.au3.
      (I know I should be using the folder C:\Program Files (x86)\AutoIt3\UserInclude, but when it didn't work from there, I tried the above).
      What am I doing wrong?
       
    • By BetaLeaf
      What is Rollbar?
      Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/
      Demo: https://rollbar.com/demo/demo/
      Screenshot:
      Instructions: (RollbarTest.au3)
      ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. 
      Right now, it is fully functional but not tested in production.
       
       
      Changelog:
      RollbarSDK.au3
      RollbarTest.au3
      v0.2
       
      v0.1.1
       
    • By AdamUL
      Below are some functions that I created when I needed to get some Group Policy information via script.  The quickest way I found to get this information was using the Group Policy Module for PowerShell.  This is not a full UDF for the Group Policy Module.  There are a lot more options available with the cmdlets, and this only touches on a few.  To use the functions below, for a Windows client, you will need to install Remote Server Administration Tools (RSAT).  For Windows Server 2012 or later, you will need to install the Group Policy Management Console.  
      Remote Server Administration Tools (RSAT)
      Installing the Group Policy Management Console via PowerShell for Windows Server 2012 or later.  Run in an Admin PowerShell prompt.
      Install-WindowsFeature –Name GPMC PowerShell Group Policy Module Documentation
      For the example below, the AD UDF is only required to query GPO names, but is not required to use the functions.  
      #include <AD.au3> #include <WinAPIFiles.au3> Global $sLDAPFilter = "(name=*)" Global $sExcludeFilter = "" Global $sIncludeFilter = "" Global $sBaseDN = "DC=ad,DC=university,DC=edu" Global $sDataToRetrieve = "sAMAccountName" $sIncludeFilter = "(&(displayName=LIBS-*))" ;GPO Names. $sLDAPFilter = "(&(objectClass=groupPolicyContainer)" & $sExcludeFilter & $sIncludeFilter & ")" $sDataToRetrieve = "displayName,name" _AD_Open() Global $aGPONames = _AD_GetObjectsInOU($sBaseDN, $sLDAPFilter, 2, $sDataToRetrieve) If @error Then MsgBox(64, "Active Directory Functions", "No objects found") Exit _AD_Close() EndIf _AD_Close() ;Add column headers to the output array. Global $aDataToRetrieve = StringSplit($sDataToRetrieve, ",", 2) For $i = 0 To UBound($aGPONames, 2) - 1 Step 1 $aGPONames[0][$i] = $aDataToRetrieve[$i] Next _ArraySort($aGPONames) _ArrayDisplay($aGPONames, "LIBS GPOs") ;For Testing. Global $aGPOPermissions = _AD_GetGPOPermissionsPS($aGPONames[1][0]) If @error Then Exit 1 _ArrayDisplay($aGPOPermissions, $aGPONames[1][0]) Global $sOU = "OU=libs,OU=active,DC=ad,DC=university,DC=edu" Global $aGPOLinks = _AD_GetGPOLinksPS($sOU) If @error Then Exit 2 _ArrayDisplay($aGPOLinks, $sOU) Global $aGPOInheritedLinks = _AD_GetGPOInheritedLinksPS($sOU) If @error Then Exit 2 _ArrayDisplay($aGPOInheritedLinks, $sOU) Global $aGPOs = _AD_GetAllGPOsPS() If @error Then Exit 3 _ArraySort($aGPOs) _ArrayDisplay($aGPOs, "GPOs") Global $aGPOName = _AD_GetGPOByNamePS($aGPONames[1][0]) If @error Then Exit 4 _ArrayDisplay($aGPOName, $aGPONames[1][0]) Global $aGPOGuid = _AD_GetGPOByGuidPS($aGPONames[1][1]) If @error Then Exit 5 _ArrayDisplay($aGPOGuid, $aGPONames[1][1]) Global $sReportName = "C:\Users\adamul\Desktop\Group Policy Object (GPO) PowerShell\Reports\" & $aGPONames[1][0] & ".html" _AD_GetGPOReportByNamePS($aGPONames[1][0], $sReportName) If @error Then Exit 6 Global $sReportGUID = "C:\Users\adamul\Desktop\Group Policy Object (GPO) PowerShell\Reports\" & $aGPONames[1][1] & ".html" _AD_GetGPOReportByGuidPS($aGPONames[1][1], $sReportGUID) If @error Then Exit 6 Func _AD_GetGPOPermissionsPS($sGPOName) ;An array of permission level for one or more security principals on a specified GPO. Local $sGPOCmd = 'powershell "Import-Module GroupPolicy; Get-GPPermissions -Name ''' & $sGPOName & ''' -All"' ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. Local $iGPOCmdOutputSS = StringInStr($sGPOCmdOutput, @CRLF & @CRLF) If $iGPOCmdOutputSS = 0 Then Return SetError(1, 0, 0) Local $sGPOCmdOutputSS = StringMid($sGPOCmdOutput, 1, $iGPOCmdOutputSS) ;~ ConsoleWrite(@CRLF & @CRLF & $sGPOCmdOutputSS & @CRLF) Local $sRegEx = "([^:\r\n]*):.*" Local $aProperties = StringRegExp($sGPOCmdOutputSS, $sRegEx, 3) ;~ _ArrayDisplay($aProperties) ;For testing. If StringInStr($sGPOCmdOutput, "ArgumentException") Then Return SetError(2, 0, 0) ;Get data on multiple lines to a single line. $sGPOCmdOutput = StringRegExpReplace($sGPOCmdOutput, "(\r\n\h{2,})", "") Local $aGPOCmdOutput = StringSplit($sGPOCmdOutput, @CRLF & @CRLF, 1) ;~ _ArrayDisplay($aGPOCmdOutput) ;For testing. ;Convert from a list output to a 2D array. Local $aGPOCmdOutput2D[$aGPOCmdOutput[0]][UBound($aProperties)] Local $aTemp For $i = 1 To $aGPOCmdOutput[0] Step 1 $aTemp = StringSplit($aGPOCmdOutput[$i], @CRLF, 1) For $j = 1 To $aTemp[0] Step 1 For $k = 0 To UBound($aProperties) - 1 Step 1 If StringInStr($aTemp[$j], $aProperties[$k]) Then $aGPOCmdOutput2D[$i - 1][$k] = StringStripWS(StringReplace($aTemp[$j], $aProperties[$k] & ":", ""), 3) EndIf Next Next Next ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. For $i = 0 To UBound($aProperties) - 1 Step 1 $aProperties[$i] = StringStripWS($aProperties[$i], 3) Next _ArrayTranspose($aProperties) _ArrayConcatenate($aProperties, $aGPOCmdOutput2D) Return $aProperties EndFunc ;==>_AD_GetGPOPermissionsPS Func _AD_GetGPOLinksPS($sOUName) ;An array of GPOs that are linked directly to the location. Local $sGPOCmd = 'powershell "Import-Module GroupPolicy; (Get-GPInheritance -Target ''' & $sOUName & "').GpoLinks" ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. Local $iGPOCmdOutputSS = StringInStr($sGPOCmdOutput, @CRLF & @CRLF) If $iGPOCmdOutputSS = 0 Then Return SetError(1, 0, 0) Local $sGPOCmdOutputSS = StringMid($sGPOCmdOutput, 1, $iGPOCmdOutputSS) ;~ ConsoleWrite(@CRLF & @CRLF & $sGPOCmdOutputSS & @CRLF) ;For testing. Local $sRegEx = "([^:\r\n]*):.*" Local $aProperties = StringRegExp($sGPOCmdOutputSS, $sRegEx, 3) ;~ _ArrayDisplay($aProperties) ;For testing. If StringInStr($sGPOCmdOutput, "ArgumentException") Then Return SetError(1, 0, 0) ;Get data on multiple lines to a single line. $sGPOCmdOutput = StringRegExpReplace($sGPOCmdOutput, "(\r\n\h{2,})", "") Local $aGPOCmdOutput = StringSplit($sGPOCmdOutput, @CRLF & @CRLF, 1) ;~ _ArrayDisplay($aGPOCmdOutput) ;For testing. ;Convert from a list output to a 2D array. Local $aGPOCmdOutput2D[$aGPOCmdOutput[0]][UBound($aProperties)] Local $aTemp For $i = 1 To $aGPOCmdOutput[0] Step 1 $aTemp = StringSplit($aGPOCmdOutput[$i], @CRLF, 1) For $j = 1 To $aTemp[0] Step 1 For $k = 0 To UBound($aProperties) - 1 Step 1 If StringInStr($aTemp[$j], $aProperties[$k]) Then $aGPOCmdOutput2D[$i - 1][$k] = StringStripWS(StringReplace($aTemp[$j], $aProperties[$k] & ":", ""), 3) EndIf Next Next Next ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. For $i = 0 To UBound($aProperties) - 1 Step 1 $aProperties[$i] = StringStripWS($aProperties[$i], 3) Next _ArrayTranspose($aProperties) _ArrayConcatenate($aProperties, $aGPOCmdOutput2D) Return $aProperties EndFunc ;==>_AD_GetGPOLinksPS Func _AD_GetGPOInheritedLinksPS($sOUName) ;An array of GPOs that are applied to the location when Group Policy is processed on a client. Local $sGPOCmd = 'powershell "Import-Module GroupPolicy; (Get-GPInheritance -Target ''' & $sOUName & "').InheritedGpoLinks" ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. Local $iGPOCmdOutputSS = StringInStr($sGPOCmdOutput, @CRLF & @CRLF) If $iGPOCmdOutputSS = 0 Then Return SetError(1, 0, 0) Local $sGPOCmdOutputSS = StringMid($sGPOCmdOutput, 1, $iGPOCmdOutputSS) ;~ ConsoleWrite(@CRLF & @CRLF & $sGPOCmdOutputSS & @CRLF) ;For testing. Local $sRegEx = "([^:\r\n]*):.*" Local $aProperties = StringRegExp($sGPOCmdOutputSS, $sRegEx, 3) ;~ _ArrayDisplay($aProperties) ;For testing. If StringInStr($sGPOCmdOutput, "ArgumentException") Then Return SetError(1, 0, 0) ;Get data on multiple lines to a single line. $sGPOCmdOutput = StringRegExpReplace($sGPOCmdOutput, "(\r\n\h{2,})", "") Local $aGPOCmdOutput = StringSplit($sGPOCmdOutput, @CRLF & @CRLF, 1) ;~ _ArrayDisplay($aGPOCmdOutput) ;For testing. ;Convert from a list output to a 2D array. Local $aGPOCmdOutput2D[$aGPOCmdOutput[0]][UBound($aProperties)] Local $aTemp For $i = 1 To $aGPOCmdOutput[0] Step 1 $aTemp = StringSplit($aGPOCmdOutput[$i], @CRLF, 1) For $j = 1 To $aTemp[0] Step 1 For $k = 0 To UBound($aProperties) - 1 Step 1 If StringInStr($aTemp[$j], $aProperties[$k]) Then $aGPOCmdOutput2D[$i - 1][$k] = StringStripWS(StringReplace($aTemp[$j], $aProperties[$k] & ":", ""), 3) EndIf Next Next Next ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. For $i = 0 To UBound($aProperties) - 1 Step 1 $aProperties[$i] = StringStripWS($aProperties[$i], 3) Next _ArrayTranspose($aProperties) _ArrayConcatenate($aProperties, $aGPOCmdOutput2D) Return $aProperties EndFunc ;==>_AD_GetGPOInheritedLinksPS Func _AD_GetAllGPOsPS() ;An array of information on all the GPOs in a domain. Local $sGPOCmd = 'powershell "Import-Module GroupPolicy; Get-GPO -All"' ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. Local $iGPOCmdOutputSS = StringInStr($sGPOCmdOutput, @CRLF & @CRLF) If $iGPOCmdOutputSS = 0 Then Return SetError(1, 0, 0) Local $sGPOCmdOutputSS = StringMid($sGPOCmdOutput, 1, $iGPOCmdOutputSS) ;~ ConsoleWrite(@CRLF & @CRLF & $sGPOCmdOutputSS & @CRLF) ;For testing. Local $sRegEx = "([^:\r\n]*):.*" Local $aProperties = StringRegExp($sGPOCmdOutputSS, $sRegEx, 3) ;~ _ArrayDisplay($aProperties) If StringInStr($sGPOCmdOutput, "ArgumentException") Then Return SetError(1, 0, 0) ;Get data on multiple lines to a single line. $sGPOCmdOutput = StringRegExpReplace($sGPOCmdOutput, "(\r\n\h{2,})", "") Local $aGPOCmdOutput = StringSplit($sGPOCmdOutput, @CRLF & @CRLF, 1) ;~ _ArrayDisplay($aGPOCmdOutput) ;For testing. ;Convert from a list output to a 2D array. Local $aGPOCmdOutput2D[$aGPOCmdOutput[0]][UBound($aProperties)] Local $aTemp For $i = 1 To $aGPOCmdOutput[0] Step 1 $aTemp = StringSplit($aGPOCmdOutput[$i], @CRLF, 1) For $j = 1 To $aTemp[0] Step 1 For $k = 0 To UBound($aProperties) - 1 Step 1 If StringInStr($aTemp[$j], $aProperties[$k]) Then $aGPOCmdOutput2D[$i - 1][$k] = StringStripWS(StringReplace($aTemp[$j], $aProperties[$k] & ":", ""), 3) EndIf Next Next Next ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. For $i = 0 To UBound($aProperties) - 1 Step 1 $aProperties[$i] = StringStripWS($aProperties[$i], 3) Next _ArrayTranspose($aProperties) _ArrayConcatenate($aProperties, $aGPOCmdOutput2D) Return $aProperties EndFunc ;==>_AD_GetAllGPOsPS Func _AD_GetGPOByNamePS($sGPOName) ;An array of information on one Group Policy Object (GPO) in a domain by Display Name. Local $sGPOCmd = 'powershell "Import-Module GroupPolicy; Get-GPO -Name ''' & $sGPOName & '''"' ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. ;Add end of line characters for single return group to be processed. $sGPOCmdOutput = $sGPOCmdOutput & @CRLF & @CRLF Local $iGPOCmdOutputSS = StringInStr($sGPOCmdOutput, @CRLF & @CRLF) If $iGPOCmdOutputSS = 0 Then Return SetError(1, 0, 0) Local $sGPOCmdOutputSS = StringMid($sGPOCmdOutput, 1, $iGPOCmdOutputSS) ConsoleWrite(@CRLF & @CRLF & $sGPOCmdOutputSS & @CRLF) Local $sRegEx = "([^:\r\n]*):.*" Local $aProperties = StringRegExp($sGPOCmdOutputSS, $sRegEx, 3) ;~ _ArrayDisplay($aProperties) ;For testing. If StringInStr($sGPOCmdOutput, "ArgumentException") Then Return SetError(1, 0, 0) ;Get data on multiple lines to a single line. $sGPOCmdOutput = StringRegExpReplace($sGPOCmdOutput, "(\r\n\h{2,})", "") ;Remove last @CRLF to prevent blank row in return array. $sGPOCmdOutput = StringTrimRight($sGPOCmdOutput, 2) Local $aGPOCmdOutput = StringSplit($sGPOCmdOutput, @CRLF & @CRLF, 1) ;~ _ArrayDisplay($aGPOCmdOutput) ;For testing. ;Convert from a list output to a 2D array. Local $aGPOCmdOutput2D[$aGPOCmdOutput[0]][UBound($aProperties)] ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. Local $aTemp For $i = 1 To $aGPOCmdOutput[0] Step 1 $aTemp = StringSplit($aGPOCmdOutput[$i], @CRLF, 1) For $j = 1 To $aTemp[0] Step 1 For $k = 0 To UBound($aProperties) - 1 Step 1 If StringInStr($aTemp[$j], $aProperties[$k]) Then $aGPOCmdOutput2D[$i - 1][$k] = StringStripWS(StringReplace($aTemp[$j], $aProperties[$k] & ":", ""), 3) EndIf Next Next Next ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. For $i = 0 To UBound($aProperties) - 1 Step 1 $aProperties[$i] = StringStripWS($aProperties[$i], 3) Next _ArrayTranspose($aProperties) _ArrayConcatenate($aProperties, $aGPOCmdOutput2D) Return $aProperties EndFunc ;==>_AD_GetGPOByNamePS Func _AD_GetGPOByGuidPS($sGPOGuid) ;An array of information on one Group Policy Object (GPO) in a domain by GUID. Local $sGPOCmd = 'powershell "Import-Module GroupPolicy; Get-GPO -Guid ''' & $sGPOGuid & '''"' ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. ;Add end of line characters for single return group to be processed. $sGPOCmdOutput = $sGPOCmdOutput & @CRLF & @CRLF Local $iGPOCmdOutputSS = StringInStr($sGPOCmdOutput, @CRLF & @CRLF) If $iGPOCmdOutputSS = 0 Then Return SetError(1, 0, 0) Local $sGPOCmdOutputSS = StringMid($sGPOCmdOutput, 1, $iGPOCmdOutputSS) ;~ ConsoleWrite(@CRLF & @CRLF & $sGPOCmdOutputSS & @CRLF) ;For testing. Local $sRegEx = "([^:\r\n]*):.*" Local $aProperties = StringRegExp($sGPOCmdOutputSS, $sRegEx, 3) ;~ _ArrayDisplay($aProperties) ;For testing. If StringInStr($sGPOCmdOutput, "ArgumentException") Then Return SetError(1, 0, 0) ;Get data on multiple lines to a single line. $sGPOCmdOutput = StringRegExpReplace($sGPOCmdOutput, "(\r\n\h{2,})", "") ;Remove last @CRLF to prevent blank row in return array. $sGPOCmdOutput = StringTrimRight($sGPOCmdOutput, 2) Local $aGPOCmdOutput = StringSplit($sGPOCmdOutput, @CRLF & @CRLF, 1) ;~ _ArrayDisplay($aGPOCmdOutput) ;For testing. ;Convert from a list output to a 2D array. Local $aGPOCmdOutput2D[$aGPOCmdOutput[0]][UBound($aProperties)] ;~ _ArrayDisplay($aGPOCmdOutput2D) Local $aTemp For $i = 1 To $aGPOCmdOutput[0] Step 1 $aTemp = StringSplit($aGPOCmdOutput[$i], @CRLF, 1) For $j = 1 To $aTemp[0] Step 1 For $k = 0 To UBound($aProperties) - 1 Step 1 If StringInStr($aTemp[$j], $aProperties[$k]) Then $aGPOCmdOutput2D[$i - 1][$k] = StringStripWS(StringReplace($aTemp[$j], $aProperties[$k] & ":", ""), 3) EndIf Next Next Next ;~ _ArrayDisplay($aGPOCmdOutput2D) ;For testing. For $i = 0 To UBound($aProperties) - 1 Step 1 $aProperties[$i] = StringStripWS($aProperties[$i], 3) Next _ArrayTranspose($aProperties) _ArrayConcatenate($aProperties, $aGPOCmdOutput2D) Return $aProperties EndFunc ;==>_AD_GetGPOByGuidPS Func _AD_GetGPOReportByNamePS($sGPOName, $sReportFullPath, $sReportType = "HTML") ;Generates a report either in XML or HTML format for a specified GPO by name in a domain. Switch $sReportType Case "HTML", "XML" Case Else Return SetError(1, 0, False) EndSwitch Local $sPath = StringRegExpReplace($sReportFullPath, "(^.*\\)(.*)", "$1") ;~ ConsoleWrite($sPath & @CRLF) ;For testing. ;~ If Not FileExists($sPath) Then Return SetError(2, 0, False) Local $sGPOCmd = 'powershell "Get-GPOReport -Name ''' & $sGPOName & ''' -ReportType ' & $sReportType & ' -Path ''' & $sReportFullPath & '''"' ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. If $sGPOCmdOutput <> "" Then SetError(3, 0, False) Return True EndFunc ;==>_AD_GetGPOReportByNamePS Func _AD_GetGPOReportByGuidPS($sGPOGuid, $sReportFullPath, $sReportType = "HTML") ;Generates a report either in XML or HTML format for a specified GPO by GUID in a domain. Switch $sReportType Case "HTML", "XML" Case Else Return SetError(1, 0, False) EndSwitch Local $sPath = StringRegExpReplace($sReportFullPath, "(^.*\\)(.*)", "$1") ;~ ConsoleWrite($sPath & @CRLF) ;For testing. ;~ If Not FileExists($sPath) Then Return SetError(2, 0, False) Local $sGPOCmd = 'powershell "Get-GPOReport -GUID ''' & $sGPOGuid & ''' -ReportType ' & $sReportType & ' -Path ''' & $sReportFullPath & '''"' ConsoleWrite($sGPOCmd & @CRLF) ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPIDGPOCmd = Run($sGPOCmd, @SystemDir, @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPIDGPOCmd) ;Turn on redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(True) Local $sGPOCmdOutput = StringStripWS(StdoutRead($iPIDGPOCmd), 3) ;~ ConsoleWrite($sGPOCmdOutput & @CRLF & @CRLF) ;For testing. If $sGPOCmdOutput <> "" Then SetError(3, 0, False) Return True EndFunc ;==>_AD_GetGPOReportByGuidPS  
      Adam
       
×
×
  • Create New...