3

After alot of google searching, I see it is possible to send a message from a Ubuntu computer to Windows XP computer with the follow smbclient code.

echo "hello world" | smbclient -M "WindowsHost" . Sends message and shows Windows Meesage Popup

However I haven't found a single person running Windows 7 or 8 that is able to send a message from Ubuntu or ANY OTHER distribution. I would think that it work work fine because Windows new message utility is MSG, which works if you send a message from Windows computer to Windows computer.

So why won't

echo "hello world" | smbclient -M "WindowsHost" send a popup message to Window Computer?

Alternative to smbclient to send message to Window 7 or 8 computer?

Benjamin Jones
  • 644
  • 2
  • 21
  • 44

1 Answers1

4

According to this:

Windows Vista, Windows 7, and Windows 8 have no Netsend command at all, and you need additional software to receive or send net messages, like our LanTalk NET.

So... no more smbclient to send a message to Windows Vista and higher.


According to this, Windows 7 does have the MSG.EXE-command but i haven't figured out if you can send a message from a Linux-based machine to Windows 7.

C:\>msg rik hello world
gives me the dialog below so the mechanism is still there.
Now we need to find a way to do it from Linux.

enter image description here

But it is certain that smbclient is not compatible with msg.exe.

You could try to Google for a Linux version


Edit:

I did some searching and couldn't find any Linux-programs which can communicate with the standard MSG.EXE-service of Windows. Due to the many exploits of the net send-command by hackers and spammers Microsoft retired the service (as of Vista) and the new MSG.EXE communications are encrypted.

Next idea is to execute the MSG.EXE-command remotely on a Windows machine. This should be doable with the PsExec-service.

First i tried to use PsExec from Windows XP to Windows 7 (just to be sure PsExec worked).
But i got an "access denied"-error. From here i followed the first suggestion and the registry change on the target Windows 7 worked:
(i also needed to do this on a clean Windows 8.1 machine i tested with as target)

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

(If "Windows (PsExec) -> Windows" doesn't work "Linux (winexe) -> Windows" certainly wouldn't work.)

Next i installed winexe on my ancient Fedora 3 server from 2004. (Yeah... i know ;).
I got a lot of warnings during compilation but non were fatal.

wget http://downloads.sourceforge.net/project/winexe/winexe-1.00.tar.gz
tar xzvf winexe-1.00.tar.gz
cd winexe-1.00/source4/
./autogen.sh
./configure
make

bin/winexe -U user%password //xps8500 'cmd'
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>

I got the command-prompt from the remote system.

Next the command:

bin/winexe -U user%password //xps8500 'msg rik hello world'

and i got the same image as above. So that works. It's not very pretty to use PsExec/winexe to execute MSG.EXE, but hey... it works ;)

(just test every system you need if they can be used as target for PsExec or can receive a MSG.EXE-message with /server:x from another Windows machine you PsExec to)

Personally i don't like a dialog popping up during my work (blocking everything i type), so i use a small less intrusive messaging system, which pops out a small window near the system tray (which disappears after a timeout) but that requires additional software. There are a lot of simple messaging programs you could use. You could also code your own. It doesn't have to be fancy to just show a popup in the right-bottom corner.

Rik
  • 13,159
  • 1
  • 34
  • 41
  • Hey Rik, I found this way: http://askubuntu.com/questions/335026/sending-commands-from-ubuntu-13-04-to-windows-7 – Benjamin Jones Jan 08 '14 at 22:07
  • Yeah i was just about to add [this link](http://micksmix.wordpress.com/2012/08/09/winexe-a-psexec-like-client-for-accessing-windows-from-linux/). Using a psexec-like command to run the `msg.exe` on the Windows machine seems like a long way around but would work ;) – Rik Jan 08 '14 at 22:10
  • I have not configured winexe YET but this might work: winexe -U 'user%password' //IP 'msg * Go to link "http://google.com"' – Benjamin Jones Jan 08 '14 at 22:12
  • Your right,its the long way around, but whatca going to do. FYI all of this should work for what I want to do, which is everytime a user obtains a IP address, send them a message (depending on OS) from Ubuntu Server. THanks for the help! I wanted to make everything on the end user side as "native"/they dont have to download anything, as possible. Again thanks! – Benjamin Jones Jan 08 '14 at 22:16
  • 1
    Yup. That looks about right. (I'll try that tomorrow too, on my Linux-server). I will also Google some more for a more native (compatible) solution. – Rik Jan 08 '14 at 22:16
  • 1
    Added an Edit with my experience with `winexe` (Linux alternative to `PsExec`) – Rik Jan 09 '14 at 11:30
  • 1
    Yes. You can read about my experience with `winexe` (compilation and running it) in my edit (halfway my answer:). `bin/winexe -U user%password //xps8500 'msg rik hello world'` worked beautifully. – Rik Jan 09 '14 at 18:50
  • Ya worked great. Only negative thing is that you need the user's username & password . So you cant freely send a message like you could with smb client – Benjamin Jones Jan 10 '14 at 02:13
  • Yeah and the problem is, that user also needs to be Administrator to be able to connect to with `PsExec/winexe` :( You could `chmod 700` the file and only restrict access to yourself (read, write and execute) but still, it's a security risk. Another way to go would be to create a file on Ubuntu (or public share) and make a batch-file on a Windows machine (which would execute every minute or so with task-scheduler) to check that file and `msg` out the content to the other Windows-machines. (with some scripting you could even specify its destination, a poor mans messaging service, so to speak ;) – Rik Jan 10 '14 at 10:09