AhmedIlyas
Tue Oct 10 19:33:02 CDT 2006
I'll try to give this a shot sometime, thanks very much!
I'm actually trying to integrate this into .NET (C#) so, see how it goes.
Just hope that if the user is logged in and I run this script that it will
show that program to the user on their screen as if by magic!
"Richard Mueller" wrote:
> Ahmed Ilyas wrote:
>
> > Thanks but is there no way of doing it IN WMI?
>
> You can use SWbenLocator. Of course, you must know the username/password.
> Example below that runs Windows Explorer on the remote computer:
> =================
> Option Explicit
>
> Dim strComputer
> Dim strUser
> Dim strPassword
> Dim objSWbemLocator
> Dim objSWbemServices
> Dim objProcess
> Dim intReturnCode
>
> strComputer = InputBox("Enter remote computer name", "RunRemote")
> strUser = InputBox("Enter user name on remote computer", "RunRemote")
> strPassword = InputBox("Enter password", "RunRemote")
>
> Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
> Set objSWbemServices = objSWbemLocator.ConnectServer _
> (strComputer, "root\cimv2", strUser, strPassword)
>
> Set objProcess = objSWbemServices.Get("Win32_Process")
>
> intReturnCode = objProcess.Create("explorer.exe")
> If (intReturnCode <> 0) Then
> Call MsgBox("Failed to start Explorer")
> Else
> Call MsgBox("Explorer started on remote computer")
> End If
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> Hilltop Lab -
http://www.rlmueller.net
>
>
>