Solved

Script to check for running instance

Posted on 2011-02-23
5
566 Views
Last Modified: 2012-05-11
I've spent 3,5 hours looking for a VB script that simply returns true if a process is present in Task Manager. I wish i had the time to learn how to do it, but i won't for another month or two.

Any VBS sharks that could help out?

Best
musras
0
Comment
Question by:musras
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:KCarney81
ID: 34965127
Although not VBS, you could start with batch;

sc \\computername query servicename >c:\textfile.txt
0
 

Author Comment

by:musras
ID: 34965175
Thanks for the quick reply KC!

I'm (going to be) running the script from a system monitoring app that only works with VBS :/
0
 
LVL 3

Expert Comment

by:KCarney81
ID: 34965196
Ah ok, batch won't work for you then.  Figured I'd try
0
 

Accepted Solution

by:
musras earned 0 total points
ID: 34965437
Ah found it...

'-----------------------------------------------------------
'  ProcTest.vbs (v1.0)
'-----------------------------------------------------------
' @proc = process to test for 
' Returns number of proccesses running or 0 if not 
'-----------------------------------------------------------

Function ProcTest(proc)
	ProcTest = 0

	set service = GetObject ("winmgmts:")

	for each Process in Service.InstancesOf ("Win32_Process")
		If Process.Name = proc then
			ProcTest = ProcTest + 1
		End If
	next
End Function

Open in new window

0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
Check out this step-by-step guide for using the newly updated Experts Exchange mobile app—released on May 30.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question