Media Soup

Part I - About
Part II - Components
Part III - Hardware
Part IV - System
Part V - Server
Part VI - Client
Part VII - Miscellaneous
Part X - Examples

 

Part IV - System

1. VirtualBox MediaServer
2. OS
3. Codecs
4. Organize
5. Service Names
6. Stuff that won't run as a service
7. Power management
8. VNC


1. VirtualBox MediaServer
 

This page was put together 'over time' so 'some assembly may be required'. Typically, I keep notes for my own use. Then I'll rearrange them a bit, add some random rambling and throw it on the net. If you have a decent knowledge of your OS, you might be better of starting with the server and client pages...

First a warning for those interested in running virtual machines:

Running HTPC's or media servers in a virtual machine is asking for problems.

That's mostly due to lack of video support, or some weird and unpredictable behaviour of some applications. You probably want to skip this section and immediately go for the real thing, that is: get yourself a decent PC and turn it into a dedicated server.

Oh well, you have been warned. Read on...
 

Hardware.

None. (Well, okay, a box to run VirtualBox on :-))
 

Software.

  1. Install VirtualBox.
  2. Create or clone a new VM.
  3. I use at least 256 MB as memory setting for the VM after earlier experiments with XP on low end machines.
  4. Enable VirtualBox's 3D capabilities and set the VM's video memory to 32 MB.
  5. Set network to 'bridged'.
  6. Clone a VDI and run NewSid, or create a new VDI and install XP.
  7. Name this machine MEDIASERVER with a fixed ip address such as example 192.168.0.72.
  8. Create a new user in Windows XP called 'Media' password 'media'.
  9. Create a few folders, to keep things organized.
  10. Make sure the user 'Media' can access these folders.
  11. Copy some files to these folders so we have something to test with.
  12. Check the firewall settings.
Note: I had quite some troubles copying large (amounts of) files from the host directly to the client in one batch. Perhaps I was expecting a bit too much from the virtual machine :-)

After installing and setting up your OS it's time to install all other software... Try and test one application at a time, don't go wild!


2. OS
 

If (when!) I fall in some specific trap OS related I'll add some notes here.


Windows

2009 Windows XP SP3

Ah, my favorite OS to date. Works well, though it's nearing end-of-life. It isn't free and you probably can't even buy it anymore. But it does work on not-the-latest hardware, with some effort :-)

Alas, Windows XP is almost dead (no more patches / updates from April 2014) and you can't buy it anymore, so it's time to look around for something newer.

Windows Vista

I cannot say anything posoitive about Vista, just skip it. It's like the 32 bits version of Windows ME.

Windows 7

You may consider Windows 7 (if you can still obtain a copy) but be aware that you might not be able to run it on onder hardware due to lack of drivers. And updates will stop in January 2020.

Windows 8

Then there's the beast called Windows 8. The Metro interface is horrible, and there are some other limitations, but unless you go for Linus it just might be your only chance... I'm going to try to upgrade my home server (currently running XP) to Windows 8, and see how things go from there.

As I started out with Windows XP, I'll focus on any major differences and add them. I don't expect too many, but still...

Windows 10

Take Windows 8, remove Privacy and add enforced updates... that's Windows 10. I'm especially worried about Windows 10 screwing up older systems by involuntary driver replacements. Microsoft should at least allow us to block driver updates, please! Anyway, if you want to run Windows it's the only game left in town...

Unfortunately, my experience with running Windows 10 Home on a home server has been... interesting...

Some notes:

1. Windows 10 by default did not differentiate between active and inactive windows in regards to the tile bar of a window. You migt see a thin line of a different colour surrounding the bar, but that's about it.

  1. RMB on deskop
  2. Personalise / Colours
  3. pick an accent colour
  4. Transparency effects seem to only affect the task bar (?) so set to taste
  5. Enable 'Show the accent colour' for 'Title bars'
2. There are tons of privacy settings to wipe. As they keep moving around check out the Internet where to find them, and what they do.

3. To have easier access to user accounts create a shortcut to:

