I have a batch file that starts a kixscript. Without getting into too many details, I need this script to run continously as it updates a number of files that used for load balancing 3 antivirus servers as people log onto the network. The loop command doesn't work...script crashes and errors out. I tried running a scheduled task on one of the antivirus servers and had it run the script every minute, but its not working. I don't think it likes running batch files across network shares.
Here's the kixscript:
Everything commented out was used for testing but for one reason or another was turned off. HELP!
Here's the kixscript:
Code:
;**** NAV_Count.kix ****
;**** Created by Alan Jones on or around June 2005 ****
;**** Administrator Rights to NAV servers required!!! ****
;****************************************************************
;**** NAV_Count.kix is used to update the SAV "count files". ****
;**** When a user logs onto the domain, the logon script ****
;**** reads the count files to determine which server to ****
;**** use. This script must be run by an administrator, or ****
;**** as a service (scheduled task) run by an administrator. ****
;****************************************************************
;**** Reads client counts from the SAV servers ****
$Nav1clients = Val(ReadValue("\\fsnvzrnav1\HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\AddressCache\FSNVZRNAV1", "NumberOfClients"))
$Nav2clients = Val(ReadValue("\\fsnvzrnav1\HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\AddressCache\FSNVZRNAV2", "NumberOfClients"))
$NavCclients = Val(ReadValue("\\fsnvzrnav1\HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\AddressCache\FSNVZRWNAVC", "NumberOfClients"))
$NavMedclients = Val(ReadValue("\\fsnvzrmnav\HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\AddressCache\fsnvzrmnav", "NumberOfClients"))
;**** Sets variables for "Count Files" ****
$Nav1count_File = "\\ffnvzr02\netlogon\nav1count.txt"
$Nav2count_File = "\\ffnvzr02\netlogon\nav2count.txt"
$NavCcount_File = "\\ffnvzr02\netlogon\navCcount.txt"
;**** Turned Off - Begins permanent loop ****
;while $Nav1count_File = "\\ffnvzr02\netlogon\nav1count.txt"
;**** Uncomment to make it display the counts ****
MessageBox ("NAV 1 count: " + $Nav1clients + Chr(10) + "NAV 2 count: " + $Nav2clients + Chr(10) + "NAV C count: " + $NavCclients + Chr(10) + Chr(10) + "NAV Med count: " + $NavMedclients,"NAV Count")
;**** Writes count from NAV1 to NAV1 Count file ****
Del $Nav1count_File
Open(1,$Nav1count_File,1)
Close(1)
IF Open(1,$Nav1count_File,4) = 0
$w1 = WriteLine(1,$Nav1clients)
MessageBox ("Write worked: " + $Nav1clients,"NAV1 Count")
ENDIF
Close(1)
;**** Writes count from NAV2 to NAV2 Count file ****
Del $Nav2count_File
Open(2,$Nav2count_File,1)
Close(2)
IF Open(2,$Nav2count_File,4) = 0
$w2 = WriteLine(2,$Nav2clients)
MessageBox ("Write worked: " + $Nav2clients,"NAV2 Count")
ENDIF
Close(2)
;**** Writes count from NAVC to NAVC Count file ****
Del $NavCcount_File
Open(3,$NavCcount_File,1)
Close(3)
IF Open(3,$NavCcount_File,4) = 0
$w3 = WriteLine(3,$NavCclients)
MessageBox ("Write worked: " + $NavCclients,"NAVC Count")
ENDIF
Close(3)
;**** Sleeps for 15 seconds then checks counts again - only needed for looping ****
; Sleep 5
;loop
Everything commented out was used for testing but for one reason or another was turned off. HELP!