I would usually create something like this in Powershell, but the majority of the machines this will be ran on will be XP. I'm not too familiar with VB scripting since for whatever reason I skipped over it, and went straight to Powershell.

I need something that will look at a log file in a specific path. Is there a way to look in both paths in one script?

Win 7 - %PROGRAMDATA%\Sophos\AutoUpdate\Logs\alc.log

Win XP- %PROGRAMFILES%\Sophos\AuotUpdate\Logs\alc.log

I would usually run a ShellCommandTextReturn custom inventory in Kace, but this is a pretty lengthy log file. I'm looking for a particular string "Download of Sophos AutoUpdate Failed from Server http://<servername>/CIDs/<old_path>/SAVSCFXP/". This should get if any of my machines are pointing to the wrong update path. 

I then need to take that entry if it exists, and export to a txt file so that I can have Kace inventory it. I can then add it to my report.



I've got this so far. I would like one script to run on both XP and Win 7. I'm running this using "cscript script.vbs  //NoLogo > c:\temp.txt". This gives me an output as text file.  

Const ForReading = 1 


strFileName = "C:\ProgramData\Sophos\AutoUpdate\Logs\alc.log"

strFailed = "Download of Sophos AutoUpdate Failed from Server"

strSucceeded = "SophosAutoUpdate"

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(strFileName, ForReading) 

strText = objFile.ReadAll 


 IF InStr(strText, strFailed) Then

WScript.Echo "Download of Sophos AutoUpdate failed from server http://<servername>/CIDs/S009/SAVSCFXP/"

ELSEIF InStr(strText, strSucceeded) Then

WScript.Echo "Update Successful"

End IF

Answer Summary:
0 Comments   [ - ] Hide Comments


Please log in to comment

Answer this question or Comment on this question for clarity



If your Win7 is x64, you could use a bitness test (or, if not, at least take this idea and run with it).



vbscript version:


'find OS bitness and run MI check-in from appropriate folder

Dim WshShell,runStr,strProgramFiles
set WshShell = WScript.CreateObject("WScript.Shell")

OsType = wshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
If OsType = "x86" then
runStr = Chr(34) & "C:\Program Files\Dell\KACE\runkbot.exe" & Chr(34) & " 6 0"
WshShell.run runStr

elseif OsType = "AMD64" then
runStr = Chr(34) & "C:\Program Files (x86)\Dell\KACE\runkbot.exe" & Chr(34) & " 6 0"
WshShell.run runStr
end if



batch file version:


if /i %processor_architecture%==AMD64 GOTO x64
if /i %processor_architecture%==x86 GOTO x86

:: MI check-in (64-bit)
"C:\Program Files (x86)\Dell\KACE\runkbot.exe" -s 4 0

:: MI check-in (32-bit)
"C:\Program Files\Dell\KACE\runkbot.exe" -s 4 0


Answered 10/05/2012 by: jverbosk
Red Belt

  • I did do something similar. I uploaded two separate scripts as dependencies and checked OS in a batch file. Then called the correct script. It works. Just looking for something a little cleaner.
Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja