Jump to content

ERROR Running VB Script


Recommended Posts

I am getting an error when running my VB script. The error states:

Line: 7

Char: 1

Error: Type mismatch: 'temp'

I have this vb script running on box but not another. The OS is WindowsServer 2003.

Here is the vb code:

=============================

Dim shell

strComputerName="ETLT1"

set shell = createobject("wscript.shell")

set exec = shell.exec("cmd /c net start | find /C ""Inform""")

temp = exec.stdout.readline

'msgbox temp

if temp <> 2 then

Dim iMsg

Set iMsg = CreateObject("CDO.Message")

Dim iConf

Set iConf = CreateObject("CDO.Configuration")

Dim Flds

Set Flds = iConf.Fields

Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"

Const cdoSendUsingPort = "25"

Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"

Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"

Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"

Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"

Const cdoBasic = "1"

Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"

Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"

With Flds

' assume constants are defined within script file

.Item(cdoSendUsingMethod) = 2 ' cdoSendUsingPort

.Item(cdoSMTPServer) = "NCHWT"

.Item(cdoSMTPConnectionTimeout) = 100 ' quick timeout

.Item(cdoSMTPAuthenticate) = cdoBasics

.Item(cdoSendUserName) = "Inform"

.Item(cdoSendPassword) = "PtPPPM"

'.Item(cdoURLProxyServer) = "server:80"

'.Item(cdoURLProxyBypass) = "<local>"

'.Item(cdoURLGetLatestVersion) = True

.Update

End With

With iMsg

Set .Configuration = iConf

.To = "developers@abc.com"

.From = "developers@abc.com"

.Subject = "Action Required - " & strComputerName & " Informatica Service is not running"

'.CreateMHTMLBody "http://example.com"

.TextBody = "Informatica Service is not running on " & strComputerName & "..."

'.AddAttachment "C:\files\mybook.doc"

.Send

End With

End If

Edited by emc65
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...