View Single Post
Old Sep 1st, 2004, 8:53 AM   #4
FoCaL
Newbie
 
Join Date: Aug 2004
Location: St. Louis
Posts: 4
Rep Power: 0 FoCaL is on a distinguished road
Send a message via MSN to FoCaL
This is the code that starts the process. However it does start in the background with this code. This code does work correclty.
strComputer = "testsvr90"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create("C:\FHN\current.ppt", null, null, intProcessID)
If errReturn = 0 Then
	Wscript.Echo "Power Point was started with a process ID of " & intProcessID & "."
Else
	Wscript.Echo "Power Point could not be started due to an error " & errReturn & "."
End If


This is the modified code thats supposed to let it start in the forground. This code does NOT work correclty. I get an error return or 'Error 8'
const ShowWin = 5
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\testsvr90\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = ShowWin
Set objProcess = GetObject("winmgmts:{impersonationLevel=impersonate}!\\testsvr90\root\cimv2:Win32_Process")
errReturn = objProcess.Create("C:\FHN\POWERPNT.EXE", Null, Null, intProcessID)
If errReturn = 0 Then
	Wscript.Echo "Power Point was started with a process ID of " & intProcessID & "."
Else
	Wscript.Echo "Power Point could not be started due to an error " & errReturn & "."
End If

edit: I just got the second code to work without returning an error. However, it still start Power Point on the remote machine as a brackground process and you can only see power point running in task manager.
FoCaL is offline   Reply With Quote