def validate_windows_cred(host, username='Administrator', password=None, retries=10, retry_delay=1):
 cmd = 'winexe -U \'{0}%{1}\' //{2} "hostname"'.format(username, password, host)
 logging_cmd = 'winexe -U \'{0}%XXX-REDACTED-XXX\' //{1} "hostname"'.format(username, host)
 for i in xrange(retries):
  ret_code = win_cmd(cmd, logging_command=logging_cmd)
  if (ret_code == 0):
   break
  time.sleep(retry_delay)
 return (ret_code == 0)

def validate_windows_cred ( host , username = 'Administrator' , password = None , retries = 10 , retry_delay = 1 ) : cmd = 'winexe -U \'{0}%{1}\' //{2} "hostname"' . format ( username , password , host ) logging_cmd = 'winexe -U \'{0}%XXX-REDACTED-XXX\' //{1} "hostname"' . format ( username , host ) for i in xrange ( retries ) : ret_code = win_cmd ( cmd , logging_command = logging_cmd ) if ( ret_code == 0 ) : break time . sleep ( retry_delay ) return ( ret_code == 0 )
check if the windows credentials are valid .