Configure automatic script in windows server

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Configure automatic script in windows server
# 22  
Old 04-03-2012
you have blat in this location

C:\Documents and Settings\Fareedm\Desktop>blat

then, why you put it as C:\Documents and Settings\Fareedm\Desktop\blat182_b\blat in the script ?

if you have the file in the above location also, then try

Code:
 
C:\\Documents and Settings\\Fareedm\\Desktop\\blat182_b\\blat


Last edited by itkamaraj; 04-03-2012 at 08:05 AM..
# 23  
Old 04-03-2012
why you put it as C:\Documents and Settings\Fareedm\Desktop\blat182_b\blat in the script ?
---Both the location i have blat.

I tried with both the location but the error is same. At update 15 i have written code in which i use to get email,your feed back will be more helpfull.

Code:
 
WshShell.Run "C:\\Documents and Settings\\Fareedm\\Desktop\\blat -to fareedm@xxx.xx -subject ""SQL Server process not running"" -log blat.log -body ""SQL Server process not running""", 1, True
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 FROMM time(s)
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 ca
nnot find the file specified.

Mohammed Fareed
# 24  
Old 04-03-2012
seems the problem is with the "c:\documents<space>"

can you copy the blat directory to c:\ and replace the path to c:\blat182_b\blat
This User Gave Thanks to itkamaraj For This Post:
# 25  
Old 04-03-2012
I have done the same, now this time its running and one blank pop-up is coming after saying ok it will gone and i don't reacive email and also didnot find the log file.

Code:
 
C:\blat182_b>Blat -install 192.168.100.204 3
SMTP server set to 192.168.100.204 on port 25 with user 3, retry 1 time(s)
C:\blat182_b>cscript.exe check.vbs
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

C:\blat182_b>

Mohammed Fareed
# 26  
Old 04-03-2012
Did u change the process name and if the text file has that process name?

If it is there, then script will not send email
# 27  
Old 04-03-2012
Seems Issue is in the blat mail sending, manually I tried its not working details given below.
Please advice.

I have given the email correct, here i put "xx"Please advice.
Code:
C:\blat182_b>blat -to fareedm@xxx.xx -subject ""SQL Server process not runni
ng"" -body ""SQL Server process not running""", 1, True
-to does not exist

My Task List:-

Code:
 
C:\blat182_b>tasklist
Image Name                   PID Session Name     Session#    Mem Usage
========================= ====== ================ ======== ============
System Idle Process            0 Console                 0         28 K
System                         4 Console                 0        240 K
smss.exe                     648 Console                 0        444 K
csrss.exe                    696 Console                 0      4,752 K
winlogon.exe                 724 Console                 0      3,864 K
services.exe                 768 Console                 0      3,660 K
lsass.exe                    780 Console                 0      2,128 K
svchost.exe                  956 Console                 0      5,640 K
svchost.exe                 1024 Console                 0      4,820 K
MsMpEng.exe                 1120 Console                 0     45,216 K
svchost.exe                 1156 Console                 0     30,956 K
svchost.exe                 1248 Console                 0      3,780 K
svchost.exe                 1368 Console                 0      4,204 K
spoolsv.exe                 1540 Console                 0      5,072 K
svchost.exe                 1716 Console                 0      3,924 K
tomcat5.exe                 1852 Console                 0    146,180 K
svchost.exe                 1876 Console                 0      3,116 K
svchost.exe                 1896 Console                 0      3,092 K
winvnc4.exe                 2036 Console                 0      3,788 K
WLIDSVC.EXE                  228 Console                 0     12,564 K
YahooAUService.exe           548 Console                 0      6,220 K
CcmExec.exe                  596 Console                 0     29,844 K
wmiprvse.exe                 256 Console                 0      5,920 K
wmiprvse.exe                2488 Console                 0      5,384 K
WLIDSVCM.EXE                2552 Console                 0      2,252 K
explorer.exe                2616 Console                 0     21,908 K
hkcmd.exe                    604 Console                 0      3,604 K
igfxpers.exe                 632 Console                 0      3,232 K
msseces.exe                 2480 Console                 0     13,216 K
igfxsrvc.exe                3268 Console                 0      3,472 K
SearchProtection.exe        3284 Console                 0      1,504 K
ctfmon.exe                  3304 Console                 0      4,152 K
Ymsgr_tray.exe              4016 Console                 0      5,952 K
OSPPSVC.EXE                 3504 Console                 0     10,704 K
notepad.exe                 3904 Console                 0      2,000 K
OUTLOOK.EXE                 1296 Console                 0     17,208 K
firefox.exe                 2268 Console                 0    124,400 K
plugin-container.exe        2528 Console                 0     41,948 K
notepad.exe                 2276 Console                 0        452 K
mstsc.exe                    444 Console                 0      2,356 K
putty.exe                   1424 Console                 0        940 K
putty.exe                   1460 Console                 0        996 K
iexplore.exe                2216 Console                 0      2,788 K
iexplore.exe                2416 Console                 0     53,204 K
notepad.exe                 2156 Console                 0        648 K
plugin-container.exe        3528 Console                 0     10,292 K
cmd.exe                     2116 Console                 0        896 K
iexplore.exe                2316 Console                 0    121,044 K
notepad.exe                 2648 Console                 0      4,024 K
tasklist.exe                2212 Console                 0      4,708 K
wmiprvse.exe                1508 Console                 0      6,056 K

My code:-

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:\\blat182_b\\blat -to fareedm@xxx.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
# 28  
Old 04-03-2012
can you run this and let me know..whether you are getting any error message or not.

Make sure the red color words are modified according to your requirement.

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
msgbox "Process oracle.exe found"

mailCmd ="c:\blat182_b\blat.exe -subject """SQL SERVER PROCESS NOT RUNNING""" -to abc@xyz.com -mime -server 192.168.100.204 -f abc@xyz.com -debug -log blat.log"

msgbox mailCmd

'Send email when done
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run mailCmd, 3, 1

'clear out wshshell variable
set wshShell = Nothing
END IF
WScript.Quit

This User Gave Thanks to itkamaraj For This Post:
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