prevent windows 7 sleep while files are being accessed by network

Solution 1:

In the advanced power options for your current power plan, you can disable going to sleep when media is being shared from the computer.

It's located under 'multimedia settings'>'When sharing media':

enter image description here

Solution 2:

You will need an external application like "Coffee" to keep your PC awake:

https://sourceforge.net/projects/coffee-sc/

This little open-source software project allows you to set thresholds, like if you are uploading more than 10KB per second the computer should not sleep. Take a look at what your traffic patterns are and set it to something not too high and not too low. Windows will generate traffic all the time and if your threshold is too low then Windows will keep itself awake just talking to itself on the network.

Example of what settings you get:

enter image description here

Solution 3:

I was searching for an answer to a quite similar question to yours. I'm using Kodi as the client on a Raspberry Pi accessing a Windows (SMB) Share on a Win7 box. I would like to prevent the Win7 box from sleeping if Kodi is still reading files over the network i.e. I'm watching a video.

I believe this is a non-issue, because Windows will issue a "stay awake" -type request to power management, suspending sleep, when it detects the share being accessed.

To provide some evidence for this, on the Win7 box from an elevated command prompt, type powercfg /? and it will explain:

-REQUESTS
           Enumerate application and driver Power Requests. Power
           Requests prevent the computer from automatically powering off
           the display or entering a low-power sleep mode.

Then play back some content via Kodi.

Next, back in your elevated command prompt, type powercfg -REQUESTS. You should see the following:

DISPLAY:
None.

SYSTEM:
[DRIVER] \FileSystem\srvnet
An active remote client has files opened on this machine.
[DRIVER] \FileSystem\srvnet
An active remote client has recently sent requests to this machine.

AWAYMODE:
None.

I'll confess that I haven't tested how this pans out in practice. However, in theory you should be able to use a Balanced power plan in Windows whilst still being able to watch content using Kodi, without Windows going to sleep part way through.