Solved

Script to check for running instance

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

Author Closing Comment

by:musras
ID: 34995557
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this video we show how to create an Address List 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 Organization >> Ad…
To show how to generate a certificate request 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 >> Certificates…

749 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