My machine is in example1 and im trying to get info about machines that are on other LDAP servers. I can do it exactly like this with a powershell script but doesn't seem to using pyad. No results are found from other LDAP servers. I've tried doing it manually like adcomputer.ADComputer.from_cn("example2pc", options=dict(ldap_server="example2")) but still doesn't find the machine.
When I use the activedirectory module in powershell, I can run the command ...
Get-ADComputer -Server example2 -Identity example2pc -Properties *
... successfully and information in retrieved.
Any idea whats wrong?
ADServers = ['example1','example2','example3,'example4','example5','example6']
for svr in ADServers:
try:
computerobj = adcomputer.ADComputer.from_cn("example2pc", options=dict(ldap_server=svr))
computerattribs = {'OperatingSystem':'', 'OperatingSystemVersion':'', 'distinguishedName':''}
attribslist = ['OperatingSystem', 'OperatingSystemVersion', 'distinguishedName']
for attr in attribslist:
computerattribs[attr] = str(computerobj.get_attribute(attr))[2:-2]
print(computerattribs)
break
except Exception as E:
print(E)
continue
My machine is in example1 and im trying to get info about machines that are on other LDAP servers. I can do it exactly like this with a powershell script but doesn't seem to using pyad. No results are found from other LDAP servers. I've tried doing it manually like
adcomputer.ADComputer.from_cn("example2pc", options=dict(ldap_server="example2"))
but still doesn't find the machine.When I use the activedirectory module in powershell, I can run the command ...
Get-ADComputer -Server example2 -Identity example2pc -Properties *
... successfully and information in retrieved.
Any idea whats wrong?