NET SEND application front end. How?

Posted on 2006-06-07
Medium Priority
Last Modified: 2008-03-03
Hello experts,

There is a command line program in windows 2000 called NetSend that allows you to send messages to users loggeg in to a certain domain name. I was thinking of building a simple interface to send these messages instead of the command prompt window. How would I do that?


Form1 - The form
Textbox1 - "To a single user" box
Textbox2 - Body of the message
Button1 - Send it!

Sample Sintax:
C:\net send who what
C:\net send johndoe Hello there!

Thanks for anything!
Question by:donniedarko801
  • 2
  • 2
LVL 96

Accepted Solution

Bob Learned earned 1000 total points
ID: 16855526
This is the class that I use:

Public Class NetSend

  ''' -----------------------------------------------------------------------------
  ''' <summary>
  ''' Send a message to a user or a domain
  ''' </summary>
  ''' <remarks>
  '''    The syntax of this command is:
  '''     NET SEND
  ''' {name | * | /DOMAIN[:name] | /USERS} message
  ''' </remarks>
  ''' <history>
  '''   [Bob]  6/7/2006  Created
  ''' </history>
  ''' -----------------------------------------------------------------------------
  Public Shared Sub SendMessage(ByVal name As String, ByVal domain As String, ByVal message As String)

    Dim process As New Process

    Dim arguments As String = "SEND"

    If domain.Length > 0 Then
      arguments &= " /DOMAIN:" & domain
    End If

    process.StartInfo.FileName = "net.exe"
    process.StartInfo.Arguments = arguments

    process.StartInfo.CreateNoWindow = True
    process.StartInfo.ErrorDialog = False
    process.StartInfo.RedirectStandardOutput = False
    process.StartInfo.RedirectStandardInput = False
    process.StartInfo.RedirectStandardError = False
    process.StartInfo.UseShellExecute = False



  End Sub

End Class

  NetSend("JohnDoe", "", "Hello there!!!")


Author Comment

ID: 16855747
Thanks! You've already got my points. I'll reaised points reward to 350 for one last question.

I'm looking for a way to spoof who the message is coming from and I was wondering how to implement it in the code above.

I think this post talks about it but I like how clean your code is, :-)

Here's what it's about: NetMessageBufferSend
Here's the usage I think... NetMessageBufferSend( hosttosendto, mesgname, myspoofedname, message, messagelen );
Here's the post I've found: http://www.experts-exchange.com/Operating_Systems/WinNT/Q_20125951.html

Thanks again!
LVL 96

Expert Comment

by:Bob Learned
ID: 16855845
Never worked with NetMessageBufferSend.  What is the legitimate reason for wanting to spoof?


Author Comment

ID: 16855871
Reason is message could be sent by more then one person on the same department but is not that big of a deal. Thanks anyway :-)

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question