Powerscheduler with Server/Client system (3 Viewers)

frenchi38

Portal Member
January 22, 2006
8
3
62
Grenoble - France
Home Country
France France
After having installed the MediaPortal TV Server (dear development team: A great bravo and thank you for your outstanding work) I touched the problem that I have to keep my server switched on 24 hours/day, 7 days/ week, while I need it only a few hours per day. Looking in the Powerscheduler, I saw that this one can only handle a single seat configuration, but not my config with 1 server and 4 clients.

So I was searching for a work-around, and I wanted to share with you what I have installed (and for me it’s running fine).

Idea was to use the possibility of the Powerscheduler which is integrated in the TV Server to check for running processes. This means that every client has to start his own process on the server when he is logging in, and kill this process when he is logging out.


Sample-configuration :
Server: PC250
Client 1: PC001
Client 2: PC002
Client 3: PC003

We need to download two programs (freeware) :
Pstools: http://www.microsoft.com/technet/sysinternals/utilities/pstools.mspx
wolcmd: http://www.depicus.com/download.aspx?product=commandline

Out of the PsTools we need only the programs PsExec and PsKill.
The program wolcmd is for waking up the server from hibernate or suspend.

For each client we create a unique exe file in this directory of the Server. For this we can take any Windows program which can be executed in several instances in parallel, no functionality is needed, we need only processes. A simple one is calc.exe (you can find it in the \system32\ folder), or use this wonderfull attached program (client1active.exe) which I have written during long hours (1 line source-code) which only right to exist is to exist. It’s doing nothing but waiting for being killed (your can “kill” it with any key). For each client you create a new copy:
Client1: Client1active.exe
Client2: Client2active.exe
Client3: Client3active.exe
Etc.

These files you locate in your Powerschedule directory of the Server (let’s say “F:\PowerScheduler”).
Now you have to create a batchfile for each program:

Client1active.bat:
START /min client1active.exe

Client2active.bat:
START /min client2active.exe

Etc.

Having done this we have to integrate these processes in the Powerscheduler as processes which prevent the system to enter in standby. (For this the processes has to be started.)

Finally you have to create a new user on the server. Let’s call him “client” and give him a password (password is needed, because Win XP does not allow remote access without password).


On each Client you create a start directory for MediaPortal on your Clientcomputer :
“C:\MPStart\”
In this directory you copy your program PsExec, PsKill and wolcmd and create a batchfile to start MediaPortal (MPStart.bat):

wolcmd [mac address] [ip address] [subnet mask] [port number]
psexec \\pc250 -u client -p password -i F:\powerscheduler\clientxactive.bat
"C:\Program Files\Team MediaPortal\MediaPortal\MediaPortal.exe"
pskill \\pc250 -u client -p password clientxactive.exe"

pc250 is the name of the server
password is the password of the user “Client” on the server.
the x has to be replaced by the number of the client
the “F:\Powerschedule\” has to be the directory you’ve created above.

That’s all: instead of starting MeadiaPortal directly, you start the batchfile, which is starting the Server, starting on the server the clientxactive process and starting MediaPortal afterwards.
The Server is staying awake till we kill the process clientxactive, which will be done when you close Mediaportal on the client.

Only open problem remains a dedicated MediaPortal client, on which MediaPortal is running permanently and for stopping the computer is send to hibernate only. For this configuration the above procedure does not work. Here we need a smart little program called

Hibernate Trigger: http://www.rpi.edu/~desimn/suspendtrigger/
The wonderful program is executing commands before entering in hibernation (or suspend) and when waking up from hibernation (or suspend).

We create a small batch called afterhibernate.bat:

C:\mpstart\wolcmd [mac address] [ip address] [subnet mask] [port number]
C:\mpstart\psexec \\pc250 -u client -p password -i F:\powerscheduler\clientxactive.bat

And another one called beforehibernate.bat
C:\mpstart\pskill \\pc250 -u client -p password clientxactive.exe"

And these batches we are putting in the adequate places of Hibernate Trigger and it’s done.

Enjoy.
 

Skar29

Portal Pro
April 25, 2006
269
1
Munich
Home Country
Germany Germany
Hi,

works great, i only have one problem:

after wol the server starts but isnt fast enough. so the psexec command fails. How can make a pause or wait between wolcmd and psexec?


wolcmd [mac address] [ip address] [subnet mask] [port number]
psexec \\pc250 -u client -p password -i F:\powerscheduler\clientxactive.bat

Cheers

Skar
 

vernado

Portal Pro
December 2, 2006
172
0
Home Country
Germany Germany
Hi frenchi38,
thank you for your solution and description.
Regrettably i have a little problem:
WOL works fine, but couldn`t access the server PC.
I can not start the client1active.bat
No firewall is activ.
I use Port 7.

Have you a Idea?

Regards

Vernado
 

Juppe

Portal Pro
November 17, 2006
315
45
Home Country
Sweden Sweden
Hi vernado, what OS do you use, do you also have winxp home?
In that case I dont think it will work to start a program on a remote computer with PsExec. I may be wrong but I have search the net for a solution, but couldn't find any, so I made a little program for the server instead, that looks if any of the clients is on, in that case the server stays awake, but this is not so good if the clients aren't dedicated clients. On the clients a use wolcmd to wake the server and then the server looks for the clients every x minutes and as long as there is a client present the server stays awake.
If you're interested in this program let me know.

/Juppe
 

vernado

Portal Pro
December 2, 2006
172
0
Home Country
Germany Germany
Hi Juppe,
i use WinXPMCE is like XpPro.
I am very interesting in you solution.
Regards

Vernado
 

Juppe

Portal Pro
November 17, 2006
315
45
Home Country
Sweden Sweden
I'm at work right now, so I will put up the program later today, when I'm at home.
 

Juppe

Portal Pro
November 17, 2006
315
45
Home Country
Sweden Sweden
Here is the program.
I will try to describe how to use it.
Place that program and ClientXActive.exe (from the first post here) ,but rename it to ClientActive.exe, in same folder and make a batch file.

START /min ClientCheck.exe [X] [ClientName1] [ClientName2]

X is the number of minutes between the check for clients, dont make this larger than the minutes that you have in powerscheduler.
ClientName1 is the name of one of the clients that shall keep the server alive.
There can be how many clients that you want, I havent checked with more than 2, but it should work with more.
Remember to put ClientActive.exe as a process in powerscheduler.

Change the name to .exe, its not a zip file.
I think thats all, let me know how it works and if you get any problem.
/Juppe
 

vernado

Portal Pro
December 2, 2006
172
0
Home Country
Germany Germany
Hi Juppe,
Thanks.
What does the ClientCheck.EXE do?
And how do you start the Server? Is is right that you doesnt need the PsExec.
That looks fine, because the PsExec dont work good.
I hope i can test it this evening.

Regards

Vernado
 

Users who are viewing this thread

Top Bottom