Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '************************************************************************
- '* This script is for all user management needs.
- '* computer running Win2K or WinNT w/WMI installed.
- '************************************************************************
- Option Explicit
- On Error Resume Next
- Dim User , LstNm , Acry , dlg , UserName, MSG ,Prop , result,domainname,newpass
- domainname = InputBox("Please enter domain name: " & vbcrlf & "If you leave it blank the domain name will be accepted as DOMAIN. " , "Domain Information")
- if domainname = "" then domainname = "DOMAIN"
- call main()
- sub main()
- UserName = InputBox("Please enter UserName: ", "User Information")
- set User = GetObject("WinNT://" + domainname + "/" + UserName)
- If User.Name = "" Then
- Dim wu
- wu = MsgBox("UserName is not specified." & vbcrlf & vbcrlf & "Do you want to enter another name?",4,"No such user")
- msgbox wu
- if wu=6 then call main else exit sub
- Else
- MSG= vbCRLf
- MSG = MSG & "User (ID): " & UserName & vbcrlf
- MSG = MSG & "Full Name: " & User.FullName & vbcrlf
- MSG = MSG & "Description: " & User.Description & vbcrlf
- MSG = MSG & vbcrlf
- MSG = MSG & "Group Membership " & vbcrlf
- For Each Prop In User.groups
- MSG = MSG & " " & Prop.Name & vbcrlf
- Next 'Prop
- Acry = Instr(1, User.FullName, ", ", 1)
- 'LstNm = Left(User.FullName, Acry - 1)
- If User.IsAccountLocked = -1 Then
- MSG = MSG & vbcrlf
- MSG = MSG & "Account Status: Locked" & vbcrlf
- Else
- MSG = MSG & vbcrlf
- MSG = MSG & "Account Status: Active" & vbcrlf
- End if
- 'If User.LastLogin < 0 Then
- 'MSG = MSG & vbcrlf
- 'MSG = MSG & LstNm & " is not logged on to domain." & vbcrlf
- 'Else
- 'MSG = MSG & vbcrlf
- 'MSG = MSG & LstNm & " Last" & vbCRLF & "User Logon" & vbCRLF & "Time: " & User.LastLogin & vbcrlf
- 'End if
- If User.IsAccountLocked = -1 Then
- MSG = MSG & vbcrlf
- MSG = MSG & "Do you want to unlock " & vbcrlf
- result=msgbox (msg,4,Username & " Status")
- Else
- MSG = MSG & vbcrlf
- MSG = MSG & "The user is not locked out." & vbcrlf
- result=msgbox (msg,0,Username & " Status")
- End if
- if result=6 then
- User.IsAccountLocked = 0
- User.SetInfo
- result = msgbox(username & " has been unlocked successfully.")
- end if
- result = msgbox (username & " Attempt to change the password of the user?",4,"Password")
- if result = 6 then
- newpass = InputBox(" Please enter the user's new password : ", "New Password")
- Call User.SetPassword(NewPass)
- result = msgbox (username & " The password has been changed successfully.",0,"Password change")
- end if
- result = msgbox (username & " user is allowed to change his/her password" & vbcrlf & "at next logon?",4,"Authorization State")
- if result = 6 then
- User.passwordexpired = 1
- User.SetInfo
- result = msgbox (username & " will be able to change his/her password at next logon.",0,"Status Change")
- end if
- set User = nothing
- set LstNm = nothing
- set Acry = nothing
- set wu = nothing
- End If
- wu = MsgBox("Do you want to enter another user name?",4,"New User")
- if wu=6 then call main
- end sub
Add Comment
Please, Sign In to add comment