Articles

VBScript for Net Send

July 15, 2005 at 12:05:43

I've created a user interface in VBScript that compliments the NET SEND command in Windows XP. It allows the user to input any number of computer names seperated by a comma (,), then input the message that they want to send. Finally, It displays a summary of what message was sent and the computer names.

This thing is that I'd like for it to display all the computer names on the same message box. The way I have it now, it displays each PC in it's own popup box.

How can I modify my script to display a list of all the PCs that got the message using the msgbox function?

Dim arrPCnames()
intSize = 0

Set objShell = Wscript.CreateObject("WScript.Shell")

'Get computer names
PC2Reach = InputBox("Please enter the computer name. For additional computers, separate each with a comma (,)"

'Get message
Message2Send = InputBox("Type your message.", "Send a message")

arrStations = Split(PC2Reach, ",")

'Send message
For Each PC2Reach In arrStations
objShell.Run "net send " & PC2Reach & " " & Message2Send

ReDim Preserve arrPCnames(intSize)
arrPCnames(intSize) = PC2Reach
intSize = intSize + 1

Next

'Summary of command
MsgBox "Here's you message:" & vbCrLf & _
vbCrLf & _
Message2Send & vbCrLf & _
vbCrLf & _
"Computers that got the message:"

For Each strName in arrPCNames
Wscript.Echo strName
Next


See More: VBScript for Net Send

Report •


#1
July 15, 2005 at 13:16:24

Create a variable of the computer names, THEN use the MsgBox command:

'Summary of command
For Each strName in arrPCNames
PCNamesList = PCNamesList & vbCrLf & strName
Next

MsgBox "Here's you message:" & vbCrLf & _
vbCrLf & _
Message2Send & vbCrLf & _
vbCrLf & _
"Computers that got the message:" & vbCrLf & _
PCNamesList


Michael J


Report •
Related Solutions


Ask Question