Introduction: NETsend With VBScripting

Ok so it's not totally with VBScripting, but I think that VBScripting InputBoxes and Msgboxes look much more user friendly than inputting into a cmd window.

Oh and btw, Please don't write "MUCH EASIER WAY..."

Cause yes we all know that you can open up cmd and type "Net send computername yourmessagehere"

This is just a more user friendly way of doing it.

Disclaimer
I am totally not responsible if anything goes wrong with this program, or if the program is misused in ANY way.

Now we've got that out the way, let's move on -->

Step 1: Let's Get Started

Firstly, I'll show you the script and on the next page i'll explain what each bit means.

dim Target
Target=InputBox("Enter Target Computer: ","Carrier Pigeon v1.7 (TheKnight)")
If Target="" Then
WScript.Quit
End IF

dim begin
begin=MsgBox ("Begin conversation with " & target & "?",36,"Carrier Pigeon v1.7")
If begin = vbNo Then
WScript.Quit
End If

dim message
message="0"
Do Until message=""
message=InputBox("Enter Message: " & vbcr & vbcr + _
"No Value sends a blank message" & vbcr + _
"Press Cancel or Alt+F4 to close the window","" & Target," ",13500,100)
Set fs=CreateObject("Scripting.FileSystemObject")
strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~msngr.bat")
strFileName = fs.GetAbsolutePathName(strFileName)
Set ts = fs.OpenTextFile(strFileName, 2, True)
ts.WriteLine "@echo off"
ts.WriteLine "set message=" & message
ts.WriteLine "set target=" & Target
ts.WriteLine "net send %Target% %message%"
ts.Close

dim shell
set shell=createobject("wscript.shell")
shell.Run "~msngr.bat",2
Loop

Step 2: So Let's Explain...

The code on the previous page is shown below with some annotations, if your copying and pasting it into word, please do it on the previous page.

Ok, This first bit opens up the box that asks for the name of the computer you want to start a conversation with. The "If Target" part tells the computer to end the program if the user press' cancel or leaves the input field blank.

dim Target
Target=InputBox("Enter Target Computer: ","Carrier Pigeon v1.7 (TheKnight)")
If Target="" Then
WScript.Quit
End IF

This second bit relays the input that the user did in the previous step, for example if the user input the target computer as: 'The_Pentagon' then this message relays one that says "Start conversation with The_Pentagon?". Same deal as above, if the user press' no, then the operation will terminate.

dim begin
begin=MsgBox ("Begin conversation with " & target & "?",36,"Carrier Pigeon v1.7")
If begin = vbNo Then
WScript.Quit
End If

This next bit is the part that took me LONG to write. It basically creates a batch file and calls it "~msngr.bat". It then writes the correct commands to it for it to initiate NET send.

dim message
message="0"
Do Until message=""
message=InputBox("Enter Message: " & vbcr & vbcr + _
"No Value sends a blank message" & vbcr + _
"Press Cancel or Alt+F4 to close the window","" & Target," ",13500,100)
Set fs=CreateObject("Scripting.FileSystemObject")
strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~msngr.bat")
strFileName = fs.GetAbsolutePathName(strFileName)
Set ts = fs.OpenTextFile(strFileName, 2, True)
ts.WriteLine "@echo off"
ts.WriteLine "set message=" & message
ts.WriteLine "set target=" & Target
ts.WriteLine "net send %Target% %message%"
ts.Close

This then runs the batch file, with the "2" making sure it runs in a minimized window and then closes. This makes it look a bit more professional.

dim shell
set shell=createobject("wscript.shell")
shell.Run "~msngr.bat",2
Loop

Those last two paragraphs of commands are Looped. This allows the user to keep the message window open, and send multiple messages until the user press' cancel and decides to close the program.

Step 3: Bear With Me!

Ok, I know that was alot to take in. But i'm probably going to submit a few new instructables to the site for simple VBScripting, and more advanced VBScripting if enough people comment asking for it.

So now to save the file!

press save, make sure to make the file extension ".vbs"



I know it was alot to take in but i'll explain what happens if the file is used correctly:

Firstly you'll get a prompt asking for the target computer
Next they'll be a message making sure you want to start a conversation with this computer.
If you clicked 'Yes' then an input box should appear (in the top right of your screen, so you can continue with what you want to do) asking you to input the message.
Once a message is input and 'OK' is clicked, then a cmd window should spring out along your toolbar and then disappear, this was the batch file sending the message.
If your friend (or enemy) has this same program installed on their computer, or is nifty with NET send, then you should get a reply back!


Step 4: One Last Thing Before You Go NET Sending Everywhere!

One last little message: THIS WON'T WORK ON VISTA!

The NET send command was abolished for Vista due to security reasons, therefore will only work on Windows operating systems before that.

But as some of you may have noticed, I have written this program on Vista! Therefore IN THEORY it works. However please return with feedback on whether it is successful or not.

Thanks
TheKnight

P.S. Incase your too lazy for words, the file is below

Save it in it's own folder, so that it and "~msngr.bat" can have some alone time...