Member Avatar for MarcusMaximus

Hi,

I'm looking for a way to getthe domain a computer is connected to and the name of the domain controller if possible. I've looked at the os, socket and platform and can't find anything. I have been able to retrieve various bits of system info using these modules but not the domain.

I have been able to get the fully qualified domain name using socket.getfqdn() and I know with a bit of work I can remove the hostname to get the domain the computer is attached to but I don't want to reinvent the wheel if there is a function that all ready exists.

I don't want to use the win32com module either as I was this to be cross platform.

Thanks

Member Avatar for MarcusMaximus

Is there a way to edit posts. The code to get the domain using a work around is:

import socket
print socket.getfqdn().replace(socket.gethostname() + ".","")

I'd still perfer to know if there is a function that I'm missing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.