netplwiz
4. Some options are easier to access from the Windows 10 settings, some via the old control panel. A direct link to Windows 10 settings:
ms-settings:
5. Same thing for the classic control panel:
%windir%\system32\control.exe
6. This is also where you find the old time favorites like naming your PC, set visual effects, virtual memory, environment variables and system protection.

7. Modify environment variables if you like all temp files together, and want to include some folder containing batch files or utilities whenever you go fancy and use the command line...

  1. create a folder C:\TEMP
  2. create a folder C:\temp\admin
  3. create a folder C:\temp\system
  4. go to Control Panel / System / Advanced System Settings / Environment Variables
  5. change user TEMP variable to C:\temp\%username%
  6. change system TEMP variable to C:\temp\system
  7. add paths to PATH variable, for example C:\software\batch and C:\software\utils
8. There is no direct acces to the startup folder, but it still works and you can find it here:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
9. Allow ICMP PING
  1. Control Panel / Network & Sharing / Windows Firewall / Advanced Settings / Inbound Rules
  2. Enable "File and Printer Sharing Echo Request ICMP4 In"
10. If you are using Kodi on an Android tablet as a client then you may run into timeout errors when trying to connect over SMB. This is due to an non-installed Windows component. Go to Control Panel / Programs and Features / Turn Windows features on or off. In the list enable SMB 1.0/CIFS Server. Note that this is a security risk as the old SMB protocol is no longer safe (but if it matters on a home server is for you to decide).
Note: allowing SMB1 will reduce security of your server, as SMB is no longer considered secure!
11. Some options of Windows have been removed / hidden for the average user. Bring them back using WinAero tweaker. I immediately change the following:
  1. set Advanced Appearance Settings / Icons / Horizontal Spacing to 100
Windows 8 and Windows 10 settings are a complete mess...


Linux.

Don't ask. I'm pretty much a Windows guy, but I may be forced to go the Linux way... sigh... Will be continued once I'm either comfortable enough, or can no longer affort Windows. I would have switched to Linux a long time ago, but some of the apps I run simply don't work on Linux, and / or I have not found any alternatives yet. Still, things may improve down the line.

Update. I've decided to put some more time in Linux, as I'm fed up with Windows 10's power management. I'll return my homeserver to Windows 7, and replace it and 2019 with Linux. Good riddance, Windows 10.


3. Codecs
 

Only install a codec pack if you need one.

I've been using the CCCP for a while, the Combined Community Codec Pack. You'll find it here: http://www.cccp-project.net. There are other packs, and the last release of for example TVersity seems to include one itself, though I haven't tried it.

Make sure your codec pack works well on your OS and hardware. I'm still using CCCP, even on my 64 bit Windows 7 box, but there are many horror stories around.


4. Organize

Now you've collected hundreds and hundreds of files, but how do you organize them? That depends...

This may seem to be entirely a matter of taste, but there are some things to consider. Some software may offer document management features, some other software may force you to name and tag each and every file, whilst other software simply uses the folder structure to present all files to the end user.

My suggestion is to try and organise your folder / file structure as systematically as possible. Assume your server has two drives, C and D. Drive C would contain the OS and all software, and D would contain all media files. The next step would be to organise your files something like this:

