[Samba] Detect for OS version of Active Directory domain controller before join

David Mulder dmulder at samba.org
Tue Aug 2 14:11:34 UTC 2022

On 8/2/22 1:54 AM, Andrey Cherepanov via samba wrote:
> I try to detect Windows 2003 as domain controller before join to it. Is 
> there any way to do it?

You can do a cldap ping and check the nt version. Simplest way might be 
to use the samba python code:

from samba.net import Net
from samba.dcerpc import nbt
from samba.credentials import Credentials
creds = Credentials()

# Properly initialize your creds here

address = '' # Initialize your server address

cldap_ret = net.finddc(address=address, flags=nbt.NBT_SERVER_LDAP | 

cldap_ret.nt_version # Here is the NT Version

I think a Windows 2003 server will report NT Version 5.2.

*David Mulder*
Labs Software Engineer, Samba
1221 Valley Grove Way
Pleasant Grove, UT 84062

dmulder at suse.com

More information about the samba mailing list