Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having the following problem.

I am running a Windows NT server. I need to monitor the server utilization continuously (automated process) and need to know if the server load is high. And if it high I need to trigger a scheduled task.

Can we write a VB script in order to do this?

Can someone please help me?

Kindly let me know in case you require more info on this

Thanks

share|improve this question

1 Answer 1

You can use a short vbs script like this one to launch a scheduled task if the proc load is above 90. You can shedule it using cscript /nologo script.vbs:

On Error Resume Next

Dim objProc
Set objProc = GetObject("winmgmts:root\cimv2:win32_processor='cpu0'")

If objProc.LoadPercentage > 90 Then
    Set objTaskService = CreateObject("Schedule.Service")
    objTaskService.Connect
    Set objRootFolder = objTaskService.GetFolder("\")
    Set objTask = objRootFolder.GetTask("YOUR_TASK_NAME")
    objTask.Run vbNull
End If

Set objProc = Nothing

Hope this helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.