Jump to content

Active Directory UDF - Help & Support


water
 Share

Recommended Posts

Not that I'm aware off.

I searched the forum but couldn't find a "multicolumn treeview" or something similar.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks for looking Water, not doubting you, I check also and got the same result. I'll have to live with it until I find a solution.

Just one more question if I may, I search all forums for a domain joining script, one that doesn't use key strokes but similar.

Basically what you would normally do manually after a reimage, do you know or anyone within the forum of any?

Many thanks again

Iceman682

Link to comment
Share on other sites

To join a domain use function _AD_JoinDomain.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The function in the AD UDF will return an error because you need to be connected to the AD.

I'm not sure if it's possible at all to join a PC to a domain without connection.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If I was to insert the domain within System Properties - Computer Name/Domain Changes and press OK it woukld ask for the user account credentails that has permissions to join a machine to the domain, once these are inserted and OK is pressed it would return with the domain join success. Would you agree if this is the case it should be possible?

Link to comment
Share on other sites

Unfortunately I have just "read only" access to my companies AD so I can't test and hence can't answer your question.

I searched Google but I'm not sure you can join a computer to a domain without access to the domain (something like a deferred join). I don't think it's possible because joining a computer means to create a connection between the computer and the computer account in AD.

is a stripped down join script you could give a try.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Experimental Version 1.2.2.0 has been released.

For testing purpose only!

Needs 3.3.9.2 beta for the new way the UDF handles COM errors!

For download please see my signature.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I have been playing around with _AD_GetObjectAttribute and found with version AD 1.2.1.0 that if I query an Attribute of an users account in AD e.g scriptPath and if nothing is set the script fails with

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

Local $sAD_Result = $oAD_Object.Get($sAD_Attribute)

Local $sAD_Result = $oAD_Object.Get($sAD_Attribute)^ ERROR

Im using the _AD_GetObjectAttribute.au3 script and changing the Mail to scriptPath.

If the attribute is blank shouldnt the script come back with cant be found or the value of 0

thanks in advance

Link to comment
Share on other sites

You use version 1.2.1.0 of the UDF with AutoIt 3.3.9.2 beta or higher?

If you want to use the production version of AutoIt you have to use version 1.2.0 of the UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Im using Autoit 3.3.9.4 but found my problem..... yes another stupid user problem. I wasnt running the script with the beta Run script. I was running it direct from SciTE which is using 3.3.81

thanks for the quick response.

Link to comment
Share on other sites

Glad to be of service :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

You could use function _Security__LookupAccountSid of the Security UDF that comes with AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Don´t realy function with remote ad, but this:

Func _AD_SID2NAME($sAD_Object)

Local $sAD_Property = "objectSid"
If StringMid($sAD_Object, 3, 1) = "=" Then $sAD_Property = "distinguishedName" ; FQDN provided
If _AD_ObjectExists($sAD_Object, $sAD_Property) = 0 Then Return SetError(1, 0, "")
$oAD_Command.CommandText = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(" & $sAD_Property & "=" & $sAD_Object & ");ADsPath;subtree"
Local $oAD_RecordSet = $oAD_Command.Execute ; Retrieve the ADsPath for the object
If Not IsObj($oAD_RecordSet) Or $oAD_RecordSet.RecordCount = 0 Then Return SetError(2, 0, "")
Local $sAD_LDAPEntry = $oAD_RecordSet.fields(0).value
Local $oAD_Object = _AD_ObjGet($sAD_LDAPEntry) ; Retrieve the COM Object for the object
$iAD_COMError = 0
Local $sAD_Result = $oAD_Object.Get("sAMAccountName")
$oAD_Object.PurgePropertyList
If $iAD_COMError = 3 Then
$iAD_COMError = 0
Return SetError(2, 0, "")
EndIf
Return $sAD_Result
EndFunc ;==>_AD_NAME2SID
Edited by bjoerni
Link to comment
Share on other sites

This should give you the SID of the current user and then use the SID to display account information:

#include <Security.au3>

