The Active Directory can only connect to one domain at a time.
So if your computers are in a different domain you can either:
- Close the connection to domain sub.domain.com using _AD_Close() and then connect to domain sub2.sub.domain.comspecifying the necessary parameters for _AD_Open
- Connect to the global catalog (GC). So you can query all properties that are replicated to the global catalog. The GC is read-only.
This is not a valid FQDN.
Run the _AD_GetObjectProperties.au3 example script and see what you get in example 3 - properties for your computer. distinguishedName the FQDN of your computer.
Can you please post the code you use to query the computer properties?
After some tweaking, I got it to work now. Below is my code, but why I wanted to do this, is I was looking at grabbing the description. For my test computer the description is 5th in the array, but it might not always be that way, so how can I have the message box show only the description field, instead of hard-coding 5 in it? I tried putting "description" in it, but it errors out. Any way to do that with out loops looking at what each value is?
$SConfiguration = $sAD_Configuration
$SDNSDomain = "DC=sub2,DC=sub1,DC=domain,DC=com"
$SHostServer = "server.sub2.sub1.domain.com"
Open("", "", $SDNSDomain, $SHostServer, $SConfiguration)
ConsoleWrite("Starting with the computer: '" & $stComp & "$" & "'" & @CRLF)
$aProperties = _
GetObjectProperties($stComp & "$")
If @error = 0 Then
ConsoleWrite("Diplaying array" & @CRLF)
MsgBox(0, "Description", $aProperties)
ConsoleWrite("Error code: " & @error & @CRLF & "Extended: " & @extended & @CRLF)
ConsoleWrite("Finished" & @CRLF)
EndFunc ;==> _GetAD