def get_domain_workgroup():
 pythoncom.CoInitialize()
 conn = wmi.WMI()
 for computer in conn.Win32_ComputerSystem():
  if computer.PartOfDomain:
   return {'Domain': computer.Domain}
  else:
   return {'Workgroup': computer.Domain}

def get_domain_workgroup ( ) : pythoncom . CoInitialize ( ) conn = wmi . WMI ( ) for computer in conn . Win32_ComputerSystem ( ) : if computer . PartOfDomain : return { 'Domain' : computer . Domain } else : return { 'Workgroup' : computer . Domain }
get the domain or workgroup the computer belongs to .