[THIN] Re: message notifier

  • From: "Andrew Wood" <andrew.wood@xxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Tue, 28 Mar 2006 15:00:03 +0100

Its probably more likely to spike if you've got a long user list 
 
The For Each oMember In oGroup.Members loop going to cycle round pretty fast
without giving the server time to think about anything else.
 
Try sticking in a sleep(50) or sleep(100) command in after the net send.
It'll take slightly longer to run but the sleep will pause the process for a
moment to let other tasks operate avoiding the spike


  _____  

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of IT Support
Sent: 28 March 2006 14:12
To: thin@xxxxxxxxxxxxx
Subject: [THIN] message notifier



Greetings list

 

We currently employ a VBS script to notify users about mundane stuff like
Server Reboots and sandwich rounds (see below) but have noticed that this
can spike CPU and memory usage with the trillions of net sends that the
script sends out..

 

Has anyone else found a more efficient way to net send users?

 

Please feel free to tear apart the script and pick holes =)

 

-------------------------- Script Below ----------------------------

sGroupName = "All Internal Users" 

sDomain = "CORPORATE DOMAIN NAME" 

sMessage = "Server will be rebooted in 5 mins, please save your work and log
out"

bForce = False 

On Error Resume Next 

Err.Clear 

Set oGroup = GetObject("WinNT://" & sDomain _ 

  & "/" & sGroupName & ",group") 

If Err.Number <> 0 Then 

  Err.Clear 

  Wscript.Echo "Unable to find group " & sGroupName 

  Wscript.Quit(1) 

End If 

On Error GoTo 0 

Set oShell = CreateObject("Wscript.Shell") 

nCount = 0 

nError = 0 

For Each oMember In oGroup.Members 

  nRC = oShell.Run("command /c net send "& oMember.Name & " " & sMessage, 0,
bForce) 

  If nRC = 0 Then 

    nCount = nCount + 1 

  Else 

    nError = nError + 1 

    Wscript.Echo "Message NOT sent to " & oMember.Name _ 

      & ", error code " & nRC 

  End If 

Next 

--------------------------------------------------------------------------

 

Regards,

Jaime

 

Other related posts: