def SetInfo(userName=None):
 if (userName is None):
  userName = win32api.GetUserName()
 oldData = win32net.NetUserGetInfo(server, userName, 3)
 try:
  d = oldData.copy()
  d['usr_comment'] = 'Test comment'
  win32net.NetUserSetInfo(server, userName, 3, d)
  new = win32net.NetUserGetInfo(server, userName, 3)['usr_comment']
  if (str(new) != 'Test comment'):
   raise RuntimeError(('Could not read the same comment back - got %s' % new))
  print 'Changed the data for the user'
 finally:
  win32net.NetUserSetInfo(server, userName, 3, oldData)

def SetInfo ( userName = None ) : if ( userName is None ) : userName = win32api . GetUserName ( ) oldData = win32net . NetUserGetInfo ( server , userName , 3 ) try : d = oldData . copy ( ) d [ 'usr_comment' ] = 'Test comment' win32net . NetUserSetInfo ( server , userName , 3 , d ) new = win32net . NetUserGetInfo ( server , userName , 3 ) [ 'usr_comment' ] if ( str ( new ) != 'Test comment' ) : raise RuntimeError ( ( 'Could not read the same comment back - got %s' % new ) ) print 'Changed the data for the user' finally : win32net . NetUserSetInfo ( server , userName , 3 , oldData )
attempts to change the current users comment .