GPO login script error
i have script starts vbs file when user logs in on laptop. script in c:\windows\system32 (copied thru gpo).
when user logs in when domain not available error occurs (even when password not changed):
windows scripting host domain not available.
this script:
'a vbs script that goes in to your gpo that displays a popup window telling the user their password expires in # days and that
'the user must click ok to dismiss. it goes in the gpo - user config - policies - admin templates - system - logon - run these
'programs at user logon. you will also need to add the folder location to ie trusted sites to avoid having a popup asking if
'it should run the script.
'pwexpchk.vbs
'========================================
' first, get the domain policy.
'========================================
dim odomain
dim ouser
dim maxpwdage
dim numdays
dim warningdays
warningdays = 15
set logininfo = createobject("adsysteminfo")
set objuser = getobject("ldap://" & logininfo.username & "")
strdomaindn = ucase(logininfo.domaindnsname)
struserdn = logininfo.username
set odomain = getobject("ldap://" & strdomaindn)
set maxpwdage = odomain.get("maxpwdage")
'========================================
' calculate the number of days that are
' held in this value.
'========================================
numdays = ccur((maxpwdage.highpart * 2 ^ 32) + _
maxpwdage.lowpart) / ccur(-864000000000)
'wscript.echo "maximum password age: " & numdays
'========================================
' determine the last time that the user
' changed his or her password.
'========================================
set ouser = getobject("ldap://" & struserdn)
'========================================
' add the number of days to the last time
' the password was set.
'========================================
whenpasswordexpires = dateadd("d", numdays, ouser.passwordlastchanged)
fromdate = date
daysleft = datediff("d",fromdate,whenpasswordexpires)
'wscript.echo "password last changed: " & ouser.passwordlastchanged
if (daysleft < warningdays) and (daysleft > -1) then
msgbox "password expires " & daysleft & " dagen" & " op " & whenpasswordexpires & chr(13) & chr(13) & "let op!" & chr(13) &
end if
the error in line according scripting host:
set objuser = getobject("ldap://" & logininfo.username & "")
in script there line says folder location of script must added trusted websites, cannot fill c:\windows\system32 in there....
freddie
no not evil, if know doing: or bad gpos?
wenn meine antwort hilfreich war, freue ich mich über eine bewertung! if answer helpful, i'm glad rating!
Windows Server > Group Policy
Comments
Post a Comment