Configure automatic script in windows server

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Configure automatic script in windows server
# 8  
Old 04-02-2012
change these two lines

Code:
 
Dim objWMIService, objProcess, colProcess
Dim strComputer, strList

to
 
Dim objWMIService, objProcess, colProcess,WshShell 
Dim strComputer, strList,Found

Also change the below line
Code:
 
 
set WshShell = Nothing

# 9  
Old 04-02-2012
Thanks for update seems script is executing but the issue is i'm not reaciving the email while running the script.

Code:
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 (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Documents and Settings\Fareedm\Desktop>

Please advice.

Last edited by Scrutinizer; 04-02-2012 at 09:21 AM.. Reason: Code tags
Mohammed Fareed
# 10  
Old 04-02-2012
can you put below line before the WScript.Quit and check what is the value of the Found variable.

Code:
msgbox Found

Also, you can print the process name ( inside the For Each loop) and check whether the expected process name is coming or not

Code:
 
For Each objProcess in colProcess
'''''''''''''Check the Process Name'''''''''
WSCript.Echo objProcess.Name
IF trim(objProcess.Name) = "YOUR_PROCESS_NAME" THEN
Found="YES"
END IF
'''''''''''''END'''''''''

# 11  
Old 04-02-2012
Its showing the below process, and also opening the pop-up with saying "NO".

Code:
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.
System Idle Process
System
smss.exe
csrss.exe
winlogon.exe
services.exe
lsass.exe
svchost.exe
svchost.exe
MsMpEng.exe
svchost.exe
svchost.exe
svchost.exe
spoolsv.exe
svchost.exe
tomcat5.exe
svchost.exe
svchost.exe
winvnc4.exe
WLIDSVC.EXE
YahooAUService.exe
CcmExec.exe
wmiprvse.exe
explorer.exe
igfxsrvc.exe
hkcmd.exe
igfxpers.exe
msseces.exe
SearchProtection.exe
ctfmon.exe
Ymsgr_tray.exe
OUTLOOK.EXE
OSPPSVC.EXE
WLIDSVCM.EXE
wmiprvse.exe
TOAD.exe
iexplore.exe
iexplore.exe
iexplore.exe
notepad.exe
iexplore.exe
putty.exe
notepad.exe
firefox.exe
plugin-container.exe
notepad.exe
cmd.exe
notepad.exe
plugin-container.exe
cmd.exe
wuauclt.exe
wmiprvse.exe
cscript.exe

Moderator's Comments:
Mod Comment Please use Code tags!!!

Last edited by Scrutinizer; 04-02-2012 at 09:21 AM..
Mohammed Fareed
# 12  
Old 04-02-2012
what process you are checking it ?

Code:
 
IF trim(objProcess.Name) = "YOUR_PROCESS_NAME" THEN

# 13  
Old 04-02-2012
I'm sorry i din't change this line, I put the process name oracle and tried, seems issue is same, Because when i'm trying check the oracle process in task manager its not showing , when i'm doing
Code:
c:\> tasklist

from cmd level, its showing the oracle process.

Please advice.

Last edited by Scrutinizer; 04-02-2012 at 09:40 AM.. Reason: Code tags !!!!!!!!!!!!!!!
Mohammed Fareed
# 14  
Old 04-03-2012
try the below code.

change the highlighted to your process name

Also, give the full path for blat

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 "blat -to abcd@xyz.com -subject ""SQL Server process not running"" -body ""SQL Server process not running""", 1, True
 'clear out wshshell variable
 set wshShell = Nothing
END IF
WScript.Quit

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