home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Support
Installation, configuration support
MP Kill&Restart command?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Eso Rimmer" data-source="post: 398473" data-attributes="member: 84454"><p>Ok, so after some tries and errors I put together script which seems to work OK on my <strong>Vista x64</strong>. It just kills mediaportal.exe, waits 5 seconds and then runs mediaportal.exe again. You can change the waiting time on line "WScript.Sleep 5000 ". Maybe it will help someone:</p><p></p><p>[CODE]Option Explicit</p><p>Dim objWMIService, objProcess, colProcess, objCalc</p><p>Dim strComputer, strProcessKill, strShell, objProgram, strExe</p><p>strComputer = "."</p><p>strProcessKill = "'mediaportal.exe'" </p><p>strExe = "mediaportal.exe"</p><p></p><p>Set objWMIService = GetObject("winmgmts:" _</p><p>& "{impersonationLevel=impersonate}!\\" _ </p><p>& strComputer & "\root\cimv2") </p><p></p><p>Set colProcess = objWMIService.ExecQuery _</p><p>("Select * from Win32_Process Where Name = " & strProcessKill )</p><p>For Each objProcess in colProcess</p><p>objProcess.Terminate()</p><p>Next</p><p></p><p>WScript.Sleep 5000 </p><p></p><p>' Obtain the Win32_Process class of object.</p><p>Set objProcess = objWMIService.Get("Win32_Process")</p><p>Set objProgram = objProcess.Methods_( _</p><p>"Create").InParameters.SpawnInstance_</p><p>objProgram.CommandLine = strExe </p><p></p><p>'Execute the program now at the command line.</p><p>Set strShell = objWMIService.ExecMethod( _</p><p>"Win32_Process", "Create", objProgram) [/CODE]</p></blockquote><p></p>
[QUOTE="Eso Rimmer, post: 398473, member: 84454"] Ok, so after some tries and errors I put together script which seems to work OK on my [B]Vista x64[/B]. It just kills mediaportal.exe, waits 5 seconds and then runs mediaportal.exe again. You can change the waiting time on line "WScript.Sleep 5000 ". Maybe it will help someone: [CODE]Option Explicit Dim objWMIService, objProcess, colProcess, objCalc Dim strComputer, strProcessKill, strShell, objProgram, strExe strComputer = "." strProcessKill = "'mediaportal.exe'" strExe = "mediaportal.exe" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colProcess = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = " & strProcessKill ) For Each objProcess in colProcess objProcess.Terminate() Next WScript.Sleep 5000 ' Obtain the Win32_Process class of object. Set objProcess = objWMIService.Get("Win32_Process") Set objProgram = objProcess.Methods_( _ "Create").InParameters.SpawnInstance_ objProgram.CommandLine = strExe 'Execute the program now at the command line. Set strShell = objWMIService.ExecMethod( _ "Win32_Process", "Create", objProgram) [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
Installation, configuration support
MP Kill&Restart command?
Contact us
RSS
Top
Bottom