Page 1 of 1

PC won't sleep after streaming to a media player

Posted: Wed Mar 20, 2019 1:47 pm
by vyork
After upgrading to a Gigabyte Aorus M. with a Ryzen 7 processor my computer will no longer fall asleep after I stop streaming a video to my Sony SMP-100 media player. I ran powercfg-request before I stream a video and it show the following: Display: None System: None Awaymode: None. After I stream a video to and run the powercfg-request I get System: [Process} \Device/HarddiskVolume2\Program Files\Windows Media Player\wmpnetwk.exe Media Sharing has been enabled through windows media player and the computer will no longer go to sleep until I restart Windows. Is there away to have window enter sleep mode without restarting?
powercfg -requests Capture.PNG

Re: PC won't sleep after streaming to a media player

Posted: Wed Mar 20, 2019 5:05 pm
by jachin99
Check your power options. I know there is a setting to prevent idle or sleep while media is streaming. You can try turning that off, and see what happens. Also check BIOS/UEFI and see if changing the sleep settings there makes a difference. I recall turning off legacy usb support and one other setting in bios, and disabling usb selective suspend under windows power options at least.

Re: PC won't sleep after streaming to a media player

Posted: Wed Mar 20, 2019 6:18 pm
by Space
Have no idea if this is related but:

https://support.microsoft.com/en-us/hel ... hare-media

This hotfix is no longer available from that page, so if it is the fix for this, I'm not sure how to get it. I suppose you can at least check if your system has it already installed.

Searching for KB981112 does find other download locations, but I don't know which ones are safe and work.

EDIT: Looks like you can get it here: http://thehotfixshare.net/board/index.p ... file=11920

Note that I can make no claims as to the safety of this download, you do so at your own risk.

Re: PC won't sleep after streaming to a media player

Posted: Wed Mar 20, 2019 6:27 pm
by jachin99
That patch can be downloaded from here https://pcsupport.lenovo.com/us/en/prod ... s/ds014955

Re: PC won't sleep after streaming to a media player

Posted: Wed Mar 20, 2019 6:37 pm
by Space
jachin99 wrote: Wed Mar 20, 2019 6:27 pm That patch can be downloaded from here https://pcsupport.lenovo.com/us/en/prod ... s/ds014955
Yeah, I saw that one, but I think it is packaged specifically for Lenovo laptops and may not work, I updated my post with a download that seems to be a more generic version of the patch.

Re: PC won't sleep after streaming to a media player

Posted: Thu Mar 21, 2019 3:25 pm
by vyork
I have tried the following with no luck getting the computer to sleep:

Ran the hotfixshare and a message came up saying "This update is not applicable to your computer".
Installed Lenovo patch but it didn't change any thing.
disabled usb selective suspend under windows power options, turned off legacy usb support.
prevent idle or sleep while media is streaming. Computer would go to sleep when streaming a video to my media player.

There wasn't a whole lot of settings in the BIOS under power options.
20190321_085753.jpg
Does anyone have anything else that I could try?
Thanks

Re: PC won't sleep after streaming to a media player

Posted: Thu Mar 21, 2019 3:57 pm
by jachin99
Are you on 32 or 64 bit windows? I think that patch was only for 64 bit. I got the same result from the Lenovo installer. I would look up exactly what all of those do but you could try to disable the high precision event timer.

Re: PC won't sleep after streaming to a media player

Posted: Thu Mar 21, 2019 6:11 pm
by Space
One thing you should understand (not sure if you do) is that when you run the "powercfg -requests" command, that lists all the processes that have requested the PC to not go to sleep. You should see that process listed here if you are streaming. When you stop streaming, that process should no longer appear in this list.

So, if you disable "prevent idle or sleep while media is streaming", the streaming process will not tell the PC to not go to sleep, so the PC will go to sleep while you are streaming (like you noticed).

The bug that the patch is supposed to remedy is when you start streaming, the process tells the PC to not go to sleep (this is good), but after you stop streaming it does not tell the PC that it is OK to go to sleep again (this is bad). So the patch is supposed to make the streaming process tell the PC that it is OK to go to sleep again once you stop streaming.

So, the test to see if this problem has been resolved is to:
  1. Start streaming
  2. Run powercfg -requests and you should see that the process is there
  3. Stop streaming
  4. Run powercfg -requests and you should see that the process is no longer there (note that there may be some delay before it is removed, so wait a minute or two for it to go away)
