Hello, chaps!
OK, I need to run a UNIX command using RSH and grab the output to a file for further manipulation within my vbscript. Specifically the command is
I've got the right syntax from the command prompt but can't seem to get it to work within the vbscript:
Have also tried it as
I am using Option Explicit, so typos have pretty much been disregarded as the cause, and strTemp has been correctly populated with [tt]strTemp = objWSHShell.ExpandEnvironmentStrings("%TEMP%")[/tt] so all the paths, including for strSAN_Report and strSAN_IP seem to be correct too.
Here's the whole sub-routine:
What am I doing wrong?
JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
OK, I need to run a UNIX command using RSH and grab the output to a file for further manipulation within my vbscript. Specifically the command is
Code:
rsh 172.16.13.200 df -h >%temp%\san.out
I've got the right syntax from the command prompt but can't seem to get it to work within the vbscript:
Code:
ExecCMD = "rsh " & strSAN_IP & " df -h | findstr /V /c:"".snapshot"">" & strSAN_Report '%temp%\san.out"
Set objExec = objWSHShell.Exec(ExecCMD)"
Have also tried it as
Code:
ExecCMD = "rsh " & strSAN_IP & " df -h | findstr /V /c:"".snapshot"">%temp%\san.out"
Set objExec = objWSHShell.Exec(ExecCMD)"
Here's the whole sub-routine:
Code:
Sub RunCheckSAN()
strTitle = "SAN Storage"
wscript.echo strBorder
strEcho = "Checking SAN Storage" ' & vbCrLf
Call NextHeader(strTitle,strEcho)
Dim strSAN
Dim strSAN_IP
Dim strSAN_Name
Dim arrSAN
Dim strSAN_Report
strSan_Report = strTemp & "\san.out"
wscript.echo " strSan_Report = " & strSan_Report
Dim ExecCMD
For Each strSAN in arrSANs
if objFSO.FileExists(strSan_Report) then
wscript.echo " Deleting " & strSan_Report & "..."
objFSO.DeleteFile strSan_Report
end if
arrSAN = split(strSAN,",")
strSAN_IP = arrSAN(0)
strSAN_Name = arrSAN(1)
wscript.echo " strSAN_IP = '" & strSAN_IP & "'"
ExecCMD = "rsh " & strSAN_IP & " df -h | findstr /V /c:"".snapshot"">" & strSAN_Report '%temp%\san.out"
Set objExec = objWSHShell.Exec(ExecCMD)
'wscript.sleep 2000
if objFSO.FileExists(strSan_Report) then
Wscript.echo " Found " & strSan_Report & "...analysis for " & strSAN_Name & " will commence here..."
Set objSAN_Report = objFSO.OpenTextFile(strSan_Report, ForReading)
else
Wscript.echo " Couldn't find " & strSan_Report & "! Please check " & strSAN_Name & " storage manually!"
end if
Next
End Sub
JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]