[Editor’s Note: Some or all of the following FAQ text was submitted by a reader, Steven Yarnot.]
A. The following batch file uses the for command to pipe a remote file’s day, month, and year into variables that you can use to determine whether the file needs maintenance or other attention. After the VBS/LoveLetter.A virus outbreak in May 2000, organizations needed a technique to quickly verify that their virus scanner software had the latest virus definitions. The following batch file uses the for command against a list of all the nodes in a domain. This batch file tests the Norton AntiVirus file definfo.dat’s age. The file definfo.dat updates during every live update. If the file is older than 05/08/2000, which is the definition date for the Lovebug virus and its first five variants, you’d need to instruct the target machine to run the live update.
At the command prompt, enter
Netdom /domain:DomainName member > Nodelist.txt
For /f "skip=7 tokens=1,2,3,4,5,6 delims=\ " %i in (Nodelist.txt) do NAVLUCheck.CMD %l
where NAVLUCheck.CMD contains the following.
::NAVLUCheck.CMD By Steven Yarnot
::script for checking Norton AntiVirus' Live Update on remote network machines
::and reporting the results to a comma-delimited text file
::05/10/2000
::
::arguments are as follows:
::
:: NAVLUCheck RemoteTargetNodeName
::
:: Assumes your account has administrative access on the remote machine,
:: NAV is installed under the Program Files directory on the C or D drive,
:: and that the following Microsoft Windows NT Resource Kit tools are in your path:
::
:: netsvc.exe, soon.exe
::
:: If a live update hasn’t run since 05/08/2000, uses the Schedule Service
:: to schedule a live update to run 10 minutes from runtime
:: (to account for clock differences)
:: Initialize variables
SET NAVLUYR=NoNAV
SET NAVLUMO=NoNAV
SET NAVLUDAY=NoNAV
set scheduleit=no
:: Test the C drive
::
:: Theory of operation: The output from the nested dir command on the remote machine
:: passes to the for command, which then parses the output on spaces and the
:: frontslash character. If the argument passed to %n is equal to the target file (in this
:: case definfo.dat), the other arguments %i, %j, and %k are set on the month, day, and
:: year variables
::
for /f "skip=4 tokens=1,2,3,4,5,6,7,8 delims=/ " %%i in ('dir "\\%1\C$\PROGRAM FILES\COMMON FILES\SYMANTEC SHARED\VIRUSDEFS\definfo.dat" /t:w
/-c') do if "%%n"=="DEFINFO.DAT" set NAVLUMo=%%i && if "%%n"=="DEFINFO.DAT" Set NAVLUDay=%%j && if "%%n"=="DEFINFO.DAT" set navluyr=%%k
:: If not on the C drive, go test the D drive
IF "NoNAV"=="%NAVLUYR%" GOTO TESTD
::
:: If running this file from a Windows NT 4.0 rather than Windows 2000 machine, change the 2000 to 00
::
if not "2000"=="%navluyr%" goto runlu
if not "05 "=="%navlumo%" goto runlu
if "01 "=="%navluday%" goto runlu
if "02 "=="%navluday%" goto runlu
if "03 "=="%navluday%" goto runlu
if "04 "=="%navluday%" goto runlu
if "05 "=="%navluday%" goto runlu
if "06 "=="%navluday%" goto runlu
if "07 "=="%navluday%" goto runlu
:TESTD
for /f "skip=4 tokens=1,2,3,4,5,6,7,8 delims=/ " %%i in ('dir "\\%1\d$\PROGRAM FILES\COMMON FILES\SYMANTEC SHARED\VIRUSDEFS\definfo.dat" /t:w
/-c') do if "%%n"=="DEFINFO.DAT" set NAVLUMo=%%i && if "%%n"=="DEFINFO.DAT" Set NAVLUDay=%%j && if "%%n"=="DEFINFO.DAT" set navluyr=%%k
IF "NoNAV"=="%NAVLUYR%" GOTO Reportit
if not "2000"=="%navluyr%" goto runlud
if not "05 "=="%navlumo%" goto runlud
if "01 "=="%navluday%" goto runlud
if "02 "=="%navluday%" goto runlud
if "03 "=="%navluday%" goto runlud
if "04 "=="%navluday%" goto runlud
if "05 "=="%navluday%" goto runlud
if "06 "=="%navluday%" goto runlud
if "07 "=="%navluday%" goto runlud
:reportit
:: Record results in a comma-delimited table
::
:: This process is simply triage. A PC that isn’t on the network when you run the file, a
:: non-NT PC, or a PC that your account doesn’t have access to will show up as NoNAV.
::
:: The Scheduleit variable will be Yes or No. In this case, No is preferable and means that
:: you don’t need to update the target PC.
An often irreverent look at some of the week's other news, including a Vista Capable dismissal request, Zune price reductions, Morrow musings, Novell and Microsoft sitting in a tree ... two years later, Yahoo!, IE 6 on Windows Mobile, and so much more ...
Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.
You've Deployed SharePoint...Now What? This one-day free online conference delivers the technical knowledge needed to kick MOSS up a notch. In one information-packed day, independent SharePoint experts will present practical, real-world information and provide take-away, ready-to-use solutions
Don't Miss 3 Introductory PowerShell Lessons! Paul Robichaux equips you with PowerShell basics in 3 introductory lessons, each followed by live Q&A—all on your own computer! Register today!
What Would You Do If You Ran Microsoft? ITTV's 2008 inaugural video contest, "If I Ran Microsoft..." is your chance to tell it like it is. Be goofy or be serious, but don"t miss this chance to have fun, win prizes, and go viral in a major way.
Maximize Your SharePoint Investment This web seminar discusses how true bi-directional replication of SharePoint content from one server to another enables branch offices to maintain access to current SharePoint content.
john April 29, 2004