Kbelcher Posted August 18, 2011 Share Posted August 18, 2011 Hello All, I am new to scripting in AutoIt and am having some troubles. I am using JoeWare's adfind.exe and admod.exe AD tools to modify User/Computer object attributes. Currently I open a command prompt where the .exe's are located and run the following command: adfind.exe -b -default -rb "ou=Printers,ou=Anaconda,ou=OPD,ou=DOA" -f "&(objectCategory=computer)(!doaITSDBillingClient=EXE-OPD-610805-OPD_20520)" -dsq | admod.exe "doaITSDBillingClient::EXE-OPD-610805-OPD_20520" -unsafe Basically it searches a defined OU for computer objects and pipes the results into the modification tool. I have about 50 similar commands to run on different OUs and object types so I would like to get them all into one script. Currently I have attempted using the following code in an AutoIt script, but it is not working: RunWait(@ComSpec & '"C:\ADTools\adfind.exe -b -default -rb "ou=Printers,ou=Anaconda,ou=OPD,ou=DOA" -f "&(objectCategory=computer)(!doaITSDBillingClient=EXE-OPD-610805-OPD_20520)" -dsq | admod.exe "doaITSDBillingClient::EXE-OPD-610805-OPD_20520" -unsafe"') Any help you can provide me as a n00b is greatly appreciated. Cheers Link to comment Share on other sites More sharing options...
Kbelcher Posted August 18, 2011 Author Share Posted August 18, 2011 Hello All,I am new to scripting in AutoIt and am having some troubles. I am using JoeWare's adfind.exe and admod.exe AD tools to modify User/Computer object attributes. Currently I open a command prompt where the .exe's are located and run the following command: adfind.exe -b -default -rb "ou=Printers,ou=Anaconda,ou=OPD,ou=DOA" -f "&(objectCategory=computer)(!doaITSDBillingClient=EXE-OPD-610805-OPD_20520)" -dsq | admod.exe "doaITSDBillingClient::EXE-OPD-610805-OPD_20520" -unsafeBasically it searches a defined OU for computer objects and pipes the results into the modification tool. I have about 50 similar commands to run on different OUs and object types so I would like to get them all into one script. Currently I have attempted using the following code in an AutoIt script, but it is not working:RunWait(@ComSpec & '"C:\ADTools\adfind.exe -b -default -rb "ou=Printers,ou=Anaconda,ou=OPD,ou=DOA" -f "&(objectCategory=computer)(!doaITSDBillingClient=EXE-OPD-610805-OPD_20520)" -dsq | admod.exe "doaITSDBillingClient::EXE-OPD-610805-OPD_20520" -unsafe"')Any help you can provide me as a n00b is greatly appreciated.CheersI just thought I would add that I have each of the 50 or so pieces of code in separate text files right now...don't know if there is an easier way to go about the whole process but am open to any and all suggestions. Link to comment Share on other sites More sharing options...
water Posted August 19, 2011 Share Posted August 19, 2011 Please have a look at my Active Directory UDF (for download please see my signature). Functions _AD_GetObjectsInOU and _AD_ModifyAttribute should do what you need. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Jackized Posted February 16, 2012 Share Posted February 16, 2012 I can get the _AD_ModifyAttribute to modify a users description but not a computers description. Link to comment Share on other sites More sharing options...
water Posted February 16, 2012 Share Posted February 16, 2012 I can get the _AD_ModifyAttribute to modify a users description but not a computers description.I assume you pass the SamAccountName to the function (e.g. @Username for a user account or @ComputerName for the computer account).The SamAccountName of a computer has a Dollar sign appended.So you have to pass: @ComputerName & "$" My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - 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