(imported topic written by SystemAdmin)
Hello everyone,
So, I’m trying to run some action script in a fixlet along with a VBScript at the end:
appendfile {names of folders whose (creation time of it > (now - 4 * day)) of folder “D:\APPS\BigFix Enterprise\BES Server\BESReportsData\ArchiveData\9”}
delete “D:\APPS\BigFix Enterprise\BES Server\BESReportsData\ArchiveData\9\latestfolder.txt”
move __appendfile “D:\APPS\BigFix Enterprise\BES Server\BESReportsData\ArchiveData\9\latestfolder.txt”
wait cmd.exe /C “cd D: & cd D:\APPS\Bigfix Enterprise\BES Server\BESReportsData\ArchiveData\ & start Unmanaged Assets NO EXCEL VER.vbs”
My problem is that when I run the fixlet, the fourth line of action script stays in a ‘Running’ state much longer than it should…it actually never leaves the ‘Running’ state. I have a feeling that the script is causing the issue however, when I change the last line of action script (the one with the VBScript) I can get the action to a ‘Completed’ state but the VBScript does not seem to execute. To do this I change the action script to:
wait cscript.exe “D:\APPS\Bigfix Enterprise\BES Server\BESReportsData\ArchiveData\Unmanaged Assets NO EXCEL VER.vbs”
The VBScript is shown below:
Dim oFSO, fReport, fReport1, latest, fread, comma, length, midstring, diff
Set oFSO = CreateObject(“Scripting.FileSystemObject”)
set fReport1 = oFSo.OpenTextFile("\server\share\9\latestfolder.txt",1,true)
latest = fReport1.Readline
strPathLoggood = “D:\APPS\BigFix Enterprise\BES Installers\BESClientDeploy\UnmanagedAssetsReportGood.txt”
strPathLogbad = “\server\share\9\UnmanagedAssetsReportBad.txt”
Set fReport = oFSO.CreateTextFile(strPathLogGood, True)
Set fReport1 = oFSO.CreateTextFile(strPathLogBad, True)
set fread = oFSO.OpenTextFile("\server\share\9"& latest &"\archive.csv",1,true)
Dim company, location, genre, hostname, mac, macfilter
latest = fread.Readline
do while fread.atendofstream true
latest = fread.readline
for i = 0 to 3
length = Len(latest)
comma = inStr(latest, “,”)
diff = length - comma
midstring = Mid(latest, comma+1, diff)
latest = midstring
next
company = Mid(latest, 2, 1)
location = Mid(latest, 3, 3)
genre = Mid(latest, 6, 2)
mac = Mid(latest, 8, 6)
macfilter = Mid(latest, 14, 1)
hostname = Mid(latest, 2, 12)
If company = “h” Then
if location = “apg” OR location = “cap” OR location = “fra” OR location = “jun” OR location = “kan” OR location = “pdc” OR location = “pil” OR location = “tom” OR location = “yrk” OR location = “car” OR location = “chi” OR location = “pla” OR location = “ezu” OR location = “emo” OR location = “eba” OR location = “ecr” OR location = “ear” OR location = “eri” OR location = “eox” OR location = “epr” OR location = “eca” OR location = “eru” OR location = “edu” OR location = “aus” OR location = “bra” OR location = “cna” OR location = “ind” OR location = “mia” OR location = “mic” OR location = “mus” OR location = “sin” OR location = “jsh” OR location = “jak” OR location = “jka” then
if genre = “lt” OR genre = “ws” OR genre = “sf” then
if macfilter = “.” then
fReport.write hostname & vbnewline
Else
fReport1.write latest & vbnewline
End If
Else
fReport1.write latest & vbnewline
End If
Else
fReport1.write latest & vbnewline
End If
Else
fReport1.write latest & vbnewline
End If
loop
dim oFile, oFSO1, hostnamelog, PorF, result
Set WshShell = WScript.CreateObject(“WScript.Shell”)
result = WshShell.run(“cmd /C D: & cd D:\APPS\Bigfix Enterprise\BES Installers\BESClientDeploy\ & start BESClientDeploy.exe /useComputerNameList UnmanagedAssetsReportGood.txt /automatic /username username /password password”,true)
set oFSo = CreateObject(“Scripting.FileSystemObject”)
Set oFSO1 = CreateObject(“Scripting.FileSystemObject”)
Set fReport = oFSo1.OpenTextFile("\server\share\9\UnmanagedAssets.txt",8, true)
fReport.WriteLine “Hostname” & vbTab & “Time” & vbTab & “Agent Version” & vbTab & “Pass/Fail”
set oFile = CreateObject(“Scripting.FileSystemObject”)
set fReport1 = oFSo.OpenTextFile(“D:\APPS\BigFix Enterprise\BES Installers\BESClientDeploy\UnmanagedAssetsReportGood.txt”,1,true)
Do while fReport1.AtEndOfStream True
hostnamelog = fReport1.Readline
InstalledVersion = WshShell.RegRead(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{E387A719-DD69-41CC-A876-A1EEB55E03D9}\DisplayVersion”)
if(InstalledVersion = “” or result 0) then
PorF = “fail”
else
PorF = “pass”
end if
fReport.WriteLine hostname & vbTab & Now() & vbTab & InstalledVersion & vbTab & PorF
Loop
Thanks in advance to everyone who can shed light on the topic.
Cheers,
Ilithis