Announcement

Collapse
No announcement yet.

Is User Active

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is User Active

    Please use the script to know whether the user is active or not.

    Code:
    def IsUserActive(uName):
        import os
        proObj = os.popen('net user')
        activeUsers = proObj.read()
        return uName in activeUsers
    
    passUserNameHere='purushothaman'
    if IsUserActive(passUserNameHere):
        print 'Success: '+passUserNameHere+' is active'
    else:
        print 'Fail: No User-'+passUserNameHere+' active!'
    Sample Output:
    Click image for larger version

Name:	IsUserActive.PNG
Views:	1
Size:	1.6 KB
ID:	4775

    Last edited by Purushothaman; 11-04-2016, 01:27 PM.
Working...
X