I have a vbs script that runs in a fixlet that replaces a IP string in a file (that is downloaded and extracted via prefetch) to a different IP. When I run the command from start > run or CMD, it works fine, but when the fixlet runs the command, the vbs doesn’t update the file, yet it returns an exit code of “0”.
Test Fixlet:
action uses wow64 redirection false
prefetch 4500f4755a32d02f2e008905e73576a9ca5137e6 sha1:4500f4755a32d02f2e008905e73576a9ca5137e6 size:21219789 http://localhost:52311/Uploads/4500f4755a32d02f2e008905e73576a9ca5137e6/blah.tmp sha256:d96d20bcb105993241f9b38f308dbe803577d051687749559c7a5c8cfd10482d
extract 4500f4755a32d02f2e008905e73576a9ca5137e6
//update config files
delete __createfile
delete replace.vbs
createfile until _EOF
'Usage (WScript):
'ReplaceText FileName OldText NewText [/I]
' /I (optional) - Text matching is not case sensitive
Set oArgs = WScript.Arguments
intCaseSensitive = 0
For i = 3 to oArgs.Count-1
If UCase(oArgs(i)) = "/I" Then intCaseSensitive = 1
Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FileExists(oArgs(0)) Then
WScript.Echo "Specified file does not exist."
Else
Set oFile = oFSO.OpenTextFile(oArgs(0), 1)
strText = oFile.ReadAll
oFile.Close
strText = Replace(strText, oArgs(1), oArgs(2), 1, -1, intCaseSensitive)
Set oFile = oFSO.OpenTextFile(oArgs(0), 2)
oFile.WriteLine strText
oFile.Close
End If
_EOF
copy __createfile replace.vbs
parameter "StartTime"="{now}"
pause while { (now-time(parameter "StartTime") < 5*second)}
waithidden cmd.exe /c cscript.exe //noLogo "{pathname of client folder of current site & "\replace.vbs"}" "{pathname of client folder of current site & "\__Download\agent_config.json"}" 5.6.7.8 1.2.3.4
When it runs, this is the log file results:
Wow64 redirection disabled. action uses wow64 redirection false (action:2344468)
Command succeeded (Prefetch download manager collected file) prefetch 4500f4755a32d02f2e008905e73576a9ca5137e6 sha1:4500f4755a32d02f2e008905e73576a9ca5137e6 size:21219789 http://localhost:52311/Uploads/4500f4755a32d02f2e008905e73576a9ca5137e6/blah.tmp sha256:d96d20bcb105993241f9b38f308dbe803577d051687749559c7a5c8cfd10482d (action:2344468)
At 09:05:34 -0500 - actionsite (http://:52311/cgi-bin/bfgather.exe/actionsite)
Command succeeded extract 4500f4755a32d02f2e008905e73576a9ca5137e6 (action:2344468)
At 09:05:35 -0500 - actionsite (http://:52311/cgi-bin/bfgather.exe/actionsite)
Command succeeded delete __createfile (action:2344468)
Command succeeded delete No 'C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\replace.vbs' exists to delete, no failure reported (action:2344468)
Command succeeded createfile until (action:2344468)
Command succeeded copy __createfile replace.vbs (action:2344468)
Command succeeded parameter "StartTime"="Mon, 04 Jun 2018 09:05:35 -0500" (action:2344468)
Paused pause while True (action:2344468)
At 09:05:40 -0500 - actionsite (http://:52311/cgi-bin/bfgather.exe/actionsite)
Not paused pause while False (action:2344468)
Command started - waithidden cmd.exe /c cscript.exe //noLogo "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\replace.vbs" "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\__Download\agent_config.json" 5.6.7.8 1.2.3.4 (action:2344468)
Command succeeded (Exit Code=0) waithidden cmd.exe /c cscript.exe //noLogo "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\replace.vbs" "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\__Download\agent_config.json" 5.6.7.8 1.2.3.4 (action:2344468)
I’ve tried adding “wow64 redirection false” and can’t think of anything else. Any suggestions?