I wrote the original code myself a long time ago to work on our system. Howard noticed that it might be possible for an error to occur which might prevent a proper update.

Apparently you did not understand DJ as Jens explained to you already in the first reply to set it to a blank entry. KiXtart does this by using either '' or "" If you were not sure what Jens was talking about, you should have posted and asked more specifically what he meant.

Howard modified my code a little.
It is posted here.
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=004215;p=5

Essentially the code is:



Break ON
; uncomment the next line to step through the code
; Debug ON
$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 
  ? 'Logon script error: @error - @serror'
  ? 'assigned login script: '+$script
  If $Script <> $loginscript
    ? "Current Script for " +$user.name " is: " +$script+ " Should be: " +$loginscript
    $user.loginscript=$loginscript
     ? 'Error = '+@ERROR+' - '+@SERROR
    $user.SetInfo
     ? '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'