I have a need to create a script that allows a person to send a
broadcast message (net send) to an entire AD domain, or members of a
specific OU. I've come up with the following script, but it has a
problem. If there are more than a few user accounts, the system that
the script is ran on can lock up. I believe this is due to the
numerous 'net send' commands being spawned. Is there a better way to
do this? Is it possible to have the script spawn a command and wait
for it to return before looping to the next?

----------begin script----------
OUText = InputBox("OU to send to (ou=test,dc=company,dc=com): ")
MsgText = InputBox("Type Your Message: ")
EnumOU(OUText)

Sub EnumOU(sAdsPath)
Dim oContainer, oObject, sClass
Set oContainer = GetObject("LDAP://" & sAdsPath)
Set WshShl = Wscript.CreateObject("WScript.Shell")
Wscript.Echo "Container: " & oContainer.DistinguishedName
For Each oObject In oContainer
sClass = LCase(Left(oObject.ObjectCategory, 9))
If sClass = "cn=person" Then
Wscript.Echo "--User cn: " & oObject.cn _
& ", sAMAccountName: " & oObject.sAMAccountName
WshShl.Run "net send " & oObject.sAMAccountName & " " & MsgText
End If
Next
For Each oObject In oContainer
sClass = LCase(Left(oObject.ObjectCategory, 22))
If sClass = "cn=organizational-unit" Then
EnumOU(oObject.DistinguishedName)
End If
Next
End Sub
-----------------end script-------------------