Show messagebox remote on other computer

M

Mathias Vissers

Hi

I am searching for a method to show a messagebox on a remote computer (I
execute the script on computer A and the messagebox appears on computer B).

I have been searching for hours, but didn't find something to do this
remote.

I've already tried some alternatives, but it wasn't succesfull:
- with wshscript.run do a net send to computer B (but on the most pc's in
our netwerk messenger service is turned off due security reasons)
- I've made a small VB-program which only shows a messagebox. I copy that
file to the local disk of computer B, and than I started the program with
WMI. But also that didn't work (I was only able to start the program as a
service, and then no messagebox appaers...)

Does anybody know a good solution or alternative for this problem?

Thanks in advance!

(PS I'm sorry for my English ;-))

M.
 
G

Gerry Hickman

Hi,

In general, you should NOT do this. Microsoft have tried to lock it down
and have done a good job.
 
S

Sam Hobbs

Why not do this?

Lock down what? Are you saying we can't execute a script remotely? The
documentation sure does not say not to.
 
G

Gerry Hickman

Hi Sam,
Why not do this?

Because it's a security risk, and also it's very annoying.
Lock down what? Are you saying we can't execute a script remotely?

No, I'm not saying that. You can execute a script remote, just don't try
to show any silly messageboxes.
 
J

James Crosswell

Gerry said:
No, I'm not saying that. You can execute a script remote, just don't try
to show any silly messageboxes.

If I got a messages saying "The server is going down in 1 minute" I'd
consider that slightly less annoying than loosing all the data I'm
working on... So I guess how silly the message box is really depends on
how silly/relevant the message that it's displaying is to the user...
Most Indonesians would probably appreciate silly little messages once
every now and then saying things like "there's a tsunami coming - get to
high ground as quickly as possible!".

My 2c.

--

Best Regards,

James Crosswell
Software Engineer
Microforge.net Limited
http://www.microforge.net
 
G

Gerry Hickman

Hi James,
If I got a messages saying "The server is going down in 1 minute" I'd
consider that slightly less annoying than loosing all the data I'm
working on...

Yes, that's a good example, but this is what the messenger service was
designed for.

There's one easy way to get dozens of message boxes on ALL your
computers - just install Microsoft's bungling "Anti-Spyware" - every
time you try to run any kind of Admin script it will pop up a message
box on the user's machine (probably even if no one is logged on), and
prevent the script from running. Handy for those big network-wide
security patch jobs.
So I guess how silly the message box is really depends on
how silly/relevant the message that it's displaying is to the user...
Most Indonesians would probably appreciate silly little messages once
every now and then saying things like "there's a tsunami coming - get to
high ground as quickly as possible!".

Yes; actually I think I misunderstood this post. I was thinking
"Messagebox" as in "Windows UI", and I know most of the scripting
interfaces were locked down to prevent creating UI's on remote machines
- a good strategy in my view - however a messagebox is not actually a
"Window" (or maybe it is? Behind the scenes it's a Win32 HWND).

Logically, it makes no sense to be able to fire a message box from a
remote script, because the script can (and should) be able to work with
no one logged in.

However, that does not prevent you from creating a client application
(run as the user) that can talk to the server and forward events to user
screens...
 
M

Michael Harris \(MVP\)

There's one easy way to get dozens of message boxes on ALL your
computers - just install Microsoft's bungling "Anti-Spyware" - every
time you try to run any kind of Admin script it will pop up a message
box on the user's machine (probably even if no one is logged on), and
prevent the script from running. Handy for those big network-wide
security patch jobs.

Disclaimer: I'm *not* trying to start anything, but since *you* brought it
up, I just couldn't resist...

Microsoft AntiSpyware is *beta* so if you installed it widely on a
production network, then... 'nuff said ;-)...
 
G

Gerry Hickman

Hi Michael,
Microsoft AntiSpyware is *beta* so if you installed it widely on a
production network, then... 'nuff said ;-)...

That's a valid comment. Obviously I have not installed it on any such
environment. Hell, I haven't even installed it on my home computer, or
even on any of my friends home computers, not do I intend to. After
reading some tech notes about it and a magazine review that pretty much
agreed with the tech note, I decided to steer well clear.

Will the release version suddenly be transformed from a bungled 3rd
party buy-out into a slick "set it and forget it" Microsoft flagship
product? Miracles do happen, but not with recent Microsoft releases -
you can guarantee the first version of this will be a dead duck, causing
lots of systems issues, while allowing well written trojans to waltz
right in.

There are certain things Microsoft are good at, like
ATL/COM/JScript/WMI, and then there are other things they are not, such
as Graphics Design, PostScript and Desktop Publishing. When it comes to
SECURITY, that's one area Microsoft should leave well alone.
 
S

Sam Hobbs

Gerry Hickman said:
Yes, that's a good example, but this is what the messenger service was
designed for.

Okay, so we agree that there are valid uses of showing a message in remote
computers.

Is that not possible using WMI? I had a need to execute my program in the
server from a client. I needed to execute my program in the server as if it
were executed by a person. I asked in this newsgroup how to do that and I
got no answers. Since there are no answers here either, I assume it is not
possible to create an interactive process remotely.
 
W

Willy Denoyette [MVP]

Sam Hobbs said:
Okay, so we agree that there are valid uses of showing a message in remote
computers.

Is that not possible using WMI? I had a need to execute my program in the
server from a client. I needed to execute my program in the server as if
it were executed by a person. I asked in this newsgroup how to do that and
I got no answers. Since there are no answers here either, I assume it is
not possible to create an interactive process remotely.

No, it is not possible to create a remote process that has a UI using WMI.

Willy.
 
T

Torgeir Bakken \(MVP\)

Sam said:
Okay, so we agree that there are valid uses of showing a message in remote
computers.

Is that not possible using WMI? I had a need to execute my program in the
server from a client. I needed to execute my program in the server as if it
were executed by a person. I asked in this newsgroup how to do that and I
got no answers. Since there are no answers here either, I assume it is not
possible to create an interactive process remotely.
Hi

Maybe you can create an scheduled task on the remote computer, and
configure it to interact with the desktop.
 
G

Gerry Hickman

Torgeir said:
Maybe you can create an scheduled task on the remote computer, and
configure it to interact with the desktop.

Yup, that's the kind of thing I was referring to when I spoke about
"client/server".

A remote script is not supposed to be able to interact with the desktop,
but that does not mean you can't have a client app that interacts with a
server.
 
S

Sam Hobbs

Torgeir Bakken (MVP) said:
Maybe you can create an scheduled task on the remote computer, and
configure it to interact with the desktop.

I did do a reasonable amount of searching on the subject. I did find a post
from someone with a sample of using the Task Schedulre in that manner. I
chose not to use the solution but if someone is interested, it is worth
searching for.

Another possibility that I mentioned in a previous post is events. I don't
know much about WMI events but it might be another possibility.

Another possibility probably is to write a service, or a program that can be
used as a service. I assume that (with proper privileges) a service could
show a message or can create an interactive process. When using a service,
though, would require a lot of design time to ensure good security. Also,
using a service, most of the solution would not use WMI; WMI would be used
just to communicate with the service.

I know there is existing software for showing messages within a network so
probably one of them would be a better solution for the original question
here.
 
M

Manfred Braun

Hi All,

I read this question many times and I have also posted an answer in the WMI
newsgroup a long time ago.

Just to bring my point:An admin has really MANY needs to display messages on
remote computers [in mayn times, on all of them at the same time] and there
is noting like this in Windows and the messenger service is often disabled
but also is not the right tool, because it cannot provide enough text and
the user simply clicks it away. Admin usually avoid sending popups, but
there are a lot of situations, were ir cannot be avoided.

Remote processes, with WMI on pure WSH based, do not have the necessary
rights to interact with the current users desktop. You must run as a service
application as local service and enable "interact with desktop". Most admin
are not able to create their own services, but the .Net runtime makes this
easy.

The scheduler service would alo work, because one can create a task and then
just run it. But there is no scriptable interface to do that and that was
completely overseen by WMI :-(
Users of the Siteserver Resource Kit have a scriptable scheduler service
interface, but this is not publicly available.

Mostly overseen, COM is your best friend!!! A COM component can be running
under the "interactive user" and this helps solving the problem. Such a
component may also easily be written in script, known as a script component
and stored in a file of type ".wsc". Write a simple component like I try to
demonstrate it here in a very short [and untested example], look for it at
the end. If this component has a method "ShowUrl(url)" you can write another
script, which uses this component like usual, for example:

Option Explicit

Set objTool = CreateObject("MBG.Tools-IE3")
objTool.ShowUrl "http://www.google.com" 'OK, dont do it like
this, --spam ;-)

WScript.Quit(0)

This script can be executed locally, no problem, but also remotely, if ithe
component is registered with the COM+ catalog, see later. I prefer WMI to
run scripts on remote machines, because I can set credentials. If the shown
script will be executed via WMI it would runs on the executing users [the
remote users] desktop and a message-box and something like this is displayed
on this hidden desktop. But the moment, the script instantiates the show
"MBG.Tools-IE3" helper object, this runs in the desktop of the interactive
user and is really visible. I use such a component to display one of it's
two "build-in" dialogs, one for short notifications and one as a
setup-progress dialog. The sample above could be enough to popup Internet
Explorer and direct it to the admin message provided by an intranet page.

On the other hand, this component must be present on each computer, on which
such a notification has to be displayed. This is not too complicated. Write
the component and test it properly. Go to the COM+ catalog and create a new
empty COM+ server application. Configure it to run as the interactive user.
Then, in that application import your script component. After it is
importet, test it again. This component MUST be registered in COM+ to be
usable in the show way. COM+ also provides more help:Go to the COM+ console
again and export the application. This generates a MSI file, which is very
good for installations. Then use one of the better known WMI script to
install this msi file on all your computers remotely, no walking ;-)

This is not very dangerous from the virus-danger perspective, a virus will
usually not know your COM interface becasue it is not public [hopefully]. I
have otherwise not addressed security here.

Hope, this helps. If there are more questions, I hope, I can answer them.
Best regards,
Manfred Braun

(Private)
Mannheim
Germany

mailto:[email protected]
(Remove the anti-spam-underscore to mail me!)

web http://www.manfbraun.de


Sample component

<?xml version="1.0"?>
<component>

<registration
description="MBG.Tools-IE3, MBG tools for IE."
progid="MBG.Tools.IE3"
version="0.0"
classid="{814C0D17-32A5-11D5-9274-008048849629}"</registration>

<public>
<method name="ShowUrl"/>
</public>

<script language="VBScript">
<![CDATA[

Option Explicit

Sub ShowUrl(ByVal url)

Set objIE = CreateObject("InternetExplorer.Application") 'Create IE
object.
objIE.top = 40
objIE.left = 40
objIE.width = 200
objIE.height = 400
objIE.resizable = False
objIE.ToolBar = False
objIE.MenuBar = False
objIE.AddressBar = False
objIE.Visible = True
objIE.Navigate2 url

End Sub

]]>
</script>

</component>
 
R

Randy Birch

If you want an API solution, see either
http://vbnet.mvps.org/code/network/netmessagebuffersend.htm or
http://vbnet.mvps.org/code/network/mailslotbroadcast.htm . Remember that the
target system has to have the Messenger service running to receive the
message.

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
----------------------------------------------------------------------------



: : >
: > Maybe you can create an scheduled task on the remote computer, and
: > configure it to interact with the desktop.
:
: I did do a reasonable amount of searching on the subject. I did find a
post
: from someone with a sample of using the Task Schedulre in that manner. I
: chose not to use the solution but if someone is interested, it is worth
: searching for.
:
: Another possibility that I mentioned in a previous post is events. I don't
: know much about WMI events but it might be another possibility.
:
: Another possibility probably is to write a service, or a program that can
be
: used as a service. I assume that (with proper privileges) a service could
: show a message or can create an interactive process. When using a service,
: though, would require a lot of design time to ensure good security. Also,
: using a service, most of the solution would not use WMI; WMI would be used
: just to communicate with the service.
:
: I know there is existing software for showing messages within a network so
: probably one of them would be a better solution for the original question
: here.
:
:
 
M

Manfred Braun

Hi Randy and All,

one can also use the messenger service directly from script, see the
following:

'mbWshMailslotDemo1.vbs

Option Explicit

Dim oFSO, oTS, oNet
Dim sFN

Set oNet = CreateObject("WScript.Network")
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

'Define mailslotname
sFN = "\\m1\MAILSLOT\messngr"

'for broadcasts:
'sFN = "\\*\MAILSLOT\messngr"

'Object Text Stream:
Set oTS = oFSO.CreateTextFile(sFN, True)

'Format:
'<msgFrom>0<msgTo>0<msgText>0

WScript.Echo "mbWshMailslotDemo1" & oNet.Computername & "Test!"
oTS.Write "mbWshMailslotDemo1" & chr(0) & oNet.Computername & chr(0) &
"Test!" & chr(0)
oTS.Close

So for using the messenger service, external components could be avoided.

Best regards,
Manfred Braun

(Private)
Mannheim
Germany

mailto:[email protected]
(Remove the anti-spam-underscore to mail me!)

web: http://www.manfbraun.de/
 
G

Guest

If your users are using Terminal Services you can use NET Send or something
similar to pop up a message or there are a number of freeware utilities to
send a message over a network.
 
D

David F. Schrader

As one who "just arrived" and read through these messages
(ignoring the Beta-ware sidetrack which didn't really apply
to the messaging issue per se) I'd like so say that the real
way that any messaging system should be implemented is
within the hierarchy of the ACL structure(s).

If the whole system had been thought out logically then
there would (have) be (been) ACL(s) at every level from
the top (Domain/Enterprise) down (server/group/OU)
which would allow messaging between legitimate any
or all legitimate members of specific "units and it would
be controlled by ACL. There wouldn't be any mis-use of
the messaging utilities because they would *validate*
before sending.

But that's the dream. An even better dream would be if
everyone was "honest" and believed in the "do unto
others" value system so we wouldn't have to worry about
viruses any longer. I'm still looking for a good "apple
pie" to go with my dream messaging system. I have a
feeling I'll find them in the same place.

David

P.S. I've been looking into creating my own "MSAgent"
that can be scripted to issue whatever message(s) I
need sent and locking it down with my own ".dll"s
that will do it's own validation checking via a service.
Haven't gotten much done yet because of the limits
MSAgent puts on the their characters. dfs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top