EddardStark Posted August 3, 2009 Posted August 3, 2009 I'm writing a script that would be greatly aided by be able to find the local machine's OU inside Active Directory. As far as I understand, Microsoft in its infinite wisdom did not put this attribute anywhere in the registry. I did find a key that has the machine's name along with the OU is a member of. My questions are: 1) Is it possible to kind of like an "IfExist" regread where I can search a specific registry key to see if it contains certain text? 2) Does anybody have a way to find out the OU of a machine by issuing commands through an AutoIT script? Thanks a lot!
failedtocompile Posted August 4, 2009 Posted August 4, 2009 (edited) I'm writing a script that would be greatly aided by be able to find the local machine's OU inside Active Directory. As far as I understand, Microsoft in its infinite wisdom did not put this attribute anywhere in the registry. I did find a key that has the machine's name along with the OU is a member of. My questions are: 1) Is it possible to kind of like an "IfExist" regread where I can search a specific registry key to see if it contains certain text? 2) Does anybody have a way to find out the OU of a machine by issuing commands through an AutoIT script? Thanks a lot! Hello EddardStark I am not an Autoit expert but if you could run "dsquery computer domianroot -name computername" you maybe prompted for domain admin credentials but you could i think incorporate that into your script such as maybe?? #RequireAdmin $computer = inputbox("computerName", "", "", "") RunWait(@ComSpec & "/c " & 'dsquery computer domainroot -name' & " " & $computer & " " & '>' & @ScriptDir & '\query.txt',"",@SW_HIDE) N.B. my code doesn't work as I am not that proficient in Autoit as of yet but maybe someone else can help with this code for you Then export it to a file and read information after OU= as a mentioned I am not an expert but i would think if you spent time on looking at some ideas i had you migth be able to come up with something >_< hehe Edited August 4, 2009 by failedtocompile
somdcomputerguy Posted August 4, 2009 Posted August 4, 2009 (edited) For Question 1 -RegReadStringCompare Edited August 4, 2009 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
AdmiralAlkex Posted August 4, 2009 Posted August 4, 2009 For Question 1 -RegReadStringCompareDon't you mean StringInStr? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
somdcomputerguy Posted August 4, 2009 Posted August 4, 2009 Ya I guess, since OP just wants to search for text contained in a string. I didn't read the first post well enough.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
water Posted August 4, 2009 Posted August 4, 2009 (edited) The following script should give you the FQDN of the local computer. You can strip off the OU you need.adfunctions.au3 can be found here.#include <adfunctions.au3> ConsoleWrite(_ADSamAccountNameToFQDN(@ComputerName & "{:content:}quot;) & @CRLF) Edited August 4, 2009 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
EddardStark Posted August 5, 2009 Author Posted August 5, 2009 Thanks guys. You gave me a few ideas and options that I can easily work from.
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