; Get the SID of the current user
Local $sAccount = @UserName
Local $tSID = _Security__GetAccountSid($sAccount)
Local $sStringSID = _Security__SidToStringSid($tSID)
MsgBox(0, "SID", "User = " & $sAccount & @CRLF & "SID = " & $sStringSID)

; Lookup the name for a SID
Local $aArrayOfData = _Security__LookupAccountSid($sStringSID)
; Print returned data if no error occured
If IsArray($aArrayOfData) Then
    MsgBox(0, "SID", "Account name = " & $aArrayOfData[0] & @CRLF & _
    "Domain name = " & $aArrayOfData[1] & @CRLF & _
    "SID type = " & _Security__SidTypeStr($aArrayOfData[2]) & @CRLF)
EndIf

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi Guys

I'm Struggling big time with something that is probably sooooo simple to the experts on here.

I am trying to edit the ADAT, I have tried all sorts of premitations to get the buttons to work but to no avail.

I think the issue lies just above, but I'm probably wrong like always

;------------------------------------------------------------------

; Joins Win 7 Machine To Domain

;------------------------------------------------------------------

#include <ButtonConstants.au3> is included

Any assistance will be most grateful

Thanks in advance

;---------------------
; Tab 1: Join computer
;---------------------
$iLine = 0
Global $hT0 = GUICtrlCreateTabItem("Credentials")
GUICtrlCreateLabel("Insert The Computer Description And Join The Domain.", $iDLeft, $iDTop, $iDWidth, $iDHeight)
GUICtrlSetFont(-1, 9, 800); bold
$iLine += 0
GUICtrlCreateLabel("Admin User Name:", $iLLeft, $iLTop + $iLine * $iLHeight + $iLine * $iLSpace, $iLWidth, $iLHeight)
Global $hT0_AdminUserName = GUICtrlCreateInput($sT0_AdminUserName, $iILeft, $iITop + $iLine * $iIHeight + $iLine * $iISpace, $iIWidth, $iIHeight)
GUICtrlSetState(-1, $GUI_Focus)
; Line 2
$iLine += 1
GUICtrlCreateLabel("Admin Password:", $iLLeft, $iLTop + $iLine * $iLHeight + $iLine * $iLSpace, $iLWidth, $iLHeight)
Global $hT0_AdminUserPassword = GUICtrlCreateInput("", $iILeft, $iITop + $iLine * $iIHeight + $iLine * $iISpace, $iIWidth, $iIHeight, $ES_PASSWORD)
; Line 3
$iLine += 1
GUICtrlCreateLabel("Computer Service Tag:", $iLLeft, $iLTop + $iLine * $iLHeight + $iLine * $iLSpace, $iLWidth, $iLHeight)
Global $hT1_ComputerName = GUICtrlCreateInput(@ComputerName, $iILeft, $iITop + $iLine * $iIHeight + $iLine * $iISpace, $iIWidth, $iIHeight)

$iLine += 1
GUICtrlCreateLabel("Domain:", $iLLeft, 73 + $iLine * $iLHeight + $iLine * $iLSpace, $iLWidth, $iLHeight)
GUICtrlCreateLabel(" DO NOT CHANGE", $iLLeft, 73 + $iLine * $iLHeight + $iLine * $iLSpace, $iLWidth, $iLHeight)
GUICtrlSetFont(-1, 9, 800, 2); bold
GUICtrlSetColor(-1, 0xff0000) ; Red
Global $hT0_DomainName = GUICtrlCreateInput($sT3_Domain, $iILeft, $iITop + $iLine * $iIHeight + $iLine * $iISpace, $iIWidth, $iIHeight)

