Configure automatic script in windows server

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Configure automatic script in windows server
# 15  
Old 04-03-2012
Dear Expert,

Thanks for your efford on this Issue,I'm very much happy to find valuble soulutions.

I tried the below given code but i'm not reaciving email with this.

Also tried option of check option, its showing the blank window.

PHP Code:
msgbox Found
C
:\Documents and Settings\Fareedm\Desktop>Blat -install 192.168.100.204 3 FROMME
 25
SMTP server set to 192.168.100.204 on port 25 with user 3
retry FROMME time(s)
C:\Documents and Settings\Fareedm\Desktop>cscript.exe check.vbs
Microsoft 
(RWindows Script Host Version 5.7
Copyright 
(CMicrosoft CorporationAll rights reserved.

C:\Documents and Settings\Fareedm\Desktop
Code Writtend by me:-
Code:
 
Issue is :- Though the process is running,It is sending the emails.please suggest I beleive some thing wrong in if condition.
tasklist /FI "IMAGENAME eq notepad.exe" /NH
if "%ERRORLEVEL%"=="0" (
mailsend -d xxxx.local -smtp 192.16x.xx.xx -t fareedm@xxxx.xx -c fareedm@xxxx.xx -f oracle@123.ae -sub "Al" <results.txt   
) else (
 echo Found! logged files into results.txt
)

Thanks Alot,
Mohammed Fareed
# 16  
Old 04-03-2012
use the below line in your blat, so that you can check why it is failed.
Code:
-log blat.log

# 17  
Old 04-03-2012
I mentioned like this but i don't find the log file.

WshShell.Run "blat -to fareedm@xxx.xx-subject ""SQL Server process not running"" -log blat.log -body ""SQL Server process not running""", 1, True]
Mohammed Fareed
# 18  
Old 04-03-2012
did you give the fullpath for the blat ? ( i already mentioned in my old post )

Code:
 
WshShell.Run "/full/path/blat -to fareedm@xxx.xx -log blat.log -subject ""SQL Server process not running"" -body ""SQL Server process not running""", 1, True

# 19  
Old 04-03-2012
I did the same but starange error, Please look into this.

Code:
 
C:\Documents and Settings\Fareedm\Desktop>Blat -install 192.168.100.204 3 FROMM
25
SMTP server set to 192.168.100.204 on port 25 with user 3, retry FROMME25 time(
)
C:\Documents and Settings\Fareedm\Desktop>cscript.exe check.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Documents and Settings\Fareedm\Desktop\check.vbs(15, 2) (null): The system c
nnot find the file specified.

C:\Documents and Settings\Fareedm\Desktop>blat
Blat v1.8.2b: WinNT/95 console utility to mail a file via SMTP
by P.Mendes, M.Neal, G.Vollant, T. Charron
  http://www.interlog.com/~tcharron/blat.html
syntax:
  Blat <filename> -t <recipient> [optional switches (see below)]
  Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]] [-q]
  Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q]
  Blat -h [-q]
-install <server addr> <sender's addr> [<try n times> [<port> [<profile>]]]
     : set's SMTP server, sender, number of tries and port for profile
       (<try n times> and <port> may be replaced by '-').
