Solved

Script to check for running instance

Posted on 2011-02-23
5
561 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
  • 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
 

Author Closing Comment

by:musras
ID: 34995557
0

Featured Post

Why do Marketing keep bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
In this video we show how to create a Distribution Group 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 Recipients >>…
In this video we show how to create a Contact 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 Recipients >> Contact ta…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now