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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I do a net send with VBS?

Status
Not open for further replies.

linmatt

Technical User
May 22, 2002
50
0
0
GB
I have a list of ip addresses in a dynamically created text file from our Unix server that I need to do a net send to in Windows. I can run this in a batch file or preferably vbs, but I'm a very novice VBS programmer, so having struggled, asked and googled for a day or 2 I've nearly given up, can anyone help? I'd like to ne able to add my own message via an input box, and then simply scroll through all the ip addresses in a for-next / do-while loop or something untill all the addresses are exhausted. The addresses are never the same 2 days running, so a text file is the way to go rather than embedded addresses in the script.

Thanks

Matt
 
Here's a piece of code that should get you started. It only works using the machine name, not the IP address. Also, Win9X clients have to have WinPopup running to receive the message.

Hope this helps,

mapman04

'===Script===
Dim oShell,fso,txt3,adm1,adm2,adm3
Set oShell = WScript.CreateObject ("WSCript.shell")
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set txt3 =fso_OpenTextFile("E:\Data\IPs.txt",1)

Do While txt3.AtEndOfStream = False

adm1 = txt3.ReadLine
adm2 = Len(adm1)
adm3 = UCase(Left(adm1,adm2))
oShell.run "cmd /C CD C:\ & Net Send " & adm3 & " Go to Lunch",0,true

Loop

txt3.Close

MsgBox "Done...",64,"Process Complete"
WScript.Quit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top