$iLine += 1
GUICtrlCreateLabel("Computer Description:", $iLLeft, 73 + $iLine * $iLHeight + $iLine * $iLSpace, $iLWidth, $iLHeight)
GUICtrlSetFont(-1, 9, 800, 2); bold
GUICtrlSetColor(-1, 0xff0000) ; Red
$iLine += 2
Global $hT1_Description = GUICtrlCreateInput($Description, $iILeft, 3 + $iLine * $iIHeight + $iLine * $iISpace, $iIWidth, $iIHeight)
Global $Joinbuttonxp = GUICTRLCREATEBUTTON("Win XP", 150, 250 , 110, $BS_ICON)
GUICtrlSetImage(-1, "C:UsersAdministratorDownloadswindows.ico")
Global $Joinbutton7 = GUICTRLCREATEBUTTON("Win 7", 270, 250 , 110, $BS_ICON)
GUICtrlSetImage(-1, "C:UsersAdministratorDownloadswindows_alt.ico")
GUISetState(@SW_SHOWDEFAULT)
#region ### END Koda GUI section ###
Func OS_Select()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $Joinbutton7
_DomainJoin()
Case $Joinbuttonxp
_XPDomainJoinGUI()
EndSwitch
WEnd
EndFunc

;------------------------------------------------------------------
; Joins Win 7 Machine To Domain
;------------------------------------------------------------------

Func _DomainJoin()
MsgBox(8196, "Windows 7 Domain Joining", "You Are About To Join A Windows 7 Machine To The Domain, Do You Wish To Continue?")
ShellExecute("sysdm.cpl")
WinWait("System Properties")
$htDescription = GUICtrlRead ($Description)
Send ($htDescription)
Send("{TAB}")
Send("{TAB}")
Send("{ENTER}")
ControlClick ("Computer Name/Domain Changes", "", "[CLASS:Button; INSTANCE:3]", "left", 1 )
WinWait("Computer Name/Domain Changes")
Send("{TAB}")
$htDomain = GUICtrlRead ($Domain)
Send ($htDomain)
Send("{TAB}")
Send("{ENTER}")
WinWait("Windows Security")
$htAdminUserName = GUICtrlRead ($AdminUserName)
Send ($htAdminUserName)
Send("{TAB}")
$htPassword = GUICtrlRead ($Password)
Send ($htPassword)
Send("{ENTER}")

WinWait("Computer Name/Domain Changes", "Welcome to the domain.")
WinWaitActive("Computer Name/Domain Changes", "Welcome to the domain.")
Send("{ENTER}")

Sleep(1000)
if WinExists("Computer Name/Domain Changes", "OK") Then
Send("{ENTER}")

WinWait("System Properties")
ControlClick ( "System Properties", "", "[CLASS:Button; INSTANCE:3]" , "left" , 1 )
Send("{TAB}")
Send("{ENTER}")

EndIf
Msgbox(1, "Restart", "Now add Local Admins to the Administrators Group")

EndFunc ;==>_DomainJoin
Edited by Iceman682
Link to comment
Share on other sites

Why don't you use the join function already included in the example?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

hello Water. First of all, great UDF!

Im having a smal issue. Ive created a script here at work that lets me update users signatures and outlook contacts (based on out AD). It works great on all machines and everything. But i just reinstalled my machine win Windows 8 PRO for testing purposes and i get an error when i try to use any of theese lines:

$skype = _AD_GetObjectAttribute($AD_user,"ipPhone")

$titel = _AD_GetObjectAttribute($AD_user,"title")

$street = _AD_GetObjectAttribute($AD_user,"streetAddress")

$postnr = _AD_GetObjectAttribute($AD_user,"postalCode")

$ort = _AD_GetObjectAttribute($AD_user,"l")

The error im getting is:

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

Local $sAD_Result = $oAD_Object.Get($sAD_Attribute)

Local $sAD_Result = $oAD_Object.Get($sAD_Attribute)^ ERROR

The strange thing is that it works in Windows 7. It might be that i ued an older version of the UDF when i compiled the script on my Win 7 machine. Another strange this is that this line works great:

$displayname = _AD_GetObjectAttribute($AD_user,"displayName")

$mail = _AD_GetObjectAttribute($AD_user,"mail")

$tele = _AD_GetObjectAttribute($AD_user,"telephoneNumber")

So some of the calls work, and some dont.

Any idees?

Link to comment
Share on other sites

Which version of the UDF to you run AND which version of AutoIt do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...