→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎02-21-2008 12:24 AM
cmd.exe /K \\server\share$\Lansweeper\psexec.exe -c -f \\{computer} \\server\share$\Lansweeper\run_chkdsk.bat
echo Y|chkdsk /F c:
\\server\share$\Lansweeper\delprof.exe /q /i /c:\\{computer} /d:180
cmd.exe /K \\server\share$\Lansweeper\saplogon.bat {computer}
copy \\server\share$\Lansweeper\saplogon.ini \\%1\c$\windows
cmd.exe /K \\server\share$\Lansweeper\uptime.exe {computer} /s
cmd.exe /K \\server\share$\Lansweeper\psloggedon.exe \\{computer}
‎12-20-2011 12:23 AM
‎12-12-2011 11:04 PM
If WScript.Arguments.Count = 1 Then
struser = WScript.Arguments(0)
Set objUser = GetObject("LDAP://" & struser)
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
Const ADS_ACETYPE_ACCESS_DENIED_OBJECT = &H6
Const CHANGE_PASSWORD_GUID = "{ab721a53-1e2f-11d0-9819-00aa0040529b}"
Set objSD = objUser.Get("nTSecurityDescriptor")
Set objDACL = objSD.DiscretionaryAcl
Set objUserLDAP = GetObject("LDAP://" & struser)
intCurrentValue = objUserLDAP.Get("userAccountControl")
strSAMAccountName = objUser.Get("sAMAccountName")
strCN = objUser.Get("cn")
Set objNet = CreateObject("WScript.NetWork")
dtmValue = objUserLDAP.PasswordLastChanged
intTimeInterval = int(now - dtmValue)
Set objDomainNT = GetObject("WinNT://" & objNet.UserDomain)
intMaxPwdAge = objDomainNT.Get("MaxPasswordAge")/86400
intMinPwdAge = objDomainNT.Get("MinPasswordAge")/86400
For Each Ace In objDACL
If ((Ace.AceType = ADS_ACETYPE_ACCESS_DENIED_OBJECT) And _
(LCase(Ace.ObjectType) = CHANGE_PASSWORD_GUID)) Then
blnEnabled = True
End If
Next
'Clear strMsg
strMsg = ""
'Account Disabled?
If objuser.AccountDisabled = True Then
MsgBox "This account is Disabled.",0,strCN & " (" & strSAMAccountName & ")"
Else
'Account Locked?
If objuser.IsAccountLocked = True Then
strMsg = strMsg & "This account is Enabled but Locked." & VbCrLf & VbCrLf
Else
strMsg = strMsg & "This account is Enabled and Not Locked." & VbCrLf & VbCrLf
End If
'Password Expires?
If intCurrentValue and ADS_UF_DONT_EXPIRE_PASSWD Then
strMsg = strMsg & "The Password Never Expires for this account due to account settings." & VbCrLf & _
" Password Changed: " & DateValue(dtmValue) & VBTab & int(now - dtmvalue) & " days ago" & VbCrLf & VbCrLf
Else
If intMaxPwdAge < 0 Then
strMsg = strMsg & "The Maximum Password Age is set to 0 in the domain. Therefore, the password does not expire." & VbCrLf & VbCrLf
Else
'Password Expired already?
If intTimeInterval >= intMaxPwdAge Then
strMsg = strMsg & "The password has Expired." & VbCrLf & _
" Password Changed: " & DateValue(dtmValue) & VBTab & int(now - dtmvalue) & " days ago" & VbCrLf & _
" Password Expires: " & DateValue(dtmValue + intMaxPwdAge) & VBTab & int(now - (dtmValue + intMaxPwdAge)) & " days ago" & VbCrLf & _
" (Maximum password age: " & intMaxPwdAge & " days)" & VbCrLf & VbCrLf
Else
strMsg = strMsg & "The password has Not Expired." & VbCrLf & _
" Password Changed: " & DateValue(dtmValue) & VBTab & int(now - dtmvalue) & " days ago" & VbCrLf & _
" Password Expires: " & DateValue(dtmValue + intMaxPwdAge) & VBTab & int((dtmValue + intMaxPwdAge) - now + 1) & " days from today" & VbCrLf & _
" (Maximum password age: " & intMaxPwdAge & " days)" & VbCrLf & VbCrLf
End If
End If
End If
'User can Change the Password?
If blnEnabled Then
strMsg = strMsg & strCN & " cannot change the password due to account settings."
Else
If intTimeInterval >= intMinPwdAge Then
strMsg = strMsg & strCN & " can change the password."
Else
strMsg = strMsg & strCN & " can change the password after " & DateValue(dtmValue) + intMinPwdAge & "." & VbCrLf & _
" (Minimum password age: "& intMinPwdAge & " days)"
End If
End If
'Display the Info
MsgBox strMsg,0,strCN & " (" & strSAMAccountName & ")"
End If
Else
WScript.Echo "Error"
End If
Set objNet = Nothing
Set objUser = Nothing
Set objSD = Nothing
Set objDACL = Nothing
Set objUserLDAP = Nothing
Set objDomainNT = Nothing
‎12-14-2011 11:22 PM
Jono wrote:
Update: 14-Dec-11
My thanks to romwarrior for pointing out a problem in the code. I think I've corrected it; I added a line and edited a line to get the domain name programatically rather than having to hard code the domain name.
I've also added lines at the bottom of the code to release memory. Also, the title bar of the MsgBox now shows the User's common name along with their user ID.
‎12-13-2011 02:22 AM
Jono wrote:
Hello everyone - I've combined several VBS scripts and came up with a script that will provide user account status like this example.
‎12-14-2011 06:01 PM
romwarrior wrote:
I had to change [it] to my domain name to get it to work. Could be done using arguments too but I only have one domain so it was an easier fix.
‎05-20-2011 11:04 AM
‎05-19-2011 11:22 PM
BullGates wrote:
Description: Restore SAP Logoncmd.exe /K \\server\share$\Lansweeper\saplogon.bat {computer}
\\server\share$\Lansweeper\saplogon.batcopy \\server\share$\Lansweeper\saplogon.ini \\%1\c$\windows
‎04-29-2008 05:26 PM
‎04-25-2008 08:49 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now