[SOLVED] Checking if a PC is on a domain
Published: June 16, 2020 - 12:21
Good morning,
I would like to test in a package whether a PC is joined to my domain or in a workgroup. I had this function below, but it's not suitable because whether the PC is in a workgroup with an IP address assigned by DHCP (from the domain) or joined to the PEDAGO.lan domain, socket.getfqdn() returns the same name (e.g., PCNAME.PEDAGO.lan).
I would like to test in a package whether a PC is joined to my domain or in a workgroup. I had this function below, but it's not suitable because whether the PC is in a workgroup with an IP address assigned by DHCP (from the domain) or joined to the PEDAGO.lan domain, socket.getfqdn() returns the same name (e.g., PCNAME.PEDAGO.lan).
Code: Select all
def domain():
if ("PEDAGO.lan" in socket.getfqdn()):
dom="PEDAGO"
else:
print('PC en workgroup')
dom="WG"
return dom