D:\media
D:\media\ebooks
D:\media\kids
D:\media\movies
D:\media\music
D:\media\pictures
D:\media\series
The above works great if you use a single harddisk, but once you end up with a bunch of harddisks, you might adopt something like this:
D:\temp                       - generic temporary folder
D:\temp\admin                 - temporary folder for admin
D:\temp\user                  - user temporary folder
D:\temp\windows               - Windows temporary folder
D:\shared                     - shared between all users, shared as 'shared'
D:\tversity                   - TVersity programm and cache folder
E:\reader_data                - used to store cache and files for ebook readers
E:\reader_data\mobipocket     - mobipocket data files
E:\reader_data\calibre        - calibre database and files
E:\audiobooks                 - audiobooks, shared as 'audiobooks'
E:\books                      - ebooks, comics, shared as 'books'
E:\install                    - software, shared as 'install'
E:\music                      - all music files, shared as 'music'
E:\music\flac                 - all flac files (..\flac\artist - album\..)
E:\music\mp3                  - all mp3 files (..\mp3\artist - album\..)
E:\pictures                   - shared as 'pictures'
E:\video_kids                - kids movies, shared as 'video_kids'
E:\video_kids\dutch           - native dutch / dutch spoken
E:\video_kids\subtitled       - dutch subtitled
E:\video_movies               - all other movies, shared as 'video_movies'
F:\video_anime                - anime series and movies, shared as 'video_anime'
F:\video_other                - other stuff, shared as 'video_other'
F:\video_series               - television series (per name), shared as 'video_series'
F:\video_test                 - test files (weird codecs etc.) shared as 'video_test'
... or whatever piques your fancy...

Next when you set up software like TVersity, you can assign specific names / folders / paths / tags / whatever to each folder. And it would be a good idea to keep 'logical' names as close to the real paths, so accessing material through a logical path would be pretty much the same as accessing it through a file share.

Note that some software does not support a dedicated temp folder, for example TVersity. If you use an SSD or USB drive as your boot device, it may be smart to install TVersity NOT in its default place (under C:\Program Files) but on another drive (D:\TVersity or something similar).

Obviously you may want to consider more than one user, and you may not want your average user to delete or rename your files in which case make sure you give that specific user only Read Only rights.

By organizing stuff from the start, you'll have an easier time finding things back, no matter how you access them. For example, here are some devices browsing my mediaserver, either through TVersity UPNP or Windows shares.

The MyGica media player can access the shares as well as the UPNP (via TVersity) folders:

A Philips TV accessing files on DLNA (TVersity):

A PC (or HTPC) accessing Windows shares:


 

File tags

Some file formats allow you to enter meta data, for exmaple the MP3 file format supports all sorts of tags. Some player software can use the folder structure, but sometimes it can not so you'll be forced to check all tags in your files...

MP3's are the prime candidates for such a treatment. If your folder / file structure is consistent, you could use a program such as MP3Tag to replace the existing tags in your MP3 files.

Some AVI and MKV files seem to support their own flavour of tags, sometimes accessible through file properties, but if not I have no idea how to manipulate them.


5. Service names
 

If you run multiple services on your server, such as TVersity, Servioo, SqueezeServer etc. all these programs allow you to specify a name, under which they can be found on your network. Use sensible names. Here's what I might use on a server on 192.168.0.72:

  • Media72 - this is the regular Windows file server
  • TVersity72 - TVersity DLNA server running on this machine
  • Serviio72 - Servioo DLNA server running on this machine
  • Squeeze72 - Logitech Media Server running on this machine

6. Stuff that won't run as a service


6.1 Windows XP

Many applications won't run as a 'service'. Blame it on Windows, or blame it on the programmer, but fact is a fact. If you want to run some programs, you have to be logged in as administrator. This obviously is a bit of a security risk, especially if you use your server for other purposes as well.

Unfortunately, there's no real and 'proper' solution. All you can do on Windows XP is allow fast user switching, then, on startup, automatically login as a specific user, execute what you need, then return to the login-screen, whilst everything you started keeps running in the background. Who said this was a perfect world?

Anything that would run as a service (and would make sense to run as a service) I set up that way. Everything else I start using a batch file.

Here's what I did:

  1. enable Windows XP fast user switching
  2. use TweakUI to automatically login as a user with administrative rights
  3. create a link to the batch file below under Start / Programs / Startup
