I need professional help!!
- From: PBelica@xxxxxxxxx
- Date: 16 May 2006 07:31:17 -0700
Hello,
First of all, let me state that I am not a coder, so if the answer
could be in layman's terms, that would be much more helpful.
I have been working on this little project that basically should
grab two words from the subject of an email (first word = command to be
processed, second word = servername), pass those as variables to a
batch file, have the batch file do it's magic, then send a return email
with the results of the commands. I have been working on this for a
week now, and can't seem to figure this out. Any and all help will be
GREATLY appreciated.
Here's what I have so far:
Ex. An email comes in, with the subject "IISRESET <servername>"
Then, an Outlook rule will recognize the word IISRESET and call this
vbs file:
--Outlook.vbs--
Set oSession = CreateObject("MAPI.Session")
oSession.Logon , , False, False, 0
Set oFolder = oSession.Inbox
Set oMessages = oFolder.Messages
Set Msg = oMessages.GetFirst
While Not Msg Is Nothing
If Msg.Unread = True Then
strSubject = Msg.Subject
arr = Split(myItem.Subject, " ")
strActionToTake = arr(0)
strServerToActOn = arr(1)
end If
Set Msg = oMessages.GetNext
Option Explicit
Const = Command
Command = "J:\IISResetBatchFiles\iisreset_test.bat"
Dim strPath
strPath = arr(0)
Dim Server
Server = arr(1)
Dim strRUN
strRUN = "%comspec% /c " & Command & " " & strPath & " " & Server
Dim objWSS
Set objWSS = CreateObject("WScript.Shell")
objWSS.Run strRUN, 0, True
Set objWSS = Nothing
Set WSW.run = CreateObject("WScript.Shell")
wsw.Run "J:\IISResetBatchFiles\iisreset_test.bat"
oSession.Logoff
Set oSession = Nothing
Wend
Now, the two variables mentioned above should be passed to the batch
file below:
--IISRESET_TEST.bat--
set command = %1
set server = %2
psexec.exe %1 -u ***\******* -p *********
echo "IISRESET" > "C:\iisreset.txt"
psservice %2 query iisadmin >> "C:\iisreset.txt"
psservice %2 query w3svc >> "C:\iisreset.txt"
psservice %2 query smtpsvc >> "C:\iisreset.txt"
bmail -s blah.blah.blah.com -t username@xxxxxxxxxxx -f
username@xxxxxxxxxxx -h -a "Internet Information Services Reset Output"
-m c:\iisreset.txt
This batch file should perform the first variable as a command (in this
case, IISRESET) and the second variable being the server. Once done,
bmail will send the results back to myself. I have this working
without the variables, but that means I have to create a seperate batch
file for each server. We have hundreds of servers, so this is not a
preferred way.
Please help!! Thank you.
.
- Prev by Date: Script Certificate Installation?
- Next by Date: best method for pausing before next step in VBScript file
- Previous by thread: Script Certificate Installation?
- Next by thread: best method for pausing before next step in VBScript file
- Index(es):
Relevant Pages
|