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
MediaPortal 1 Plugins
MyTorrents
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="riro" data-source="post: 274152" data-attributes="member: 56859"><p>Ok, a bit longer script this time... VBScript to check a remote host if the process is running, and if not use PsExec to start it.</p><p></p><p>Find PsExec here <a href="http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx" target="_blank">PsExec</a></p><p></p><p>[code]</p><p>Option Explicit</p><p>Dim oWmi, oProcess, oProcesses, oShell</p><p>Dim strList, bIsRunning</p><p></p><p>Const cComputer = "MYOTHERCOMPUTER"</p><p>Const cProcessName = "uTorrent.exe"</p><p></p><p>bIsRunning = False</p><p>Set oWmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & cComputer & "\root\cimv2")</p><p></p><p>Set oProcesses = oWmi.ExecQuery ("Select Name from Win32_Process where Name = '" & cProcessName & "'")</p><p>For Each oProcess In oProcesses</p><p> bIsRunning = True</p><p>Next</p><p></p><p>If bIsRunning Then</p><p> WScript.Echo cProcessName & " is running..."</p><p>Else</p><p> WScript.Echo cProcessName & " isnt running, starting process on " & cComputer</p><p></p><p> Set oShell = CreateObject("WScript.Shell")</p><p> oShell.Run "psexec \\" & cComputer & " -u Username -p p@s5w0rd -d -i X:\mypath\to\uTorrent.exe", 1, False</p><p>End If</p><p></p><p>WScript.Quit</p><p>[/code]</p><p></p><p>I havnt tested the code...</p><p></p><p>So the cmd-script should look something like:</p><p></p><p>[code]</p><p>cscript.exe theNewVbScript.vbs</p><p>copy %1 \\server\autloadpath</p><p>[/code]</p></blockquote><p></p>
[QUOTE="riro, post: 274152, member: 56859"] Ok, a bit longer script this time... VBScript to check a remote host if the process is running, and if not use PsExec to start it. Find PsExec here [url=http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx]PsExec[/url] [code] Option Explicit Dim oWmi, oProcess, oProcesses, oShell Dim strList, bIsRunning Const cComputer = "MYOTHERCOMPUTER" Const cProcessName = "uTorrent.exe" bIsRunning = False Set oWmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & cComputer & "\root\cimv2") Set oProcesses = oWmi.ExecQuery ("Select Name from Win32_Process where Name = '" & cProcessName & "'") For Each oProcess In oProcesses bIsRunning = True Next If bIsRunning Then WScript.Echo cProcessName & " is running..." Else WScript.Echo cProcessName & " isnt running, starting process on " & cComputer Set oShell = CreateObject("WScript.Shell") oShell.Run "psexec \\" & cComputer & " -u Username -p p@s5w0rd -d -i X:\mypath\to\uTorrent.exe", 1, False End If WScript.Quit [/code] I havnt tested the code... So the cmd-script should look something like: [code] cscript.exe theNewVbScript.vbs copy %1 \\server\autloadpath [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
MyTorrents
Contact us
RSS
Top
Bottom