Here's my old batch file startup.bat:
  1. rem start "AsrXTY"     /B "C:\Program Files\ASRock Utility\AXTU\Bin\AsrXTU.exe"
  2. psexec                 /d c:\software\batch\calibre_server.bat 
  3. start "SqueezeSlave"   c:\software\squeezeslave\squeezeslave.bat 
  4. start "TinyWeb"        /B C:\software\tinyweb\tinyweb.exe c:\software\homepage 
  5. start "ImageBank"      /B /D"C:\Program Files\ImageBank Server" "C:\Program Files\ImageBank Server\ImageBank Server.exe" 
  6. start "ServeToMe"      /B /D"C:\Program Files\ProjectsWithLove\ServeToMe\" "C:\Program Files\ProjectsWithLove\ServeToMe\servetome.exe" 
  7. start "Serviio"        /B /D"C:\Program Files\Serviio\bin\" "C:\Program Files\Serviio\bin\ServiioConsole.exe" 
  8. start "WallX"          /B wallx adminmark resident 
  9. rundll32.exe user32.dll, LockWorkStation
What it does:
  1. I no longer use this Asrock utility, as it sometimes was messing with my power save settings, something that I still need to work upon
  2. I use a seperate batch file to launch the Calibre content server (see here for the batch file and the use of psexec)
  3. another batch file, this time for SqueezeSlave
  4. TinyWeb provides a little 'intranet' style of page
  5. ImageBank serves the iPad images
  6. and so does ServeToMe for video
  7. Serviio is an alternative for TVersity
  8. load a wallpaper using WallX
  9. then return to the user selection screen (but keep current user logged in)
This 'quickly login, do some stuff, then logout' gave me some troubles with SqueezeSlave, so I modified the squeezeslave.bat file a little to keep it running, no matter what:
tskill squeezeslave
:loop
  c:
  cd c:\software\squeezeslave
  squeezeslave.exe 192.168.0.72 -D -R -m 00:00:00:00:00:72
goto loop
It's possible to fancy up things. By inserting some delays the actual boot time decreases (ie. launching programs do not compete for resources). I also rearranged all windows to have a better quick overview of what's running and what not. And sometimes 'start' works fine, but not always and then I have to fall back on psexec.

