In order to make the program visible in the desktop, i create another
vbscript in the remote PC. However, there is no response in the remote
PC. May i know any wrong to the scripts below?

remote vbscript
-----------------------
Option Explicit
Dim strProgram, strComputer, objWMIService, arrProcess, objProcess,
objProgram, intSleep, strShell

strProgram = "calc.exe"
strComputer = "."
intSleep = 15000

set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")


set arrProcess = objWMIService.ExecQuery("Select * from Win32_Process")

For Each objProcess in arrProcess
if(objProcess.Name = strProgram)then
objProcess.Terminate()
end if
Next

WSCript.Sleep intSleep

set objProcess = objWMIService.Get("Win32_Process")
set objProgram =
objProcess.Methods_("Create").InParameters.SpawnInstance_
objProgram.CommandLine = strProgram
set strShell = objWMIService.ExecMethod("Win32_Process", "Create",
objProgram)

WSCript.Quit

local script
------------------
Dim sScriptName, sComputerName, oWmi, oWmi_Process, objSWbemLocator

sScriptName = "D:\t.vbs"
sComputerName = "abc"

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set oWmi = objSWbemLocator.ConnectServer(sComputerName, "root\cimv2",
"abc", "a", "MS_409", "NTLMDomain:WORKGROUP")

Set oWmi_Process = oWmi.Get("Win32_Process")
oWmi_Process.Create(WScript.FullName & " " & sScriptName)

WSCript.Quit

Re: Call remote vbscript by Michael

Michael
Sat Dec 09 15:10:38 CST 2006

clteh9@gmail.com wrote:
> In order to make the program visible in the desktop, i create another
> vbscript in the remote PC. However, there is no response in the remote
> PC. May i know any wrong to the scripts below?
>

Win32_Process.Create method [WMI]
<http://msdn.microsoft.com/library/en-us/wmisdk/wmi/create_method_in_class_win32_process.asp?frame=true>

"...
For security reasons the Win32_Process.Create method cannot be used to start
an interactive process remotely.
..."


> remote vbscript
> -----------------------
> Option Explicit
> Dim strProgram, strComputer, objWMIService, arrProcess, objProcess,
> objProgram, intSleep, strShell
>
> strProgram = "calc.exe"
> strComputer = "."
> intSleep = 15000
>
> set objWMIService =
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
>
>
> set arrProcess = objWMIService.ExecQuery("Select * from
> Win32_Process")
>
> For Each objProcess in arrProcess
> if(objProcess.Name = strProgram)then
> objProcess.Terminate()
> end if
> Next
>
> WSCript.Sleep intSleep
>
> set objProcess = objWMIService.Get("Win32_Process")
> set objProgram =
> objProcess.Methods_("Create").InParameters.SpawnInstance_
> objProgram.CommandLine = strProgram
> set strShell = objWMIService.ExecMethod("Win32_Process", "Create",
> objProgram)
>
> WSCript.Quit
>
> local script
> ------------------
> Dim sScriptName, sComputerName, oWmi, oWmi_Process, objSWbemLocator
>
> sScriptName = "D:\t.vbs"
> sComputerName = "abc"
>
> Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
> Set oWmi = objSWbemLocator.ConnectServer(sComputerName, "root\cimv2",
> "abc", "a", "MS_409", "NTLMDomain:WORKGROUP")
>
> Set oWmi_Process = oWmi.Get("Win32_Process")
> oWmi_Process.Create(WScript.FullName & " " & sScriptName)
>
> WSCript.Quit

--
Michael Harris
Microsoft MVP Scripting