Search code examples
windowsui-automationautoit

How to read domain name information?


I need to read domain name information from sysdm.cpl using AutoIt. I am able to launch the console.

Class value for the domain info (obtained using AutoIt Window Information Tool) is #32770.

Run("control.exe sysdm.cpl,,4")

enter image description here


Solution

  • This works for domain and for workgroup too:

    Local $oWinNT = ObjGet("WinNT:")
    For $oDomain In $oWinNT
        ConsoleWrite($oDomain.Name & @CRLF)
    Next
    

    I've found a more detailed (and faster) solution that uses the WinAPI NetGetJoinInformation.