NET SEND application front end. How?

Posted on 2006-06-07
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
    LVL 96

    Accepted Solution

    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!!!")

    LVL 1

    Author Comment

    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:

    Thanks again!
    LVL 96

    Expert Comment

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

    LVL 1

    Author Comment

    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

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    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 …
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now