The information in this article applies to: Prism Suite, Prism Deploy
It would be useful to have a configuration group that checks for the existence of a file and also checks its modified date. For example, this would be one way of checking if a certain anti-virus .dat file was up to date. It is possible with all versions of Prism Deploy to check for the existence of a file in a user-defined config group, but there isn’t currently a user-defined parameter to check for the last modified date of a file.
NBT Support has come up with a workaround using a VB script. The process is to create and run a VB script that captures the timestamp of the file and writes that information to an INI file. You can then use the INI file in your ruleset to see modified date is what you expect. In our example below, we’re checking to see if the Symantec file called savrt.dat is up to date.
First, use notepad to create a .vbs script with the lines shown below. On line 1, specify the path to the file you're interested in. On line 4, specify the path and file name for the INI file that will be created.
Const filename = "C:\Program Files\Symantec AntiVirus\savrt.dat"
Dim objFSO, objFile, objINIFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(filename)
Set objINIFile = objFSO.CreateTextFile("C:\LastModified.ini", 2)
objINIFile.WriteLine "[Date Modified]"
objINIFile.WriteLine "Date Modified=" & objFile.DateLastModified
Run the vbs script as a Command Task in your Channel, then create a config group based on the entry in the INI file created by the script. Here's our example:
EXISTS <File> "C:\Program Files\Symantec AntiVirus\savrt.dat" AND <INI Value> "C:\LastModified.ini\\Date Modified\\Date Modified" MATCHES "1/6/2006*"
1) If the file’s modified date changes, the LastModified.ini will not automatically reflect that change. The VB script would have to be run again, perhaps as a recurring task. We recommend configuring the Command Task to recur at user logon.
2) Windows Script Host is preinstalled on Windows 98, Windows 2000 and above. It is available separately for Windows 95 and Windows NT 4.