Manfred
Thu May 26 16:56:23 CDT 2005
Hi All,
that not very easy, but IT IS POSSIBLE at all, ok, not for the faint of
heart ;-)
I posted the answer several times and I'll try to recap the necessary steps.
1) Create a COM component in scripting
this is a file with extension *.wsc
Write a simple class, which automates Internet Explorer
[using Set objIE = CreateObject("InternetExplorer.Application")]
and provide in minimum a simple method to output a string to IE with
a method
of this class; It is out of my scope to provide an implementation
here.
2) Create a second script, which instantiates the component from 1)
and write some output to IE, just to see, that this works.
3) Go to "Component Management Console" and create a new
empty Library Application.
Import the component, created in 1)
Configure this application to run under the authority of
the interactive user [this is the most importent step at all]
Export the complete application, this will create a MSI file.
4) Install that MSI file on the "remote computer", which should later
display the messages. It is also possible to install remotely
using WMI, so no turn-pikes are necessary ;-)
5) Copy the test-script, used in step 2) to the remote machine.
6) Create a [remote] process on the target machine, which
uses the script from step 2) as a local resource.
That all is not very easy and requires some work, but it does the trick.
One has to take into account - in script from step 2) - that, if there
is no user logged on on the remote box, the instantiation of the component
fails. The importent thing to understand is, that COM manages the
impersonation from the process/thread, running the script via WMI as the
remote user, to the local interactively logged in user.
I am not too sure about how secure this solution is. I THINK, there is not
a big problem, because there is no way from the running IE/component back
to the script executed by an remote admin. And naturally, this should not
be coded inside the component!
Hope, this helps. I am sorry, I cannot provide the complete infrastructure
for this.
Best regards,
Manfred Braun
(Private)
Mannheim
Germany
mailto:_manfred.braun_@manfbraun.de
(Remove the anti-spam-underscore to mail me!)
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:%23J5Q$KhYFHA.2756@tk2msftngp13.phx.gbl...
> Devron Blatchford wrote:
>
> > this script to popup notepad on the remote XP
> > screen, it will start the Notepad.exe process but will not make the
window
> > visible. can anyone help?
> >
> > Thanks
> >
> > Const WINDOW_STATE = 5
> > strComputer = "RemoteMachineName"
> >
> > Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
> > & strComputer & "\root\cimv2")
> > Set objStartup = objWMIService.Get("Win32_ProcessStartup")
> > Set objConfig = objStartup.SpawnInstance_
> > objConfig.ShowWindow = WINDOW_STATE
> > Set objProcess =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
> > strComputer & "\root\cimv2:Win32_Process")
> > errReturn = objProcess.Create("Notepad.exe", null, objConfig,
intProcessID)
> Hi,
>
> Sorry, that is not possible with the Win32_Process.Create method...
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
>
http://www.microsoft.com/technet/scriptcenter/default.mspx