2

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

1 Answers1

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

Maxwell
  • 5,026
  • 1
  • 25
  • 31