0

Edit: Skip to the end for the result of my situation

I am trying to figure out how I disabled the sleep, hibernate, and fast startup options in Windows 10, so that I can include them in the PowerShell scripts that I use to set up fresh deployments of Windows. I know that it is possible to do all 3 of these things using only PowerShell commands because I did it myself about a month or two ago on my desktop, but I cannot remember how I did it and cannot find it online anymore after an hour of google searching.

Note of clarification: When I say "disabled", I don't mean just unchecked the box, I mean that the options are no longer shown in Control Panel -> Hardware and Sound -> Power Options -> System Settings and are also hidden or removed from both the power menu in the Start menu and the "Windows key+X" menu

As I said before, I did it myself a month or so ago, so I know that it is possible to do this using only commands in an Administrator PowerShell. I suspect it involves powercfg -h off and/or some kind of registry tweaks.

Examples

Here are some examples of what the intended result looks like. These screenshots were taken on my laptop and desktop, respectively:

On my laptop with a fresh install of Windows, the power options look like this: Example of Power Options with sleep, hibernate, and fast startup enabled

Meanwhile, on my desktop (where I already disabled these things), the power options look like this: Example of Power Options with sleep, hibernate, and fast startup disabled


Edit:

It turns out I was being stupid and forgot that I had disabled these things globally in the VM host.

A quick powercfg -a revealed the following:

The following sleep states are not available on this system:
    Standby (S1)
        The system firmware does not support this standby state.
        The hypervisor does not support this standby state.

    Standby (S2)
        The system firmware does not support this standby state.
        The hypervisor does not support this standby state.

    Standby (S3)
        The hypervisor does not support this standby state.

    Hibernate
        The hypervisor does not support hibernation.

    Standby (S0 Low Power Idle)
        The system firmware does not support this standby state.

    Hybrid Sleep
        Standby (S3) is not available.
        Hibernation is not available.
        The hypervisor does not support this standby state.

    Fast Startup
        Hibernation is not available.
3
  • I've deployed systems for decades, and to date never encountered a reason (or customer request) to do this. OK, so, you say you did this before; then what did you search for in the past to find what you did, because if you did this with PS, why would you not have saved that script as part of your gold image effort? This means to me that you typed commands for this completely separate from your automation effort. All this kind of stuff is in the registry. So, just compare the registry between the two systems. Search for remove or hide /not disable Win 10 options/settings.
    – postanote
    Commented Apr 17, 2021 at 23:59
  • I completely agree, and I think the last time I tried to look into this topic was a few months before I started working on PowerShell scripts. As I mentioned in the edit I just made, I guess I forgot that I had solved this problem not in Windows but rather in the hypervisor, so really I was looking in all the wrong places. Commented May 7, 2021 at 1:31
  • To clarify the use case, I want to disable those things because it is a VM that I interact with daily via pass-through GPU and PCIe USB card. Because the VM has no other physical hardware, it has no power button, so if it accidentally go into a sleep state I cannot wake it, not even with the keyboard/mouse. The only way to wake the VM is via SSH into the or the server's WebUI, which only works if/when the host recognizes the VM is "Paused" instead of "Running" (otherwise sending the start command just gives you a ... is already running response). Commented May 7, 2021 at 1:46

1 Answer 1

0

Just use GPO/LPO configuration. Manually create a policy, import to systems; or at the domain level and enforce it. No real need for PowerShell for this.

Simple search:

'Hide Control Panel Settings':

https://duckduckgo.com/?q=%27hide+control+panel+settigns%27&t=h_&ia=web

Example hit(s):

1
  • While I do think this is helpful in general, I must say that the Group Policy approach is the type of manual configuration that I was specifically trying to avoid, since the goal is to set a PowerShell script running and be able to walk away for a few hours and have every all set when I get back. Despite this criticism, I do think your suggestion here could be very helpful for other people who are just trying to look for a general way to "disable sleep, ..." etc. Commented May 7, 2021 at 1:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .