water Posted February 19, 2012 Share Posted February 19, 2012 Glad to be of service 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...
HockeyFan Posted February 19, 2012 Author Share Posted February 19, 2012 BTW:Your script is missing an Exit button. I always had to kill the script to exit.water,Sorry about that! This script is a segment of another bigger script and I just pulled out the code related to this task. I;ve just been using the "HotKey" command to kill the script. Should have added an exit function... Link to comment Share on other sites More sharing options...
water Posted February 19, 2012 Share Posted February 19, 2012 Never mind! It was just a hint so you could enhance usability of your script 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...
HockeyFan Posted February 19, 2012 Author Share Posted February 19, 2012 Glad to be of service water,since you've been suck a great help, I'd like to ask another question...Do you have an example script of how to "search" for the existance of a computer within the Domain?I'd like to add this functionality to my script so that it would notify you if the computer is already a part of the Domain, before attempting to join it.Thanks again! Link to comment Share on other sites More sharing options...
water Posted February 19, 2012 Share Posted February 19, 2012 Sure, that's easy. I assume you have the name of the computer (e.g. C0001).$sComputer = "C0001" & "$" $iResult = _AD_ObjectExists($sComputer) You have to append "$" to the computer name because the SamAccountName of a computer is computername & "$". If the computer exists $iResult is set to 1. 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...
HockeyFan Posted February 19, 2012 Author Share Posted February 19, 2012 Sure, that's easy. I assume you have the name of the computer (e.g. C0001).$sComputer = "C0001" & "$" $iResult = _AD_ObjectExists($sComputer) You have to append "$" to the computer name because the SamAccountName of a computer is computername & "$". If the computer exists $iResult is set to 1. Awesome! Thank you!! Well, if that was so easy for you, how about this... If the computer already exists, how do I display its current location? Link to comment Share on other sites More sharing options...
BrewManNH Posted February 19, 2012 Share Posted February 19, 2012 I'd suggest looking at what's available in the AD UDF collection to see what it's able to do, rather than asking such easily answered questions. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
water Posted February 19, 2012 Share Posted February 19, 2012 _AD_GetObjectAttribute($sComputer, "distinguishedname")returns the FQDN of the object. You then can extract the OU. 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...
HockeyFan Posted February 19, 2012 Author Share Posted February 19, 2012 I'd suggest looking at what's available in the AD UDF collection to see what it's able to do, rather than asking such easily answered questions.BrewManNH,Your right! ...but water was on a roll and I'm on a time cruch!! I enjoyed the easy way out for a moment!I'll get back to doing it the correct way! Thanks for the push. Link to comment Share on other sites More sharing options...
HockeyFan Posted February 19, 2012 Author Share Posted February 19, 2012 _AD_GetObjectAttribute($sComputer, "distinguishedname")returns the FQDN of the object. You then can extract the OU. Water, Dude, you ROCK!! ...but, as suggested, I'll get back to disecting the UDF to answer any further questions that I have. But really, THANK YOU SO MUCH!!!! 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