water Posted February 1, 2012 Share Posted February 1, 2012 (edited) @error = 1 means: OU does not exist. Do you specify the OU as FQDN like "OU=sampleou,OU=sampleparent,DC=sampledomain1,DC=sampledomain2" Edited February 1, 2012 by water 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 More sharing options...
jazzyjeff Posted February 1, 2012 Share Posted February 1, 2012 Water, Thanks for your patience on this. I am now back in the office and I am testing this out. I'll just continue to use this thread as we seem to have the same issue if that's ok. I ran the script you compiled and I get this error: _AD_Open: @error: -2147352567 @extended: 0 Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Share Posted February 1, 2012 That's fine for me. I will test and answer tomorrow as soon as I'm in my office again. But I have to admit that this problem becomes more and more mysterious. 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 More sharing options...
mik3 Posted February 1, 2012 Author Share Posted February 1, 2012 Water I select the OU with the tool you previously created, then I copy and paste it. Link to comment Share on other sites More sharing options...
water Posted February 2, 2012 Share Posted February 2, 2012 @jazzyjeff There seems to be a problem with connecting to the AD. Could you please run this code?#include <ad.au3> $iAD_Debug = 2 Global $AdminUserName = "" ; Username with permissions to create computer accounts and set permisisons on the computer account in AD Global $AdminUserPassword = "" ; Password Global $DomainName = "" ; Optional: Domain name e.g. DC=microsoft,DC=com Global $DomainController = "" ; Optional: Name of Domain Controller e.g.DC-Server1.microsoft.com Global $ConfigurationContext = "" ; Optional: Configuration naming context e.g. CN=Configuration,DC=microsoft,DC=com Global $OU = "" ; Organizational unit to create the computer account in e.g. OU=Computer_Accounts,DC=microsoft,DC=com Global $ComputerName = "" ; Name of the computer account to create. SamAccountName without trailing "$" e.g. C0001 Global $Usergroup = "" ; Name of the user account or group to join the physical computer to the domain _AD_Open($AdminUserName, $AdminUserPassword, $DomainName, $DomainController, $ConfigurationContext) If @error Then Exit MsgBox(16, "ADAT", "_AD_Open: @error: " & @error & ", @extended: " & @extended) _AD_CreateComputer($OU, $ComputerName, $Usergroup) If @error Then Exit MsgBox(16, "ADAT", "_AD_CreateComputer: @error: " & @error & ", @extended: " & @extended) MsgBox(64, "ADAT", "Computer successfully created!") _AD_Close() 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 More sharing options...
water Posted February 2, 2012 Share Posted February 2, 2012 @mik3 Could you please post the complete script you run including all parameters you've set? Please replace confidential infomation with xxx but leave the structure untouched e.g. "OU=computers,DC=microsoft,DC=com" can become "OU=computers,DC=xxxx,DC=com" Or you can send me the code using the forums private mail feature. 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 More sharing options...
jazzyjeff Posted February 2, 2012 Share Posted February 2, 2012 The debug code gave me the following error: Link to comment Share on other sites More sharing options...
water Posted February 2, 2012 Share Posted February 2, 2012 @jazzyjeff, the message is self-explanatory. Creating the computer account was succesful during one of the last test I assume. 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 More sharing options...
jazzyjeff Posted February 2, 2012 Share Posted February 2, 2012 Ah man! I hate it when i do this... It's working now. I swear I tried all this stuff (except for downgrading the AutoIT). Thanks for all your help as always. Jeff Link to comment Share on other sites More sharing options...
water Posted February 2, 2012 Share Posted February 2, 2012 I'm glad the problem could be solved. 'Cause I was running out of ideas 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 More sharing options...
jazzyjeff Posted February 3, 2012 Share Posted February 3, 2012 (edited) Hey Water, Well it was/is working again on XP, but Windows 7 still isn't working. The script will create the computer account in the AD domain, but the PC won't join to the domain, it just stays in a workgroup. I have ran this as the local administrator "running as admin" and it still doesn't work. I guess I have given up on that part for my script. I found this on the microsoft site that works for me. Func _JoinDomain() Const $JOIN_DOMAIN = 1 Const $ACCT_CREATE = 2 Const $ACCT_DELETE = 4 Const $WIN9X_UPGRADE = 16 Const $DOMAIN_JOIN_IF_JOINED = 32 Const $JOIN_UNSECURE = 64 Const $MACHINE_PASSWORD_PASSED = 128 Const $DEFERRED_SPN_SET = 256 Const $INSTALL_INVOCATION = 262144 Const $OU = "OU=" &amp; $selSchool1 &amp; ",OU=PC,OU=Workstations,DC=domain,DC=net" $strDomain = "domain" $strPassword = "password" $strUser = "username" $strComputer = @ComputerName $objComputer = ObjGet("winmgmts:{impersonationLevel=Impersonate}!" &amp; _ $strComputer &amp; "rootcimv2:Win32_ComputerSystem.Name='" _ &amp; $strComputer &amp; "'") $ReturnValue = $objComputer.JoinDomainOrWorkGroup($strDomain, _ $strPassword, _ $strDomain &amp; "" &amp; $strUser, _ $OU, _ $JOIN_DOMAIN + $ACCT_CREATE) EndFunc ;==&gt;_JoinDomain I appreciate your help with this. Just wanted to give you an fyi. I'm sure it's my script, but I just can't figure it out, but this wmi works. Thanks for all your help. Edited February 3, 2012 by jazzyjeff Link to comment Share on other sites More sharing options...
water Posted February 3, 2012 Share Posted February 3, 2012 I really don't understand why my script doesn't work because it does the same as the script you posted. I searched the forum but could'nt find a problem with joining the domain and Windows 7. But as you've solved your problem I think we can close this issue. 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 More sharing options...
mik3 Posted February 6, 2012 Author Share Posted February 6, 2012 @Water, It was an error on my part. The test script created the computer account. I got a popup that said "Computer successfully created!" Link to comment Share on other sites More sharing options...
mik3 Posted February 6, 2012 Author Share Posted February 6, 2012 Do I need to change anything on the original script? Link to comment Share on other sites More sharing options...
water Posted February 6, 2012 Share Posted February 6, 2012 By "original script" you refer to the code I posted in #11? 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 More sharing options...
mik3 Posted February 6, 2012 Author Share Posted February 6, 2012 Just the latest complete script. Link to comment Share on other sites More sharing options...
water Posted February 6, 2012 Share Posted February 6, 2012 I added the latest code of ADAT to post 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 More sharing options...
mik3 Posted February 6, 2012 Author Share Posted February 6, 2012 Still getting error creating computer. I do not know what is wrong. The same test script, where you asked to add all my info, worked. Now using the stuff from post 11 does not.http://static.inky.ws/image/1255/image.jpg Link to comment Share on other sites More sharing options...
water Posted February 6, 2012 Share Posted February 6, 2012 I will add some debugging code so we can see where the problem is ... Stay tuned. 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 More sharing options...
water Posted February 7, 2012 Share Posted February 7, 2012 (edited) Here you find a version of the code with some MsgBox inserted to make sure we get the correct data and use the correct functions.Can you run the script with the exact same data as you have used with the short test script I provided?Can you then post the screenshots you get (make sure to gray out the sensitive data like password, domain name etc.)?Edit:Code removed - can now be found in the example thread for this UDF. Edited April 15, 2012 by water 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 More sharing options...
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