Fooling around a bit with cmdow and nircmd (and I wouldn't bother too much with the 'wait' statements, they were just minor improvements, and don't really matter when using Wake On Lan or SSD's...) Here's an example startup batch file:

cmdow @ /TOP
start c:\software\utils\wallx.exe adminmark resident
start "ServeToMe" /B /D"C:\Program Files\ProjectsWithLove\ServeToMe\" "C:\Program Files\ProjectsWithLove\ServeToMe\servetome.exe"
nircmd wait 5000
start "ImageBank" /B /D"C:\Program Files\ImageBank Server" "C:\Program Files\ImageBank Server\ImageBank Server.exe"
nircmd wait 5000
start "iPerf" c:\software\utils\iperf.exe -s
psexec /d c:\software\batch\calibre_server.bat
start "TinyWeb" /B C:\software\tinyweb\tinyweb.exe c:\software\homepage
nircmd wait 5000
cmdow "ServeToMe" /MOV 120 120
cmdow "ImageBank Server 2.3" /MOV 180 180
cmdow "iPerf" /MOV 240 240
cmdow "Calibre Server" /MOV 300 300
cmdow "Watchdog - c:\software\batch\watchdog.bat" /MOV 360 360
cmdow "SqueezeSlave - c:\software\squeezeslave\squeezeslave.bat" /MOV 420 420
rundll32.exe user32.dll, LockWorkStation
The two interesting programs here are mircmd and cmdow.

Nircmd is a kind of all-in-one toolbox, which was many different functions. Including a very simple 'delay' function (which doesn't eat up timeslices).

Cmdow is often blacklisted as a 'hacker tool', just like netcat. Cmdow in itself is simply a little command line tool that allows you to do all sorts of things to Windows. Including moving or hiding them. It has been abused by malware programmers to hide windows from the user, hence the blacklisting.
 

6.2 Windows 7

Of course, since then I've learned a bit :-)

My current startup file looks like this:

rem *** immediately return to user login

rem c:\software\power_shortcuts\wizmo.exe lock
rem timeout 5

rem *** started with windows

rem squeezebox server is started with windows
rem tversity service is started with windows
rem plex server is started with windows
rem openhardwaremonitor is started with windows
rem harddisk sentinel is started with windows, it becomes active after 120 seconds
rem airvideo hd is started with windows
rem servetome is started with windows
rem apple bonjour is started with windows

rem *** not started at all

rem squeezetray requires admin rights, start manually, squeezebox server runs fine without it

rem *** started with this batch file

rem start "Task Manager"          /B taskmgr
rem start "ImageBank"             /B "C:\Program Files\PhotoStreamr Home\PhotoStreamr Home.exe"
rem psexec                        /D c:\software\batch\calibre_server.bat
rem start "TinyWeb"               /B /D c:\software\tinyweb c:\software\tinyweb\tinyweb.exe c:\software\tinyweb\homepage\
start "WallX"                 /B c:\software\utils\wallx adminmark keep resident
rem timeout 20

rem *** reorganize icons and minimize windows

rem C:\software\power_shortcuts\reicon.exe /R
rem nircmd win min stitle "photost"
rem nircmd win min stitle "servetome"
rem nircmd win min stitle "windows task"
rem nircmd win min stitle "calibre"
rem nircmd win max stitle "hardware"
pause


I automatically log in using:

  1. Start netplwiz
  2. Clear 'Users must enter' box
  3. Ok
Keep in mind that I log in to Windows because some programs would not run as services. If you do not have that problem, then it's better NOT to auto-login. However, this machine is 'in the closet', there's no physical access, and nothing on it is of sensitive nature, so even if someone would get access to it I wouldn't be worried.


7. Power management (and Wake On Lan)
 

Power saving is an issue. First, make sure you won't waste too much energy by picking the right hardware...

Skip the next sections if power management is not your thing, and you've got lots of money to burn :-)
 

Concept

You basically want to start the server only when it needs to process or deliver data, otherwise it should be sleeping as much as possible to save energy. Turns out that this isn't always easy... Powermanagement often simply doesn't work, isn't compatible with all hardware, or does other funny things. There's no clear rule, so you're pretty much on your own.

All I can do is talk about some of my experiences, and perhaps they may help you find a solution.

On my test-setup, using a Core i3, 4 GB Ram, on-board audio and graphics, an old power supply and 3 harddrives, I got the following power consumption figures:

  • boot up 100W
  • normal operation 55W
  • hibernate 3W, recover from hibernation 35 seconds
  • standby 5W, recover from standby 10 seconds
This is using regular drives. I should try again using an SSD and a better quality power supply.

Here's the choice: either implement WOL with magic packets, and accept thatyou may have to 'wake up' your server (though it may wake up accidentally), or leave your server up and running all the time. I've calculated my own usage, and I would save 50 euro per year in energy costs by using WOL. Thus, WOL it is.

Update. Hibernate and standby power consumption was primarily caused by an (inefficient) power supply.

WIth other, slightly newer but less powerfull hardware using Windows 10:

  • boot up 80W
  • normal operation 35W
  • hibernate 0.5W, recover from hibernation using WOL not possible
  • standby 1W, recover from standby 3 seconds
  • deep sleep 0.5W, recover from deep sleep 3 seconds


Hardware warning for 'standby'

Remember, once you go into sleep or standby, all your hardware except network card and memory is off. Or is supposed to be off. I've seen a few machines that kept their fans spinning. Sometimes USB ports are powered, sometimes not. Sometimes on-board network cards work, but a PCI or PCIe network card may not recognize a WOL.
 

Hibernation, deep sleep, standby

In hibernation your machine saves all memory to the harddisk, then shuts down.

Older machines could still allow a WOL to wake up as they might keep their network cards / chips under power, but newer machines often DO NOT support WOL in combination with hibernation as they shut down all the hardware. Not all machines like or recover well from hibernation, you have to test this for yourself. Advantage: power outages will not bother your PC (it's off anyway) and power consumption will be the lowest. Disadvantage: slow restart, more wear and tear on your harddrives (well, marginally). Return from hibernation will spin up all your drives, even when not necessary.

Hibernation is considered a warm boot, as the OS does not reload but tries to restore the system.

There's some confusion about deep sleep and standby, as different manufacturers may use different terms. AFAIK: standby shuts down many parts, and deep sleep shuts down even more parts. Some machines may only support one or the other, some support both. If you can use both, you may have to resort to a kill-a-wat power meter to deduce which mode saves you more power.

In standby / sleep mode, your machine doesn't save all memory to harddisk, but instead keeps memory alive and under power, yet shuts down pretty much everything else (except for WOL related stuff, obviously).

How well a machine handles a warm boot (from standby / sleep) varies. Some machines may not re-enable their PCI(e) cards, some drivers may simply fail after a warm boot, or applications might crash. You may lose drives when using PCE(e) SATA or RAID controllers, and you may lose network cards on older OS'es on a warm boot.
 

Power management

These settings depend on your preferences. After fooling around with them I settled for the following settings using Windows 10:

(The exact location / naming schedule depends on your version of Windows, but this should give you a clue where to look.)

  1. Control Panel / Power Options / Tab 'Power Schemes'
  2. set Power scheme to 'Balanced'
  3. Change plan settings
  4. Turn off the display: never (I run a headless system)
  5. Put the computer to sleep: 5 hours
  6. Change advanced power settings
  7. Hard disk / Turn off hard disk disk after 30 minutes
  8. Sleep / Sleep after 300 minutes (aka 5 hours)
  9. Sleep / Allow hybrid sleep: off
  10. Sleep / Hibernate after: never
  11. USB / Selective suspend: enabled
  12. PCIe Express / Link sate power management: Moderate power savings
  13. Multimedia settings / When sharing media: prevent idling to sleep
To quickly test your setup, you may consider changing the workings of your power button and have the server go into standby / sleep whenever you press it. On most machines the power led will then start blinking to indicate standby mode.
 

Windows XP

Things may not work as expected, depending on your hardware and configuration! That out of the way, here's the issue:

  1. XP itself is not the best server platform
  2. there is no way to manually set the 'load' treshold on XP before going into power saving (only 'time' can be set)
  3. many applications cannot be run as a service or need admin rights, so I need to start them as a 'background' user
  4. many applications are (somewhat, ahem) 'inefficient' (running things as Java, .NET, and more will definitely not help with resources)
In other words: this bunch of programs might make XP think it's busy. In some cases I've seen the opposite: load was so light that the server decided to shut down... (Some people are going to tell me that isn't possible, well, I saw it happen myself, so there.)
 

What is WOL?

WOL, WakeOnLan, Wake On Lan... clear as any marketing slide ever... (Check out Don McMillan!)

Most network cards offer two options for wake up: wake up on either a 'magic packet', or wake up on any traffic.

By sending a special message to your server you can switch it on. This message is a so called 'magic packet'. If your server supports 'power saving' modes (stuff called S3, S4 etcetera) and your network card supports WOL you can wakeup your server whenever it's needed.

You could opt for waking up the server on any traffic, but for all practical purposes that means your server keeps waking up all the time. Thus never goes to sleep. If you have a configurable router (instead of the typical dumb switch) you might try that approach. For most people though it is not an option, because other systems in the network keep pestering your server with requests, thus waking it up all the time, even if those other systems don't need any actual data.

When you are trying to wake up a server, you need the MAC address of the network card. You can't use the IP address, because to use the IP address the machine needs to be already running.
 

Enabling  WOL on the server

(The exact location / naming schedule depends on your version of Windows, but this should give you a clue where to look.)

  1. Control Panel / Connections
  2. right-click on the network interface, Properties
  3. Configure
  4. Power Management
  5. turn 'Allow the computer...' ON
  6. turn 'Allow this device...' ON
  7. turn 'Only allow managment...' ON
Some network cards do not show the 'Power Managment' tab. In those cases you have to fiddle around with the settings under the 'Advanced' tab, perhaps in combination with your BIOS settings.

My latest Windows 10 clean install enabled WOL by default. Interesting...
 

Getting the server's MAC address

  1. start a Command Prompt
  2. enter:
    1.  
      C:\> ipconfig /all
The MAC address of your network card is listed behind 'Physical Address'.
 

Wake-up on the local network

On an iPad, install mWOL by Mocha, and enter the IP address and MAC address you've found. Hit the 'Wake up' button to wake up your machine.

On Android, install WOL by Ben Finnigan, enter the IP address and MAC address, etcetera.

On a PC I use my own tool Wakiewakie but you can do it the hard way using mcwol or something similar.

When using mcwol:

    C:\> mcwol 00:14:22:C5:21:F0
With MCWOL you cannot specify a specific port, you can when using wolcmd.

Here's an example batch file which waits until a specific machine is awake:

    :loop
    mcwol 00:AA:22:C5:21:FF
    ping 10.151.0.72 -n 1 -w 5000
    ping 10.151.0.72 -n 1 -w 10
    if errorlevel 1 goto loop
The result of the second ping statement is used as a loop condition. The first ping statement is just there to create a delay. Long timeouts may result in an unrecognised errorlevel.

If you need a batch file that's a little more refined output wise, try this one: (it also seems to handle timeouts better, but better check out the Internet for proper wakeup scripts)

@echo off
echo.
echo *** Wake up Media4 ***
echo.
echo - send wol to 00:AA:22:C5:21:FF
echo - ping 192.168.0.72
echo - repeat until server replies
echo.
echo Trying to wake up Media72...
:wakeup
mcwol 00:AA:22:C5:21:FF       > nul
ping 192.168.0.72 -n 1 -w 2000 > nul
ping 192.168.0.72 -n 1 -w 5    > nul
if errorlevel 1 goto wakeup
ping 192.168.0.72 -n 1 -w 5    > nul
if errorlevel 1 goto failed
:awake
net use \\media72 xxxxxxxx /user:xxxx
goto done
:failed
echo.
echo ERROR: Media72 did not reply
echo.
pause
:done
@echo on


Wake-up from the Internet

If you want to access data on the server from the Internet (because you're simply elsewhere) things can get tricky. If you're on ADSL with a fixed IP address, do this:

  1. assuming your server is on 10.0.0.4
  2. forward some port (for example 63636) from the Internet to 10.0.0.255 port 9
  3. configure the WOL program on your iPad or Android to NOT use broadcast but send the magic packet to port 63636 on your public IP address
  4. your router forwards the message from the Internet and broadcasts it on your network, and your server should wake up
Note: not all routers allow forwarding to a broadcast address.
 

Wake-up from the Internet using a FritzBox

If you own a Fritzbox router, you're not allowed to forward to anything like x.x.x.255, but the Fritzbox offers another option: 

  1. log into your router
  2. forward some port (for example 636363) from the Internet to 10.0.0.4 port 9
  3. go to Home Network / Network
  4. edit the entry for your server (ie.10.0.0.4)
  5. switch 'Start this computer automatically' ON
  6. configure the WOL program on your iPad or Android to NOT use broadcast but send the magic packet to port 63636 on your public IP address
  7. your router will, on any incoming traffic routed to your server, send a WOL message to your server
If you have the FritzBox set up to wake up your server and you have Torrent ports forwarded to your server, then your machine will probably never switch off as there's always some other uTorrent client sending you a message to see if you're still alive, which in turn triggers the FritzBox to send that WOL magic packet to your server.

Solution: disable or manually switch on / off (the rules for) those forwarded ports. You may have to manually enable / disable those rules, enable uPNP, or accept slightly slower speeds and less sources without those ports forwarded, however in most cases you won't have to do a thing, the NAT protocol in the router will take care of it.

This leaves you with a funny setup: local users need to wake up the server, whilst it wakes up automatically for a remote users accessing it from the Internet.Yeah, the computer industry still has to think a bit harder on this energy management / WOL stuff... (Why not implement WOL as part of Windows as a kind of fall back scenario?)
 

What if it all doesn't work?

There are so many things that can go wrong...

The most common ones:
 

Server wakes up then immediately shuts down

Google for solutions, you may have to resort to registry edits.
 

Server wakes up then shuts down after a preset time REGARDLESS of sleep settings

Again, head to Google. Windows 8 and 10 have Micky Mouse features to avoid inadvertent wakeups... so they shut down the machine if there's no user. Makes sense on a laptop, doesn't make much sense on a home server. You probably have to resort to registry edits, yet again.
 

Server doesn't recognize load

Server shuts down, even when busy. The catch is often it isn't busy enough. Especially Windows XP suffered from this problem. I never found a solution..
 

Server doesn't go back to sleep... ever!

Yeah, those things happen. I ran into a strange issue where my server went to sleep fine if I kept the time out short (for example standby after 5 minutes worked fine). Yet, when I set it up to go to sleep after 2 hours, it rarely did... One of the installed applications must be doing a periodic scan or something messing up the idle detection. No real solution, but read on...
 

Enforced sleep

I gave up on short term standby, it simply wasn't working reliable. Still, I wanted to save some energy! So to this end I cooked up this elaborate scheme, which handles a multitude of problems... (Hey, I'm good! :-))
 

Old (XP) approach

  1. 00:00 check for Adobe Flash updates (Task Scheduler, daily, after 5 minutes idle, only when computer is running)
  2. 00:55 shut down the SqueezeSlave client on the server (Task Scheduler, daily, unconditional, only when computer is running)
  3. 01:00 execute any Windows updates (Control Panel / Windows Update, daily at 01:00)
  4. 02:00 put server into sleep mode (Task Scheduler, daily except on Sunday, after 30 minutes idle, only when computer is running)
  5. 03:00 shutdown (Task Scheduler, daily, after 60 minutes idle, only when computer is running)
To put the server in standby mode at 02:00 I execute the following line:
C:\> %windir%\system32\rundll.exe powrprof.dll,SetSuspendState
Note: with hibernation enabled the machine will go into hibernation, not into standby. With standby enabled and hibernation disabled it will go into standby.

To shutdown the server at 03:00, I call a batch file containing the following:

taskkill /IM javaw.exe /F /T
net stop serviio
taskkill /IM serviioconsole.exe /T
shutdown.exe -s
Either ServeToMe or ImageBank needed killing the Java engine (I forgot which one :-)) and the Serviio lines are no longer required since I uninstalled Serviio.

So, here's what happens:

  1. If power management standby after 120 minutes works properly, the computer will go into standby, and nothing else happens. All is fine.
  2. If the computer is still on at 00:00 Adobe Flash will look for an update.
  3. If someone left SqueezeSlave playing, it will be halted at 00:55.
  4. If the computer is still on at 01:00 it will run a Windows Update.
  5. If the computer is still on at 02:00 a previous standby attempt didn't work. If it has been idling for 30 minutes it will try again, except on Sunday.
  6. If the computer is still on at 03:00 it will try a full shutdown.


New approach

  1. I set the sleep delay time (Put the computer to sleep) to a long period, ie. 5 hours. Typically 90% of the time something happens during those 5 hours, so effectively the computer never goes to sleep. It sometimes does, but rarely.
  2. I created a scheduled task which runs every night at 01:00 (only if the computer has been 10 minutes idle) and calls this batch file to put my server to sleep:
    1.  
      C:\software\power_shortcuts\psshutdown.exe -d -t 0
Most days, my server is triggered by someone starting up a SqueezeBox player, and it automatically shuts down at 01:00 every night.Sometimes an update might keep it awake, but it is rare.


8. VNC
 

If your server is somewhere where you do not have immediate and convenient access to it (attick, garage, broom closet etc.) then install a remote management tool like VNC. It allows you to remote control your server, and you definitely want that! There are many flavours of VNC. TightVNC seems to work well for many  people.

When installing VNC on the server, install it as a 'service' to keep it running, no matter if you're logged in or not.
 

Windows XP / Windows 7 / Windows 8

  • TightVNC
  • RDP
iPad
  • RemoterVNC
Android
  • AndroidVNC