VB脚本必须放置在system32文件夹下吗? [英] VB Script must placed under system32 folder?
问题描述
为了监视我们的服务器,我们编写了一个批处理,该批处理运行一个vb脚本,该脚本传递了Performance Monitor的触发器.触发警报后,短信将发送给我们的员工进行通知.
这是我们的批处理文件内容:
====================================== =============
%windir%\ system32 \ wscript.exe"SendEmail.vbs" %1
============================================== =====
这是我们的vb脚本:
====================================== =============
'电子邮件正文
Dim msgBody
msgBody = WScript.Arguments.Item(0)
'通过收件人,消息和主题来调用我们的功能
MySendMail" 12345678@bulksms.net",msgBody,"; ser190 ""
Sub MySendMail(收件人,msg,主题)
sch =< http://schemas.microsoft.com/cdo/configuration/"
设置cdoConfig = CreateObject("CDO.Configuration")
使用cdoConfig.Fields
.Item(sch&"sendusing")= 2'cdoSendUsingPort
.项目(sch&"smtpserver")=本地主机"
.Item(sch&"smtpserverport")="25"
.Item(sch&"smtpauthenticate")= 1'cdoBasic
.Item(sch& sendusername) )="user"
.Item(sch&"sendpassword")="pwd"
.update
结尾为
设置cdoMessage = CreateObject("CDO. Message'')
使用cdoMessage
设置.Configuration = cdoConfig
.From =" server@company.com "
.To =收件人
.Subject =主题
.TextBody = msg
.Send
结尾为
Set cdoMessage = Nothing
设置cdoConfig = >
结束子
========================================== ========
我们将警报设置为运行批处理文件,并将警报传递到vb脚本,最后将短信发送给我们的员工.但是我发现一个奇怪的事情是,当我在任何目录下放置两个文件(例如:c:\ a \)时,性能监视器可以检测并触发事件,但无法发送短信;如果将vb脚本文件放在文件夹"C:\ Windows \ System32"下,则可以触发警报并发送短信.我们已经证明,这不应该是用户权限/脚本问题的问题.有人可以帮助我们吗?
OS:Windows Server 2003 Standard Edition Service Pack 1
弗兰克,
你怎么了在perfmon中指定批处理作业?您能详细说明一下复制步骤吗?谢谢.
Jin
As to monitor our server, we wrote a batch which runs a vb script which passes the trigger from Performance Monitor. When the alert is triggered, an sms will be send to our staff for notification.
Here is our batch file content:
==================================================
%windir%\system32\wscript.exe "SendEmail.vbs" %1
==================================================
Here is our vb script:
==================================================
'Body of email message
Dim msgBody
msgBody=WScript.Arguments.Item(0)
'Call our function with recipient, message and subject
MySendMail "12345678@bulksms.net",msgBody,"ser190"
Sub MySendMail(recipient,msg,subject)
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "localhost"
.Item(sch & "smtpserverport") = "25"
.Item(sch & "smtpauthenticate") = 1 'cdoBasic
.Item(sch & "sendusername") = "user"
.Item(sch & "sendpassword") = "pwd"
.update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "server@company.com"
.To = recipient
.Subject = subject
.TextBody = msg
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
End Sub
==================================================
We set the alert as running the batch file and the alert passed, to the vb script and finally send a sms to our staff. But I found a weired thing is, when I place two files under any of the directory (For example: c:\a\), the performance monitor can detect and trigger the event, but cannot send the sms out; if we place the vb script file under the folder 'C:\Windows\System32', the alert can be triggered and the sms can be sent. We have vertified that it should not be the problem of the premission of the user/script issue. Could anyone help us?
OS: Windows Server 2003 Standard Edition with Service Pack 1
Hi Frank,
How did you specify the batch job in the perfmon? Can you detail the repro steps ?Thanks.
Jin
这篇关于VB脚本必须放置在system32文件夹下吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!