DonChunior Posted August 8 Share Posted August 8 (edited) In my Network and Sharing center you can see (see screenshot) that I have an active domain network. Is there a way to … determine the active networks with AutoIt, find out whether one of them is a domain network and if one is found, obtain the IP address associated with it? In my opinion, you could also go the other way round and … collect the IP addresses of the macros @IPAddress1 to 4 and check each address to see whether it belongs to an active domain network. Regards, DonChunior Edited August 8 by DonChunior Link to comment Share on other sites More sharing options...
water Posted August 8 Share Posted August 8 I started here to get a list of networks. MS information can be found here. DonChunior and Danyfirex 1 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 Link to comment Share on other sites More sharing options...
DonChunior Posted August 8 Author Share Posted August 8 Hello @water, thanks, that looks like a good starting point for further activities. Regards, DonChunior Link to comment Share on other sites More sharing options...
water Posted August 8 Share Posted August 8 I use the following script to check that the computer is connected to an AD domain: expandcollapse popup; #INTERNAL_USE_ONLY#============================================================================================================ ; Name ..........: __NetworkCheck ; Description ...: Check if the local machine is connected to a domain. ; Syntax ........: __NetworkCheck() ; Parameters ....: None ; Return values .: Success - One of the following integer values: ; |0 - The local machine is not connected to a domain ; |1 - The local machine is connected to a domain ; Failure - 0 and sets @error to one of the following values: ; |1 = Could not create the NLM object ; |2 = Could not create the NetworkConnections object ; |3 = Could not create the Network object ; Author ........: water ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: https://learn.microsoft.com/en-us/windows/win32/NLA/portal ; https://www.autoitscript.com/forum/topic/174245-get-connected-networks/?do=findComment&comment=1261045 ; Example .......: ; =============================================================================================================================== Func __NetworkCheck() ; NLM_DOMAIN_TYPE: The NLM_DOMAIN_TYPE enumeration is a set of flags that specify the domain type of a network. ; See: https://learn.microsoft.com/en-us/windows/win32/api/netlistmgr/ne-netlistmgr-nlm_domain_type Local Const $NLM_DOMAIN_TYPE_NON_DOMAIN_NETWORK = 0 Local Const $NLM_DOMAIN_TYPE_DOMAIN_NETWORK = 0x1 Local Const $NLM_DOMAIN_TYPE_DOMAIN_AUTHENTICATED = 0x2 #forceref $NLM_DOMAIN_TYPE_NON_DOMAIN_NETWORK Local $bConnected2Domain = False Local $sNLM_ClsID = "{DCB00C01-570F-4A9B-8D69-199FDBA5723B}" Local $oNLM, $oNetworkConnections, $oNetwork $oNLM = ObjCreate($sNLM_ClsID) ; Create the object for the Network List Manager If @error Then Return SetError(1, @error, 0) If $oNLM.IsConnected Then ; The local machine has network connectivity, check details $oNetworkConnections = $oNLM.GetNetworkConnections ; Get the collection of NetworkConnections If @error Then Return SetError(2, @error, 0) For $oNetworkConnection In $oNetworkConnections ; Check each NetworkConnection $oNetwork = $oNetworkConnection.GetNetwork If @error Then Return SetError(3, @error, 0) If $oNetwork.IsConnected = True And ($oNetwork.GetDomainType = $NLM_DOMAIN_TYPE_DOMAIN_NETWORK Or $oNetwork.GetDomainType = $NLM_DOMAIN_TYPE_DOMAIN_AUTHENTICATED) Then $bConnected2Domain = True Next Return ($bConnected2Domain = True) ? 1 : 0 Else Return 0 EndIf EndFunc ;==>__NetworkCheck Danyfirex 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 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