emc65 Posted January 2, 2007 Posted January 2, 2007 (edited) I am getting an error when running my VB script. The error states:Line: 7Char: 1Error: 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 shellstrComputerName="ETLT1"set shell = createobject("wscript.shell")set exec = shell.exec("cmd /c net start | find /C ""Inform""")temp = exec.stdout.readline'msgbox tempif temp <> 2 thenDim iMsgSet iMsg = CreateObject("CDO.Message")Dim iConfSet iConf = CreateObject("CDO.Configuration")Dim FldsSet Flds = iConf.FieldsConst 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 .UpdateEnd WithWith 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" .SendEnd WithEnd If Edited January 2, 2007 by emc65
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now