def connect_server(server, namespace='', user='', password='', locale='', authority='', impersonation_level='', authentication_level='', security_flags=128, named_value_set=None):
 if impersonation_level:
  try:
   impersonation = getattr(obj._constants, ('wbemImpersonationLevel%s' % impersonation_level.title()))
  except AttributeError:
   raise x_wmi_authentication(('No such impersonation level: %s' % impersonation_level))
 else:
  impersonation = None
 if authentication_level:
  try:
   authentication = getattr(obj._constants, ('wbemAuthenticationLevel%s' % authentication_level.title()))
  except AttributeError:
   raise x_wmi_authentication(('No such impersonation level: %s' % impersonation_level))
 else:
  authentication = None
 server = Dispatch('WbemScripting.SWbemLocator').ConnectServer(server, namespace, user, password, locale, authority, security_flags, named_value_set)
 if impersonation:
  server.Security_.ImpersonationLevel = impersonation
 if authentication:
  server.Security_.AuthenticationLevel = authentication
 return server

def connect_server ( server , namespace = '' , user = '' , password = '' , locale = '' , authority = '' , impersonation_level = '' , authentication_level = '' , security_flags = 128 , named_value_set = None ) : if impersonation_level : try : impersonation = getattr ( obj . _constants , ( 'wbemImpersonationLevel%s' % impersonation_level . title ( ) ) ) except AttributeError : raise x_wmi_authentication ( ( 'No such impersonation level: %s' % impersonation_level ) ) else : impersonation = None if authentication_level : try : authentication = getattr ( obj . _constants , ( 'wbemAuthenticationLevel%s' % authentication_level . title ( ) ) ) except AttributeError : raise x_wmi_authentication ( ( 'No such impersonation level: %s' % impersonation_level ) ) else : authentication = None server = Dispatch ( 'WbemScripting.SWbemLocator' ) . ConnectServer ( server , namespace , user , password , locale , authority , security_flags , named_value_set ) if impersonation : server . Security_ . ImpersonationLevel = impersonation if authentication : server . Security_ . AuthenticationLevel = authentication return server
return a remote server running wmi .