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