Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
The error occures on Vista PC's that are not a part of the domain (I do not have XP to test). The script DOES work if the PC is a member of the domain both Vista and XP. I am using LDAP so being a member of the domain should not matter. I am connecting to the network with VPN and runnning the script.
The error occurs on line 40:
objUser = GetObject(UserPath) ;LDAP://ServerName/CN=Davis\,Dave,OU=DomainAdmins,OU=PC Users,DC=intranet,DC=company,DC=orgAny ideas would be greatly appreciated!
Script follows:
; Set internal debug flag iDebug = 1 ; ; Get AD path for userID AddExtender("WWADS44I.DLL") UserID = 'ddavis' ; Set credentials dsSetCredent("ldapuser", "LDAPPASSWORD") ServerPath="LDAP://ServerName/DC=intranet,DC=company,DC=org" UserPath=dsFindPath(ServerPath, "(&(objectCategory=person)(sAMAccountName=%UserID%))") ; ; Check if user exists If dsIsObject(UserPath) If iDebug == 1 Message("User Exists",UserPath) EndIf Else If iDebug == 1 Message("User Does NOT exist",UserPath) EndIf Exit EndIf ; ; Get and display password expiration information ADS_UF_DONT_EXPIRE_PASSWD = 65536 E_ADS_PROPERTY_NOT_FOUND = 2147504141 ONE_HUNDRED_NANOSECOND = .000000100 SECONDS_IN_DAY = 86400 MAKE_HIGH = 2.0**32 objUser = GetObject(UserPath) intUserAccountControl = objUser.Get("userAccountControl") If intUserAccountControl & ADS_UF_DONT_EXPIRE_PASSWD If iDebug == 1 Message("Password Age", "The password does not expire") EndIf Exit Else dtmValue = objUser.PasswordLastChanged If dtmValue == "" If iDebug == 1 Message("Password Age", "The password has never been set") EndIf Exit Else intTimeInterval = TimeDiffDays(TimeYmdHms(), dtmValue) EndIf objDomain = GetObject("LDAP://DC=intranet,DC=company,DC=org") objMaxPwdAge = objDomain.Get("maxPwdAge") If objMaxPwdAge.LowPart == 0 If iDebug == 1 Message("Password Age","The Maximum Password Age is set to 0 in the domain. Therefore, the password does not expire") EndIf Exit Else dblMaxPwdHigh = objMaxPwdAge.HighPart * MAKE_HIGH lowpart = ((objMaxPwdAge.LowPart >> 1) & 2147483647 ) * 2.0 dblMaxPwdNano = dblMaxPwdHigh + lowpart dblMaxPwdSecs = dblMaxPwdNano * ONE_HUNDRED_NANOSECOND dblMaxPwdDays = Int(dblMaxPwdSecs / -SECONDS_IN_DAY) If iDebug == 1 Message("Password Age","Maximum password age is %dblMaxPwdDays% days") EndIf If intTimeInterval >= dblMaxPwdDays If iDebug == 1 Message("Password Age","The password has expired") EndIf Else ExpireDate = TimeAdd(dtmValue, "0000:00:%dblMaxPwdDays%:00:00:00") DaysFromNow = TimeDiffDays(ExpireDate, TimeYmdHms()) If iDebug == 1 Message("Password Age","The password will expire on %ExpireDate% %@crlf%or %DaysFromNow% days from today") EndIf If DaysFromNow < 15 Message1 = "Your LMHS VPN password will expire in %DaysFromNow% Days" GoSub DspMsg EndIf EndIf EndIf EndIf Exit :DspMsg MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`Password Expiration` MyDialogX=114 MyDialogY=208 MyDialogWidth=242 MyDialogHeight=113 MyDialogNumControls=004 MyDialogProcedure=`DEFAULT` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`071,083,036,012,PUSHBUTTON,DEFAULT,"Yes",1,1,0,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`149,083,036,012,PUSHBUTTON,DEFAULT,"No",0,2,32,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`067,057,120,012,STATICTEXT,DEFAULT,"Would you like to change your password now?",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog004=`067,031,124,012,VARYTEXT,Message1,"Message1",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") If ButtonPushed == 1 ShellExecute("http://intranet1/pschng/ChngPwF.asp","","",@NORMAL,"OPEN") EndIf Return
oNamesp = GetObject("LDAP:") oUserObject1 = oNamesp.OpenDSObject("LDAP://server/CN=Backwards\, Bob,OU=whatever,DC=domain,DC=com", "domain\UserId","*topsecret*", 1)
Script follows:
; ; Get AD path for userID AddExtender("WWADS44I.DLL") UserID = 'ddavis' ; Set credentials dsSetCredent("Domain\ldapuser", "LDAPPASSWORD") ServerPath="LDAP://ServerName/DC=intranet,DC=company,DC=org" UserPath=dsFindPath(ServerPath, "(&(objectCategory=person)(sAMAccountName=%UserID%))") ; ; Check if user exists If dsIsObject(UserPath) If iDebug == 1 Message("User Exists",UserPath) EndIf Else If iDebug == 1 Message("User Does NOT exist",UserPath) EndIf Exit EndIf ; ; Get and display password expiration information ADS_UF_DONT_EXPIRE_PASSWD = 65536 E_ADS_PROPERTY_NOT_FOUND = 2147504141 ONE_HUNDRED_NANOSECOND = .000000100 SECONDS_IN_DAY = 86400 MAKE_HIGH = 2.0**32 intUserAccountControl = dsGetProperty(UserPath, "userAccountControl") If intUserAccountControl & ADS_UF_DONT_EXPIRE_PASSWD If iDebug == 1 Message("Password Age", "The password does not expire") EndIf Exit Else objNs = ObjectGet("LDAP:") objUser = objNs.OpenDSObject(UserPath, "Domain\ldapuser", "LDAPPASSWORD", 1) dtmValue = objUser.PasswordLastChanged If dtmValue == "" If iDebug == 1 Message("Password Age", "The password has never been set") EndIf Exit Else intTimeInterval = TimeDiffDays(TimeYmdHms(), dtmValue) EndIf objDomain = objNs.OpenDSObject("LDAP://ServerName/DC=intranet,DC=company,DC=org", "Domain\ldapuser", "LDAPPASSWORD", 1) objMaxPwdAge = objDomain.MaxPwdAge If objMaxPwdAge.LowPart == 0 If iDebug == 1 Message("Password Age","The Maximum Password Age is set to 0 in the domain. Therefore, the password does not expire") EndIf Exit Else dblMaxPwdHigh = objMaxPwdAge.HighPart * MAKE_HIGH lowpart = ((objMaxPwdAge.LowPart >> 1) & 2147483647 ) * 2.0 dblMaxPwdNano = dblMaxPwdHigh + lowpart dblMaxPwdSecs = dblMaxPwdNano * ONE_HUNDRED_NANOSECOND dblMaxPwdDays = Int(dblMaxPwdSecs / -SECONDS_IN_DAY) If iDebug == 1 Message("Password Age","Maximum password age is %dblMaxPwdDays% days") EndIf If intTimeInterval >= dblMaxPwdDays If iDebug == 1 Message("Password Age","The password has expired") EndIf Else ExpireDate = TimeAdd(dtmValue, "0000:00:%dblMaxPwdDays%:00:00:00") DaysFromNow = TimeDiffDays(ExpireDate, TimeYmdHms()) If iDebug == 1 Message("Password Age","The password will expire on %ExpireDate% %@crlf%or %DaysFromNow% days from today") EndIf If DaysFromNow < 15 Message1 = "Your LMHS VPN password will expire in %DaysFromNow% Days" GoSub DspMsg EndIf EndIf EndIf EndIf Exit :DspMsg MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`Password Expiration` MyDialogX=114 MyDialogY=208 MyDialogWidth=242 MyDialogHeight=113 MyDialogNumControls=004 MyDialogProcedure=`DEFAULT` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`071,083,036,012,PUSHBUTTON,DEFAULT,"Yes",1,1,0,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`149,083,036,012,PUSHBUTTON,DEFAULT,"No",0,2,32,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`067,057,120,012,STATICTEXT,DEFAULT,"Would you like to change your password now?",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog004=`067,031,124,012,VARYTEXT,Message1,"Message1",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") If ButtonPushed == 1 ShellExecute("http://intranet1/pschng/ChngPwF.asp","","",@NORMAL,"OPEN") EndIf Return
Article ID: W18044
Filename: 1129 OleInitiate Initiate Failed Using an LDAP Path.txt
File Created: 2008:11:25:12:03:18
Last Updated: 2008:11:25:12:03:18