water Posted February 19, 2012 Posted February 19, 2012 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
HockeyFan Posted February 19, 2012 Author 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...
water Posted February 19, 2012 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 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
HockeyFan Posted February 19, 2012 Author 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!
water Posted February 19, 2012 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 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
HockeyFan Posted February 19, 2012 Author 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?
BrewManNH Posted February 19, 2012 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
water Posted February 19, 2012 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 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
HockeyFan Posted February 19, 2012 Author 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.
HockeyFan Posted February 19, 2012 Author 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!!!!
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