Receive “net send” messages in Mac OS X via Growl

Receive net send in Mac OS X

Quick recipe to receive “net send” messages (usually sent from Windows) in Mac OS X via Growl. I worked it out while helping user kamlay @ habrahabr.

Step 1. If you’re using Lion, install Samba and start the server.

If you’re using Snow Leopard, Samba comes bundled with it. Start it by going to System Preferences > Sharing > File Sharing > Options… > tick “Share files and folders using SMB (Windows)”. Also make sure the entire “File Sharing” option is enabled.

Step 2. Install growlnotify. Snow Leopard version comes bundled in the disk image with Growl itself. For Lion it’s a separate download (it’s in the bottom of the downloads page as of writing).

Step 3. Create a new file /usr/local/bin/growlnotify.sh with the following content:

#!/bin/bash
cat $1 | /usr/local/bin/growlnotify -t $2

Then in Terminal, make it executable:

chmod +x /usr/local/bin/growlnotify.sh

Step 4. Open /etc/smb.conf and under [global] add a new line:

message command = /usr/local/bin/growlnotify.sh %s %f

Step 5. Restart the Samba server. In Lion, use the commands provided in the guide you used to install the server. In Snow Leopard, just untick and tick again the the “File Sharing” option.

(Interestingly, “net send” is not available in Windows 7 Basic and Home Premium and comes only with Business and Ultimate editions. If you don’t have it you may use a 3rd party replacement called sent).

This entry was posted in How to’s and tagged , , . Bookmark the permalink.

3 Responses to Receive “net send” messages in Mac OS X via Growl

  1. Zann says:

    Great post, but the ‘net send’ command is only available in Windows XP and earlier. Now it is replaced with MSG.exe.

  2. Mark says:

    True, vista and windows 7 cannot do “net send” and MSG only works to terminal servers or to local PCs.

    I use a script to do popups on both XP, VISTA, and WINDOWS 7. Read the comments, because you must turn on powershell remote execution to get this to work.
    @echo off
    rem — John Neumann, 23mar2011
    rem — Windows7 msg.exe only works on your local PC or over network to
    rem — Terminal Servers, but you cannot msg.exe remotely to a workstation.
    rem — This script allows you to do like the old pre-vista “net send”
    rem — to send to all PCs and Servers on your Active Directory domain.

    rem — All PCs need powershell remote executions turned on and this
    rem — could be seen as a security risk.
    rem — Put this command into your logon script or group policy:
    rem — powershell enable-psremoting -force

    if ‘%1’==” (
    echo Usage: netsend.bat “Thing to say to all networked PCs & Servers”
    pause
    goto :EOF
    )

    rem — %%~NXa gets rid of leading directory type \ characters,
    rem — doing filename only (which is host name in this case)
    echo Your taskbar will temporarily have many minimized processes as I send messages.
    for /f “usebackq” %%a in ( `net view^|find “\\”` ) do (
    echo msg to %%~NXa
    start /MIN /NORMAL “title msg to %%~NXa” powershell -command Invoke-Command -Computername %%~NXa {msg.exe * %1 %2 %3 %4 %5 %6 %7 %8 %9}
    )
    echo Your taskbar will temporarily have many minimized processes as I send messages.
    echo Each taskbar process will go away as messages complete.

    rem — Done

Comments are closed.