If you are running Windows 7 32-bit, then you will need a different patch (the one I posted was for 64-bit Windows 7). Here is the one for 32-bit (x86) Windows 7: http://thehotfixshare.net/board/index.p ... file=11921

Re: PC won't sleep after streaming to a media player

Posted: Fri Mar 22, 2019 12:58 am
by vyork
I'm running Windows x64.
After streaming a video and turning off the media player and running the powercfg -requests It still showing the wmpnetwk.exe process no matter how long I wait.
Is there any other work around that I could try. Is there way to use a batch file to stop the wmpnetwk.exe process when I stop streaming to the media player?

Re: PC won't sleep after streaming to a media player

Posted: Fri Mar 22, 2019 1:27 am
by jachin99
It really depends. What are you streaming to? Do you use this machine for regular DVR duties? You really have to take a lot into consideration before you automate putting it to sleep. Off of the top of my head you could use maybe the task scheduler or a free automation program called eventghost. I have my PCs connected to a what 2011 box and I'm experimenting with a program called lights out which let's me schedule periods of sleep. No would otherwise use eventghost but I like some of the extra features of lights out.

Re: PC won't sleep after streaming to a media player

Posted: Fri Mar 22, 2019 1:41 am
by Space
I've never had a need for it, as I was able to resolve most of my sleep issues on my system, but many people in the past used to use MCE Standby Tool to fix their sleep issues when using WMC. I don't know if it will work for your particular problem or not.

Re: PC won't sleep after streaming to a media player

Posted: Fri Mar 22, 2019 1:58 am
by jachin99
For the hotfix listed above, I got the same message saying its not applicable so I read the MS KB article about it. Towards the middle/bottom area it lists the new file versions that are packaged with the update so I checked my version of one of those files and it is greater than the file version listed in the update. If your concerned with why the patch won't install I would check that. I have tried the MCE Standby tool as well but it never solved my sleep issues in the past on other PCs. Adjusting the BIOS and windows sleep settings helped a lot but mine still isn't perfect either, which is why I'm trying a scheduler.

Re: PC won't sleep after streaming to a media player

Posted: Fri Mar 22, 2019 1:01 pm
by dmagerl
WHen you say you've disabled sleep when streaming, do you mean the setting "When sharing media" under "Multimedia" in Advanced Power Settings?

There is another setting, normally hidden, named "Allow Sleep with Remote Opens" that might work. I think it's supposed to prevent sleep if another computer has opened a file remotely on the media computer.

To expose the setting, make the following registry change:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\d4c1d4c8-d5cc-43d3-b83e-fc51215cb04d]
"Attributes"=dword:00000000

In the advanced power settings menu, a new parameter under "Sleep" is exposed called Allow sleep with remote opens". Set it to "On". Make sure you select the active power plan first.

Re: PC won't sleep after streaming to a media player

Posted: Sat Mar 23, 2019 2:50 pm
by vyork
Yes I meant when sharing media under "multimedia" in advance power settings. I did try the allow sleep with remotes open and there was no change. The only thing I found that will enable the computer to sleep after I stop streaming media is to stop the wmpnetwk.exe under services in the task manager. I'm not a don't know a great deal about computers but I was able to put this cod together that stops the wmpnetwk.exe when I do a powercfg-request.

REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"="
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
::--------------------------------------
::ENTER YOUR CODE BELOW:
taskkill /f /im wmpnetwk.exe

Is there a good way to run this code In a batch file without the UAC permissions popping up using the task scheduler when a video stops streaming to a device?

Re: PC won't sleep after streaming to a media player

Posted: Sun Mar 24, 2019 12:43 pm
by TheReaper
vyork wrote: Sat Mar 23, 2019 2:50 pm taskkill /f /im wmpnetwk.exe

Is there a good way to run this code In a batch file without the UAC permissions popping up using the task scheduler when a video stops streaming to a device?
Instead of using taskkill, you might try stopping the service: net stop WMPNetworkSvc

As for UAC permissions, in the task scheduler on the General tab for the task, you can set the user the task will run under to SYSTEM and optionally check the box for high permissions. That might prevent the pop up. There is also a check box to run hidden/background, so the cmd window is never seen.

As for the trigger of when streaming stops, I have no idea.