Oloco Posted December 6, 2014 Posted December 6, 2014 Hi guys! I'm new in this community. I really like this languaje, and the forums are awesome. Also, I have to say that the documentation is really good. All of you are doing a very great work. Now I'm working in a proyect for deploying operating systems through SCCM, and I would really like you to help me, if possible. As you know, SCCM provides a way to automatically deploy operating systems in a network. I'm working in a frontend that allows you to choose and save some information for the deployment: - Computer name inout box (done) - Choose between joining domain, or workgroup (done) - In the case of joining domain, which domain, and which OU you want to place the new computer in. (I have done a combobox to search and show all the available ous in the domain, but the comuter needs to be already joined in order to use it, so it is not useful for this case) - Select hard drive and partition (not done, and I think it wil be difficult) -.... Well, most of the interface is built, but I have found some troubles: When the deploy starts, the computer is not a member from AD, so I need to find a way to discover which domains are availables, and if posible, put them all in a combo box, so that I can choose one of them. I know that you can find this kind of information using nslookup, for example (asking to DNS). The main problem is that nslookup is not available in Winpe and I can't find any other way to do this. Also, If it is not possible, I would like to have a input box in order to write the domain name manually, but not all the FQDN. In the case of having a domain named mydomain.local, I need to only write "mydomain" in order to been able to join it (as you can usually do using windows, and if the DNS/DC are correctly configured). I know AD udf and I have worked with it multiple times, but always as an existing domain user. So, the main questions for me are: - Is there a way to automátically discover Domain controllers and domain names using autoit? The computer could ask to DNS in order to find this info. If this would be possible, I would like to populate this information into a combobox and I think I would not need anything more. Also, I think that a domain username and password would be needed, but this it nos problem.. just need to put username and password inputboxes... - In the case that it's not possible, Is there a way to only write manually the main name of the domain (mydomain instead of mydomain.local)? I will put the code that I'm writting in order to have an idea. I know that it's terrible, but I'm not a programmer :-) expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <AD.au3> #include <Array.au3> #Include <WinAPI.au3> #include <GUIComboBox.au3> #Region ### START Koda GUI section ### Form=Form1.kxf $Deploy = GUICreate("Deploy", 746, 441, 199, 151) $COU = GUICtrlCreateCombo("", 136, 128, 569, 25) $Cdisco = GUICtrlCreateCombo("", 136, 208, 169, 25) $Inombreequipo = GUICtrlCreateInput("", 136, 48, 193, 21) $LNombredeequipo = GUICtrlCreateLabel("Computername:", 32, 48, 98, 17) $LOU = GUICtrlCreateLabel("OU:", 16, 128, 106, 17) $LWG = GUICtrlCreateLabel("Workgroup:", 32, 168, 90, 17) $Bok = GUICtrlCreateButton("Ok", 176, 352, 75, 25) $BCancelar = GUICtrlCreateButton("Cancel", 280, 352, 75, 25) $Ginstala = GUICtrlCreateGroup("", 136, 248, 65, 57, -1, $WS_EX_TRANSPARENT) GUICtrlCreateGroup("", -99, -99, 1, 1) $Rinstalasi = GUICtrlCreateRadio("Sí", 144, 256, 41, 17) GUICtrlSetResizing(-1, $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $Rinstalano = GUICtrlCreateRadio("No", 144, 280, 41, 17) $Ldisco = GUICtrlCreateLabel("Partition:", 32, 208, 89, 17) $Linstala = GUICtrlCreateLabel("Install apps:", 16, 272, 106, 17) $LMeterendominio = GUICtrlCreateLabel("Join Domain:", 40, 88, 91, 17) $Gdominio = GUICtrlCreateGroup("", 144, 80, 105, 33) $RMeterendominiosi = GUICtrlCreateRadio("Yes", 152, 88, 41, 17, BitOR($GUI_SS_DEFAULT_RADIO,$BS_CENTER,$BS_VCENTER)) GUICtrlSetState(-1, $GUI_CHECKED) $RMeterendominiono = GUICtrlCreateRadio("No", 200, 88, 41, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Bparticion = GUICtrlCreateButton("Manually partition", 336, 208, 75, 25) $IWG = GUICtrlCreateInput("", 136, 168, 201, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetState ($RMeterendominiosi, $GUI_CHECKED) GUICtrlSetState($COU, $GUI_ENABLE) GUICtrlSetState($IWG, $GUI_DISABLE) GUICtrlSetState ($Rinstalasi, $GUI_CHECKED) _getad() _disks() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $RMeterendominiosi If GUICtrlRead ($RMeterendominiosi) = $GUI_CHECKED Then GUICtrlSetState($COU, $GUI_ENABLE) GUICtrlSetState($IWG, $GUI_DISABLE) endif case $RMeterendominiono If GUICtrlRead ($RMeterendominiono) = $GUI_CHECKED Then GUICtrlSetState($COU, $GUI_DISABLE) GUICtrlSetState($IWG, $GUI_ENABLE) endif case $BCancelar _cancelar() case $Bok _ok() EndSwitch WEnd func _getad() _AD_Open() ;Global $aOUs = _AD_GetAllOUs("","",2) Global $aOUs = _AD_GetAllOUs() ; Global $aOUs = _AD_GetAllOUs() ---> muestra sólo ou's If @error > 0 Then msgbox(64, "Active Directory Functions", "No OUs could be found") EndIf _AD_Close() Global $sOU, $iCount For $iCount = 1 To $aOUs[0][0] If StringInStr($aOUs[$iCount][0], "\") > 0 Then $sOU = "OU=" & StringReplace($aOUs[$iCount - 1][0], "\", ",OU=") & "," & $sAD_DNSDomain ExitLoop EndIf Next For $i=1 to Ubound($aOUs)-1 GUICtrlSetData($COU, $aOUs[$i][0]) ;GUICtrlSetData($COU, $aOUs[$i][0]) ; --> Para ver los nombres de las OUs ;GUICtrlSetData($COU, $aOUs[$i][1]) ; --> Para ver los nombres "bonitos" Next ;_ArrayDisplay($aOUs, "aOUs display") endfunc func _disks() $aArray = DriveGetDrive("FIXED") $dvalue = "c:" $iPosition=_ArraySearch($aArray, $dvalue, 0, 0, 0, 1, 1, 0) if $iPosition = "-1" then For $i=1 To $aArray[0] $maArray = StringUpper($aArray[$i]) GUICtrlSetData($Cdisco, $maArray) next _GUICtrlComboBox_SetCurSel($Cdisco, $aArray[1]) else For $i=1 To $aArray[0] $maArray = StringUpper($aArray[$i]) GUICtrlSetData($Cdisco, $maArray) next _GUICtrlComboBox_SetCurSel($Cdisco, $iPosition -1) endif endfunc func _ok() RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "OSDComputerName") RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Instapps") RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "OSDJoinWorkgroupName") RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "MachineObjectOU") EnvUpdate() ;Nombre de equipo $vInombreequipo = GUICtrlRead($Inombreequipo) If StringLen(GuiCtrlRead($vInombreequipo)) < 0 Then MsgBox($MB_SYSTEMMODAL, "ERROR", "Debes escribir un nombre de equipo.", 10) return else $result = RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "OSDComputerName", "REG_SZ", $vInombreequipo) If $result = 1 Then else MsgBox($MB_SYSTEMMODAL, "ERROR", "No se ha podido declarar la variable del sistema OSDComputerName.", 10) endif endif ; Se instalan aplicaciones If GUICtrlRead ($Rinstalasi) = $GUI_CHECKED Then $vInstapps = "si" $result = RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Instapps", "REG_SZ", "si") If $result = 1 Then else MsgBox($MB_SYSTEMMODAL, "ERROR", "No se ha podido declarar la variable del sistema Instapps.", 10) endif endif ;Meter en dominio If GUICtrlRead ($RMeterendominiono) = $GUI_CHECKED Then $grupodetrabajo = GUICtrlRead ($IWG) If StringLen(GuiCtrlRead($grupodetrabajo)) < 0 Then MsgBox($MB_SYSTEMMODAL, "ERROR", "Debes escribir un Grupo de Trabajo.", 10) return endif $result = RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "OSDJoinWorkgroupName", "REG_SZ", $grupodetrabajo) If $result = 1 Then else MsgBox($MB_SYSTEMMODAL, "ERROR", "No se ha podido declarar la variable del sistema OSDJoinWorkgroupName.", 10) endif Else $vNombredeDOminio = GUICtrlRead ($COU) $result = RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "MachineObjectOU", "REG_SZ", $vNombredeDOminio) If $result = 1 Then else MsgBox($MB_SYSTEMMODAL, "ERROR", "No se ha podido declarar la variable del sistema MachineObjectOU.", 10) endif endif ;Elegir particion $vCdisco = GUICtrlRead($Cdisco) ;Grabamos y salimos $log = "_log.txt" FileOpen ($log, 0) if isdeclared ("vNombredeDOminio") then FileWrite ($log, "MachineObjectOU: " & $vNombredeDOminio & @CRLF) else FileWrite ($log, "OSDJoinWorkgroupName: " & $grupodetrabajo & @CRLF) endif FileWrite ($log, "OSDComputerName: " & $vInombreequipo & @CRLF) if isdeclared ("vInstapps") then FileWrite ($log, "Instapps: " & "si" & @CRLF) else FileWrite ($log, "Instapps: " & "no" & @CRLF) endif FileWrite ($log, "" & @CRLF) FileWrite ($log, "" & @CRLF) FileWrite ($log, "" & @CRLF) FileClose ($log) EnvUpdate() exit endfunc func _Cancelar() exit endfunc ;VARIABLES ;MachineObjectOU = "OU=Workstations, dc=contoso, dc=com" ;OSDComputerName ;Instapps ;OSDJoinWorkgroupName Thanks in advance, and please, let me know any doubt you could have. I know that my english is really bad... Regards
water Posted December 6, 2014 Author Posted December 6, 2014 When passing the needed connection information to _AD_Open it is possible to connect to a domain and retrieve the needed information. 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
Oloco Posted December 6, 2014 Posted December 6, 2014 Hi, thanks for your fast reply! I was thinking that it was possible to discover which domains are available to join just asking to DNS server. Do you think that it would be possible? Thank you very much!
water Posted December 6, 2014 Author Posted December 6, 2014 Unfortunately the AD UDF doesn't provide this functionality. You need to know the domain you want to connect to before you can use the AD 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
EndFunc Posted December 8, 2014 Posted December 8, 2014 Hi guys! I'm new in this community. I really like this languaje, and the forums are awesome. Also, I have to say that the documentation is really good. All of you are doing a very great work. Now I'm working in a proyect for deploying operating systems through SCCM, and I would really like you to help me, if possible. As you know, SCCM provides a way to automatically deploy operating systems in a network. I'm working in a frontend that allows you to choose and save some information for the deployment: - Computer name inout box (done) - Choose between joining domain, or workgroup (done) - In the case of joining domain, which domain, and which OU you want to place the new computer in. (I have done a combobox to search and show all the available ous in the domain, but the comuter needs to be already joined in order to use it, so it is not useful for this case) - Select hard drive and partition (not done, and I think it wil be difficult) -.... Well, most of the interface is built, but I have found some troubles: When the deploy starts, the computer is not a member from AD, so I need to find a way to discover which domains are availables, and if posible, put them all in a combo box, so that I can choose one of them. I know that you can find this kind of information using nslookup, for example (asking to DNS). The main problem is that nslookup is not available in Winpe and I can't find any other way to do this. Also, If it is not possible, I would like to have a input box in order to write the domain name manually, but not all the FQDN. In the case of having a domain named mydomain.local, I need to only write "mydomain" in order to been able to join it (as you can usually do using windows, and if the DNS/DC are correctly configured). I know AD udf and I have worked with it multiple times, but always as an existing domain user. So, the main questions for me are: - Is there a way to automátically discover Domain controllers and domain names using autoit? The computer could ask to DNS in order to find this info. If this would be possible, I would like to populate this information into a combobox and I think I would not need anything more. Also, I think that a domain username and password would be needed, but this it nos problem.. just need to put username and password inputboxes... - In the case that it's not possible, Is there a way to only write manually the main name of the domain (mydomain instead of mydomain.local)? I will put the code that I'm writting in order to have an idea. I know that it's terrible, but I'm not a programmer :-) There is a list domain controllers function in the AD UDF if that is useful to you. However you shouldn't need to manually enter the main domain in an input box. Nearly everything can be automated. You can use the macro to get the domain name and use it to join the domain. @LogonDomain msgbox(64, "domain", @LogonDomain) EndFuncAutoIt is the shiznit. I love it.
antmar904 Posted December 10, 2014 Posted December 10, 2014 Is it possible to use Waters AD UDF to add a computer to a security group ?
EndFunc Posted December 10, 2014 Posted December 10, 2014 Is it possible to use Waters AD UDF to add a computer to a security group ? Did you actually look at the UDF first? _AD_AddUserToGroup EndFuncAutoIt is the shiznit. I love it.
water Posted December 10, 2014 Author Posted December 10, 2014 The name might be misleading but it works for computers as well. 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
antmar904 Posted December 10, 2014 Posted December 10, 2014 @EndFunc Of course I did but like Water said it was misleading. @Water That is what I was thinking. Thank you ill check it out.
water Posted December 10, 2014 Author Posted December 10, 2014 Don't forget to append a $ to the object name. Means: @Computername & "$" to add the current computer. 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
antmar904 Posted December 12, 2014 Posted December 12, 2014 (edited) @Water, Its a good thing I checked back because my script was not working. After I appended a $, magic ! Thank you again everyone. Edited December 12, 2014 by antmar904
tweakster2010 Posted January 14, 2015 Posted January 14, 2015 (edited) Hey Water, First time posting so I will sum up to where I am at with using the AD UDF. I have a GUI where I plug credentials in then those credentials are bounced off of AD to validate user. When I use an Input box the information works fine but when I use a GUI input box it breaks and populates Error code 7 with no extended. Sorry if its a little messy in advance I have been adjusting then commenting things out when I get closer to what I want. I have been removing the Username1 portion out of the mix to just test the first login with the GUI and it doesnt work either which is why its commented out and moved down a line just as a heads up. I guess I am very messy with code while im in the moment looking through it Hope its understandable enough though what my goal is and how to achieve it easier. Summed up: GUIRead in AD check isnt working for me, am i doing it wrong? It works on launching programs no problem so far just the AD portion seems to be iffy (I assume I coded it wrong). expandcollapse popupFunc Login() $loginGui = GUICreate("Login",200,175) GUICtrlCreateLabel("Admin Username",5,5) $Username = GUICtrlCreateInput("",100,5, -1, -1) GUICtrlCreateLabel("Admin Password",5, 25) $Pass = GUICtrlCreateInput("", 100, 25, -1, -1, $ES_PASSWORD) GUICtrlCreateLabel("Regular Username", 5, 50) $Username1 = GUICtrlCreateInput("", 100,50, -1, -1) GUICtrlCreateLabel("Regular Password",5,75) $Pass1 = GUICtrlCreateInput("", 100, 75, -1, -1, $ES_PASSWORD) $LoginButton = GUICtrlCreateButton("Login", 75,100) GUISetState(@SW_SHOW) _AD_Open() Global $sFQDN = _AD_SamAccountNameToFQDN(GuiCtrlRead($Username)) Global $sDisplayName = _AD_FQDNToDisplayname(GuiCtrlRead($Username)) Global $sFQDN1 = _AD_SamAccountNameToFQDN(GuiCtrlRead($Username1)) Global $sDisplayName1 = _AD_FQDNToDisplayname(GuiCtrlRead($Username1)) Local $sString = StringLeft($sDisplayName,2) If GuiCtrlRead($Username) = "" Or GuiCtrlRead($Pass) = "" Then MsgBox(16, "title", "User Id or Pass can not be blank!!!") Exit ElseIf _AD_Open(GuiCtrlRead($Username, $Pass)) And String($sString) = "test" Then ;And (GuiCtrlRead($Username1, $Pass1)) Case $LoginButton GUISetState(@SW_HIDE) Call(Program) EndIf If String($sString) <> "test" Then MsgBox(0, "title", "" & @CRLF & "CLOSING PROGRAM") Exit EndIf If GuiCtrlRead($Username1) = "" Or GuiCtrlRead($Pass1) = "" Then MsgBox(16, "title", "User Id or Pass can not be blank!!!") Exit While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ElseIf @error <= 8 Then MsgBox(16, "title", "The logon was not succcessful!" & @CRLF & @CRLF & "@error: " & @error & ", @extended: " & @extended) Exit Else MsgBox(16, "title", "The logon was not succcessful!" & @CRLF & @CRLF & "@error: " & @error & ", @extended: " & @extended & _ @CRLF & @CRLF & "Extended error information will be displayed") Exit EndIf _AD_Close() EndSwitch WEnd EndFunc Sorry For some reason the code cut out half of it when I was posting originally >< Edited January 14, 2015 by tweakster2010
water Posted January 14, 2015 Author Posted January 14, 2015 Could you please format your script code? It is quite unreadable right now 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
water Posted January 14, 2015 Author Posted January 14, 2015 Click on the switch button in the upper left corner of the editor and insert the raw text. 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
tweakster2010 Posted January 14, 2015 Posted January 14, 2015 @Water is it readable now? (sorry not sure on if it was due to all the clumping the first attempt did or what not) What im trying to figure out is if the Guiread will work in the _AD_Open portion like I have it listed. If I use a regular input, I remove Guiread and just use the vars and it works fine no issues does the checks. If you want to see the code prior I can post it though.
water Posted January 14, 2015 Author Posted January 14, 2015 You have _AD_Open two times in your script without an _AD_Close before the second _AD_Open. I think you can completely remove the first _AD_Open as _AD_SamAccountNameToFQDN is not needed any longer because all functions accept SamAccountNmae and FQDN. Line _AD_Open(GuiCtrlRead($Username, $Pass)) should be _AD_Open(GuiCtrlRead($Username), GuiCtrlRead($Pass)) 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
tweakster2010 Posted January 14, 2015 Posted January 14, 2015 TOTAL LIFE saver man. I was trying to mirror as if it was input instead of writing it separated (still pretty new to the whole process). Thanks a bunch!
water Posted January 14, 2015 Author Posted January 14, 2015 Glad to be of service 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
Robdog1955 Posted February 5, 2015 Posted February 5, 2015 I am just getting started with AD.au3 and I have a question about my script. It is short and for learning only. It works fine if I use a user account but it fails with "account could not be found" if I use a computer account. I use my own user name and my computer account. Both are domain members. #include <AD.au3> #include <Array.au3> _AD_Open () ;$sAccount = @ComputerName $sAccount = @UserName $aPasswordInfo = _AD_GetPasswordInfo($sAccount) $IsExpired = _AD_IsPasswordExpired($sAccount) Select Case @Error = 0 MsgBox($MB_OK, "Error Result", "Password for account has not expired") Case @Error = 1 MsgBox($MB_OK, "Error Result", "Account could not be found") Case @Error = x MsgBox($MB_OK, "Error Result", "Error as returned by function _AD_GetPasswordInfo") EndSelect _ArrayDisplay($aPasswordInfo, "Computer Password Info") _AD_Close ()
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now