You need to trap the fact (error) that the logon script has never been assigned.

Something like this should help the situation.
code:
Break ON
$rc=SETOPTION('WrapAtEOL','ON')

; uncomment the next line to step through the code
; Debug ON
; Example of LDAP call. GetObject("LDAP://ou=Users,ou=YourBusinessUnit,dc=YourCompany,dc=com")
; You need to know your LDAP connection. You can maybe find it by checking the propery details on the OU for your users.
$target = GetObject("LDAP://OU=Test,OU=Information Systems,OU=AdminBldg,DC=sussexcounty,DC=net")
? 'Error = '+@ERROR+' - '+@SERROR
$loginscript="logon.bat"
For Each $user in $target
? 'checking user: '+$user.name
$script = $user.loginscript
$loginscripterror = @error
? "Logon script error: @error - @serror"
? 'assigned login script: '+$script
If $Script <> $loginscript or $loginscripterror
? "Current Script for " +$user.name " is: " +$script+ " Should be: " +$loginscript
$user.loginscript=$loginscript ; Remove the semi-colon at the front of this line to enable actually resetting the logon bat.
? 'Error = '+@ERROR+' - '+@SERROR
$user.SetInfo ; Remove the semi-colon at the front of this line to enable actually resetting the logon bat.
? 'Error = '+@ERROR+' - '+@SERROR
? "Changed current Script for " +$user.name " to: " +$user.loginscript
EndIf
Next
? 'If no user was displayed, then no user was retrieved from the OU'

{edit} added quote on line 17

[ 04. March 2003, 21:23: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/