troubleshooting Question

VBS script output

Avatar of David Knutson
David Knutson asked on
PHPVB Script
8 Comments1 Solution216 ViewsLast Modified:
I've created a vbs script this is to run FCIV and pipe all output to a log file.

I can run this from the command line and it works -

fciv.exe -v -xml NCRTestFiles.xml > output.log

However, when I run via the script, no file is created.  Where did I go wrong?

Set wshShell = WScript.CreateObject( "WScript.Shell" )
Const DeleteReadOnly = True 
Set objFSO = CreateObject("Scripting.FileSystemObject") 

dim strDate
dim logName
dim strCommand

'--- Get Computer name and current date
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
strFileDate = DatePart("yyyy",Now)  & Right("0" & DatePart("m",Now), 2)  & Right("0" & DatePart("d", Now), 2) 
logName = strComputerName & "_" & strFileDate & ".txt"

'--- Delete existing file
'wshShell.Run("%comspec% /c " & "DEL " & logName )

'--- Run FCIV command
strCommand = "fciv.exe -v -xml NCRTestFiles.xml >> " & logName

strErrorCode = wshShell.Run(strCommand,,True)

Select Case strErrorCode
     Case 0
        wshShell.LogEvent 0, "File Integrity App:  Test Passed."
     Case Else
        wshShell.LogEvent 1, "File Integrity App:  Test Failed."
end Select
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros