Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script for Net Send

Status
Not open for further replies.

Techie64

Technical User
Mar 22, 2005
29
US
Hi. In Windows XP, I want to create a user interface in VBScript that compliments the NET SEND command. This is what I have so far:

Set objShell = Wscript.CreateObject("WScript.Shell")
Comp2Reach = InputBox("Enter in Computer name.")
Message2Send = InputBox("Type your message.")
objShell.Run "net send " & Comp2Reach & " " & Message2Send

This works, except I want to have two text boxes on the same interface. Is this possible?

Also, is there a way to use allow the user to input multiple computer names to send the same message?

Either question answered would be a big help, especially the one about the two text boxes on the same interface. Thanks.
 
Have a look at hta

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV.

I'd like to have this as a stand alone VBScript the user double-clicks to launch, if it's possible. Thanks.
 
An hta file is a standalone HTML App launchable by double-click ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OK, here's what I got. This thing is that I'd like for it to display a summary message box after the Net Send executes. Basically it should pop up saying that you sent the message to the following stations: and it lists the stations 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
 
Change:

For Each strName in arrPCNames
Wscript.Echo strName
Next

To:

For Each strName in arrPCNames
strMsg = strMsg & strName & vbCrLf
Next
WScript.Echo strMsg

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top