VBScript Clean MediaPortal Exit needed (1 Viewer)

yogi_bear_79

Portal Member
January 15, 2009
16
0
Home Country
United States of America United States of America
I frequently admin my HTPC via RDC. I'm looking for a clean VBScript way of shutting down MediaPortal if it is running when I connect via RDC.

Basic concept would be, call the VBScript from the RDC client under the Programs tab, "Start the following program on connection"

My reasoning is, since RDC is only capable of supporting 16-Bit Colors MediaPortal doesn't react well when I RDC in.

I tried this, which works, but causes MediaPortal to start the crashed unexpectedly window:

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

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'MediaPortal.exe'")

For Each objProcess in colProcessList
objProcess.Terminate()
Next

Well, I got my Dameware working and it supports 32Bit, so Soultion in't really needed, unless others need it.
 

Pascal

Portal Pro
February 1, 2007
99
7
IJsselmuiden
Home Country
Netherlands Netherlands
Hi,

Please try next script, it ends mediaportal with me without errors:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "tskill Mediaportal", 0, true


Good luck,

Pascal
 

Users who are viewing this thread

Top Bottom