Script to turn off and on system sound on windows laptop, as per schedule

raksrules

Elite
My work laptop has an issue wherein, it will not go to Sleep even if I went to windows icon -> power -> sleep. Due to this, keeping laptop on overnight (but on sleep) was not possible as I would wake up to a dead battery always. In order to mitigate this, I got a vbs script online that can keep the laptop active by sending some keypress like NUM LOCK. Here is the script..

Code:
Dim onjResult

Set objShell = WScript.CreateObject("WScript.Shell")

Do While True
    objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
    Wscript.Sleep (10000)
Loop

This works really well and laptop remains on entire night (connected to a charger but charger is turned off and on in 2 Hour cycles using a wifi switch).


The side effect of this is a popup that comes on screen (usually during night when laptop is not being used, every few days) that tells me that the laptop has not been started in last X days so it is better to restart for stability and all. I can dismiss this message but until I do so, the message will keep coming and will make a sound on laptop. So during the night, if this message comes, it will disturb the person sleeping in the room as the message comes every 30 seconds until dismissed and will make the sound.

I want that the system sound on the laptop be turned off at specific time daily (say 10 PM) and start again (say 10 AM) using some sort of script. I cannot install any software as it is work laptop so script is only option. I don't know VB script so I cannot make one myself.

Does anyone have a ready script or knows how to make one or some link where someone has posted the script?
 
Try to change the lid settings for sleep or hibernate and see if that works, compared to selecting it manually from the power menu.
 

raksrules

Elite
Try to change the lid settings for sleep or hibernate and see if that works, compared to selecting it manually from the power menu.

I tried everything and still doesn't work. I will try today after shutting all the running applications and see if that works.
 
I tried everything and still doesn't work. I will try today after shutting all the running applications and see if that works.
I normally shut down my work laptop at the end of the day but observed that selecting Sleep from the power menu doesn't work on it as well. However, selecting the power button setting to Sleep/Hibernate works fine in my case.
 

kvn95ss

Disciple
You could try to hibernate instead of trying sleep. Doesn't use any power as the laptop is basically off.

Also, you could speak with the company IT if all else fails. Since it's a company laptop they might have configured it to not sleep/hibernate. Or it could be prevented by some background app.
 
In my case, the issue was with the default HP power plan and switching to the Windows Balanced plan resolved all issues with Sleep and Hibernate.
 
Top