<filename>     : file with the message body ('-' for console input, end with ^Z
-t <recipient> : recipient list (comma separated)
-s <subj>      : subject line
-f <sender>    : overrides the default sender address (must be known to server)
-i <addr>      : a 'From:' address, not necessarily known to the SMTP server.
-c <recipient> : carbon copy recipient list (comma separated)
-b <recipient> : blind carbon copy recipient list (comma separated)
-o <organization>: Organization field
-h             : displays this help.
-q             : supresses *all* output.
-noh           : prevent X-Mailer header from showing homepage of blat
-noh2          : prevent X-Mailer header entirely
-p <profile>   : send with SMTP server, user and port defined in <profile>.
-server <addr> : Specify SMTP server to be used. (optionally, addr:port)
-port <port>   : port to be used on the server, defaults to SMTP (25)
-hostname <hst>: select the hostname used to send the message
-mime          : MIME Quoted-Printable Content-Transfer-Encoding.
-uuencode      : Send (binary) file UUEncoded
-base64        : Send (binary) file using base64 (binary Mime)
-try <n times> : how many time blat should try to send. from '1' to 'INFINITE'
-attach <file> : attach binary file to message (may be repeated)
-attacht <file>: attach text file to message (may be repeated)
Note that if the '-i' option is used, <sender> is included in 'Reply-to:'
and 'Sender:' fields in the header of the message.
C:\Documents and Settings\Fareedm\Desktop>

Mohammed Fareed
# 20  
Old 04-03-2012
C:\Documents and Settings\Fareedm\Desktop\check.vbs(15, 2) (null): The system c
nnot find the file specified.

Did you give the full path for blat ?

can you post the script here...
# 21  
Old 04-03-2012
Yes sure...

Code:
 
dim WshShell
dim f,fso,Filename
Const ForReading = 1
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
'run the command and redirect
WshShell.Run "cmd /c tasklist.exe |sort > C:\\tlist.txt", 2, True
Filename = "C:\\tlist.txt"
Set f = fso.OpenTextFile(FileName, ForReading, True)
FileText = f.ReadAll
f.close
IF InStr(FileText,"oracle.exe") = 0 Then
 'Trigger the email - use blat or bmail utility
 Set WshShell = WScript.CreateObject("WScript.Shell")
 WshShell.Run "C:\Documents and Settings\Fareedm\Desktop\blat182_b\blat -to fareedm@xxxx.xx-subject ""SQL Server process not running"" -log blat.log -body ""SQL Server process not running""", 1, True
 'clear out wshshell variable
 set wshShell = Nothing
END IF
msgbox Found
WScript.Quit

Mohammed Fareed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

How to connect Linux server (configure two way authentication) with Windows server?

Hi my name is Manju. ->I have configure the two way authentication on my linux server. ->Now I am able to apply two way authenticator on particuler user. ->Now I want to map this linux server to my AD server. ->Kindly tell me how to map AD(Active Directory) with this linux server. ... (0 Replies)
Discussion started by: manjusharma128
0 Replies

2. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

3. Ubuntu

Automatic update script issue (Ubuntu server)

Hi, I've created a very basic script to run apt-get update and apt-get dist-upgrade unattended (run with cron) and save the logs. Though, it's not really a script, just a file containing the commands to run in order: pasteit .com/18601 I'm currently testing this and ran into some unexpected... (4 Replies)
Discussion started by: Raxje
4 Replies

4. Programming

Problem with Perl script after moving from a Windows/Apache Server to a UNIX server.

I have a Perl script that worked fine before moving it to justhost.com. It was on a Windows/Apache server. Just host is using UNIX. Other Perl scripts on other sites that were also moved work fine so I know Perl is functioning. The script is called cwrmail.pl and is located in my cgi-bin. When I... (9 Replies)
Discussion started by: BigBobbyB
9 Replies

5. Shell Programming and Scripting

Unix shell script to Copy files from one Windows server to another Windows server.

Can anybody please help me on how to code for the below requirement: I need to write a shell script (on different unix server) to copy files from multiple folders (ex. BRN-000001) from one windows server (\\boldls-mwe-dev4)to a different windows server(\\rrwin-ewhd04.ecomad.int). This shell... (4 Replies)
Discussion started by: SravsJaya
4 Replies

6. AIX

Do I need to configure my local windows to FTP files from local windows to a UNIX AIX server?

Hi Friends, I have this script for ftping files from AIX server to local windows xp. #!/bin/sh HOST='localsystem.net' USER='myid_onlocal' PASSWD='mypwd_onlocal' FILE='file.txt' ##This is a file on server(AIX) ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE... (1 Reply)
Discussion started by: rajsharma
1 Replies

7. Linux

How to configure linux to receive snmp traps from a windows server?

Can anybody please tell me how to configure linux to receive snmp traps from a windows server? I am not able to receieve snmp traps on unix machines specifically linux and solaris. I have tried starting snmptrapd service on linux but it didn't work. Is there anything special that I have to do on... (2 Replies)
Discussion started by: iamtulipin
2 Replies

8. UNIX for Dummies Questions & Answers

Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server

I have a .sh script which was running fine on all the UNIX Servers (AIX, SunSolaris). The script requires two mandatory parameters and many optional parameters. Now at a different client place who are on a Windows Server, when I try to execute the script through MKS Toolkit, there are couple of... (5 Replies)
Discussion started by: madhunk
5 Replies

9. Solaris

Script for automatic deletion of trash file of mail server

Hi, I have a mail server with limited space and operating system is sun solaris 8 (sparc). I do not have provisions to increase the space for home directory. So i have to delete files from /home/username/mail/trash which are more than 10 days old automatically. So my script should be like... (1 Reply)
Discussion started by: crown2100bd
1 Replies

10. Shell Programming and Scripting

Automatic FTP Script from windows to unix machine

Hi i need to FTP files from windows to unix(sun) machine using script. what are the scripts commands i need to use to transfer files Thanks (2 Replies)
Discussion started by: bmkreddy
2 Replies
Login or Register to Ask a Question