none
Hybrid shutdown for a remote computer

    Question

  • Could you tell me please how to make hybrid shutdown state (S4) for a remote computer (Windows 8.1) using PowerShell?

    There is the cmd command

    shutdown.exe /s /hybrid /m \\compname

    but it puts the remote computer into S5 (off state) instead of expected S4 (hybrid shutdown state).

    There is PowerState Enumeration but it refers to only two states: hibernate and suspend. But hibernation is not what I need. I need hybrid shutdown that combines hibernation and shutting down.

    Thank you!







    • Edited by The_Immortal Wednesday, January 20, 2016 11:49 AM
    Wednesday, January 20, 2016 8:53 AM

Answers

  • Hybrid sleep is really a consumer laptop tool.  I is not much concern in a corporate environment.  Users can choose it or not.  In W10 it is enabled by default if the hardware supports it. (requires UEFI boot support).  When hybrid is enabled the shutdown default is "hybrid". Th e"shutdown" "/hybrid" switc is an override to the default as is the shutdown /s an override to the hybrid default.  All other methods cause a simple shutdown to a power off state to do a hybrid shutdown.  No remote method can do a remote hybrid if hybrid is not the default and shutdown.

    Support for this is also dependent of vendor drivers and BIOS so some systems may not behave as expected.

    Much of the documentation for this is in the Microsoft Vendor Hardware and driver support site.


    \_(ツ)_/



    Thursday, January 21, 2016 8:08 AM
    Moderator

All replies

  • Hi,

    try sysinternal's PsShutdown utility. The -h switch ought to be what you need.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Wednesday, January 20, 2016 9:46 AM
  • Nope. I don't need to hibernate pc. I need HYBRID SHUTDOWN.

    • Edited by The_Immortal Wednesday, January 20, 2016 9:57 AM
    Wednesday, January 20, 2016 9:57 AM
  • Post here: http://answers.microsoft.com


    \_(ツ)_/

    Wednesday, January 20, 2016 10:56 AM
    Moderator
  • YOU cannot remotely place a computer into hybrid state.

    \_(ツ)_/

    Wednesday, January 20, 2016 10:57 AM
    Moderator
  • Are you sure? Where did you find this information? Why the command
    shutdown.exe /s /hybrid /m /compname
    successfully completed (without any error - but actually doesn't work) then?

    • Edited by The_Immortal Wednesday, January 20, 2016 11:16 AM
    Wednesday, January 20, 2016 11:04 AM
  • Are you sure? Where did you find this information? Why the command
    shutdown.exe /s /hybrid /m /compname
    successfully completed (without any error - but actually doesn't work) then?

    Let's start with the immortal last words of this TechNet forum - "Your question is not a scripting question."

    That is why I posted the link to the correct forum.

    You have the command but it doesn't work.  Doesn't that make you suspicious that you might be doing something wrong.  Even if it were possible the remote machine must be configured to support hybrid shutdown.

    Also start by reviewing the help:
    shutdown /?

    It appears that you do not have the correct syntax.


    \_(ツ)_/

    Wednesday, January 20, 2016 11:30 AM
    Moderator
  • Let's start I was looking for a PowerShell script that allows to put a cremote computer into hybrid shutdown state - so, it's a scripting question.

    Also I've just reviewed the help of shutdown. My syntax is absolutely correct. Could you please specify what exactly do you mean?


    • Edited by The_Immortal Wednesday, January 20, 2016 11:45 AM
    Wednesday, January 20, 2016 11:38 AM
  • Let's start I was looking for a PowerShell script that allows to put a cremote computer into hybrid shutdown state - so, it's a scripting question.

    Also I've just reviewed the help of shutdown. My syntax is absolutely correct. Could you please specify what exactly do you mean?


    Then the answer is no.  There is no PowerShell script that can set hybrid state.

    There are no options on the Stop-Computer command  it just triggers the configured default shutdown mode.

    The WMI version is not implemented as you can see from the docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa394102%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

    Some things can only be done with the utility and that is by design.  Some remote operations are disallowed fro security and usability reasons.

    Also no API has been published for entering hybrid mode.


    \_(ツ)_/


    • Edited by jrvModerator Wednesday, January 20, 2016 11:56 AM
    Wednesday, January 20, 2016 11:53 AM
    Moderator
  • Here is a discussion about the power states. THis was reently published.  THe API for setting the power state has not been published:

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa373229(v=vs.85).aspx


    \_(ツ)_/

    Wednesday, January 20, 2016 12:00 PM
    Moderator
  • The flat WMI shutdown has also not implemented access to hybrid state.

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa394058%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396


    \_(ツ)_/

    Wednesday, January 20, 2016 12:11 PM
    Moderator
  • The issue you have to address is what "hybrid" shutdown means.  It is a selective mode that is dependent on the OS, the hardware and the choice of the user.  It is not considered a manageable parameter as are many user specific configuration choices.  There is also no way to remotely configure these power choices.  They are user-only settings in many cases. 


    \_(ツ)_/

    Wednesday, January 20, 2016 12:21 PM
    Moderator
  •  

    Try this:

    shutdown-S-mmomcliv051-hybrid-F-T10-C"Your message here"

    m is remote computer

    t is time

    f is force

    c is message

    WMI or remote management might have to be enabled and opened in the firewall.


    Justin

    Wednesday, January 20, 2016 12:34 PM
  • Have you tried using command combined With the DLL file, or using invoke-command, which executes the commands on the Remote hosts? I use for example

    Invoke-Command-ComputerName$computer-Credential$credentials-ScriptBlock{ipconfig /all } and commands like this all the time. You can even use Shutdown command locally and see how it behaves.

    Best regards
    Sean 


    Rao

    Wednesday, January 20, 2016 1:35 PM
  • Ok, guys, let me clarify the problem because you can think "why that guy need this?".

    We got a number of computers (with Windows 8.1) and due to some specific tasks I need to turn them on remotely I need to turn them on and off (not to sleep or just hibernate) using WakeOnLan magic packets. So I know that Windows 8+ doesn't officially support wake up from S4 (hybrid shutdown state) and S5 (off) states. However it is fortunate that the computers support WoL from S4 (hybrid shutdown state)! But my happiness was not too long when I found that I can't put a machine into S4 (hybrid shutdown state) _remotely_. So when I complete the command locally:
    shutdown /s /hybrid
    the system definitely goes into S4 (hybrid shutdown state) and I can wake it up using magic packet. But when I try to do the same but from my main work place (remotely) via the following command:
    shutdown /s /hybrid /m \\CompName

    the machine goes into a classis S5 off - it's ignoring /hybrid. And then I'm unable to turn it on...


    So, what've tried:

    1.

    shutdown /s /hybrid /m \\CompName

    Result: S5 (off).

    2.

    invoke-wmimethod -computername CompName -path win32_process -name create -argumentlist "shutdown.exe /s /hybrid"

    Result: S5 (off).

    3.

    schtasks /create /s CompName /ru system /sc once /tn shuthb /tr "shutdown /s /hybrid" /st 10:00
    schtasks /run /s CompName /tn shuthb

    Result: S5 (off).


    Next I think: ok, let's try to complete this command locally but using remote access:

    4. telnet (connected to CompName):

    shutdown /s /hybrid

    Result: S5 (off).

    5. WinRS (connected to CompName):

    shutdown /s /hybrid

    Result: S5 (off).


    I understand that 1-3 ways doesnt work due to reasons jrv mentioned above... But what's wrong ith 4 and 5??? How can it be possible? Why it doesn't work?! Using telnet (winrs) is just like using cmd on local computer, isn't it? Again, if I go to a machine via RDP and type in cmd

    shutdown /s /hybrid

    it WORKS!


    So... Is it a bug or a feature?

    • Edited by The_Immortal Wednesday, January 20, 2016 2:04 PM
    Wednesday, January 20, 2016 1:58 PM
  • I understand that 1-3 ways doesnt work due to reasons jrv mentioned above... But what's wrong ith 4 and 5??? How can it be possible? Why it doesn't work?! Using telnet (winrs) is just like using cmd on local computer, isn't it? Again, if I go to a machine via RDP and type in cmd

    shutdown /s /hybrid

    it WORKS!


    So... Is it a bug or a feature?

    As I pointed  out many times above. You cannot remotely enter hybrid state.  WinRS is NOT telnet.  It is remoting.  RDS is NOT remote because it has a full GUI session.  A full logon is required for shutdown to hybrid to work.

    It is not a bug.  It is by design.  It is for security and usability  reasons.

    Windows is full of these things we cannot do remotely.


    \_(ツ)_/

    Wednesday, January 20, 2016 3:40 PM
    Moderator
  • It is not a bug.  It is by design.  It is for security and usability  reasons

    There is a posibility to shutdown a remote machine, sleep it, hibernate... But no possibility to make a hybrid shutdown! It's bad design (if it's) and I don't see no security and usability reasons of this.

    So I believe it's a bug. Where can I post about it to MS technicians?

    P.S. Could you just imagine: I need to turn on 300+ computers, do some automated work on them, and them turn them off. So in the end of this algorithm I need connect to RDP on each computer and manually shut it down... It's just a hell, how do you think?



    • Edited by The_Immortal Wednesday, January 20, 2016 10:21 PM
    Wednesday, January 20, 2016 8:25 PM
  • It is not a bug.  It is by design.  It is for security and usability  reasons

    There is a posibility to shutdown a remote machine, sleep it, hibernate... But no possibility to make a hybrid shutdown! It's bad design (if it's) and I don't see no security and usability reasons of this.

    So I believe it's a bug. Where can I post about it to MS technicians?

    P.S. Could you just imagine: I need to turn on 300+ computers, do some automated work on them, and them turn them off. So in the end of this algorithm I need connect to RDP on each computer and manually shut it down... It's just a hell, how do you think?




    Don't complain to us.  Complain to your computer gods for not listening to your prayers.  We are just a bunch of lowly techs who have to make this stuff work safely.  We cannot allow un-ordained people to change the rules for convenience without a quorum of computer gods to approve. 

    \_(ツ)_/

    Wednesday, January 20, 2016 11:27 PM
    Moderator
  • There is a posibility to shutdown a remote machine, sleep it, hibernate... But no possibility to make a hybrid shutdown! It's bad design (if it's) and I don't see no security and usability reasons of this.

    So I believe it's a bug. Where can I post about it to MS technicians?

    P.S. Could you just imagine: I need to turn on 300+ computers, do some automated work on them, and them turn them off. So in the end of this algorithm I need connect to RDP on each computer and manually shut it down... It's just a hell, how do you think?

    Out of idle curiosity ...

    When you turn on a computer to do things remotely (which I assume you are doing. You do not have interactive user session on each of them if you want to do 300 computers) and want to leave it in the state of Hybrid shutdown... how is it different from hibernate?

    Correct me if I'm wrong, but wasn't Hybrid Shutdown essentially ...

    • Log Off all interactive user sessions
    • Hibernate the system

    So if you don't have any interactive session, all that remains is to hibernate the system. If you 'boot' the system again as the user afterwards, it will restore the system from hibernate, and offer the usual login screen. Same as a wake from Hybrid Shutdown.

    On the other side, even if I'm wrong in my understanding on the matter - and feel free to put holes into my theory above - this leaves a lot of questions open about what you are trying to do and just why you need to do it this way. Is simultaneous execution while users are away without them noticing really that important? Is the electricity bill so bad you can't simply boot the machines a bit before users arrive, if boot time next day is the critical factor?

    Sorry, but from what I can see so far, I have the impression you have become fixed on this technique you are trying to pull off that you may well have lost sight of your true objectives.

    So, if you want any useful solution out of us, why not go a bit more into the details of just what you are trying to accomplish and what the major constraints are, under which your are working on this?


    There's no place like 127.0.0.1

    Thursday, January 21, 2016 12:21 AM
  • Actually "hybrid sleep" does much more than just hibernate if you read all of the literature.  It does a kernel save and some other things which MS has been a bit vague about.  It also has extra support for SSD which basic hibernate does not.  In my experience it is from 3 to 10 times faster than plain hibernate even when no user is logged in.

    \_(ツ)_/

    Thursday, January 21, 2016 12:29 AM
    Moderator
  • Actually "hybrid sleep" does much more than just hibernate if you read all of the literature.  It does a kernel save and some other things which MS has been a bit vague about.  It also has extra support for SSD which basic hibernate does not.  In my experience it is from 3 to 10 times faster than plain hibernate even when no user is logged in.

    \_(ツ)_/

    Thanks for clarifying that difference. It really hasn't been much of an issue for us - there were always other problems that had precedence over dealing with boot modes.


    There's no place like 127.0.0.1

    Thursday, January 21, 2016 7:58 AM
  • Hybrid sleep is really a consumer laptop tool.  I is not much concern in a corporate environment.  Users can choose it or not.  In W10 it is enabled by default if the hardware supports it. (requires UEFI boot support).  When hybrid is enabled the shutdown default is "hybrid". Th e"shutdown" "/hybrid" switc is an override to the default as is the shutdown /s an override to the hybrid default.  All other methods cause a simple shutdown to a power off state to do a hybrid shutdown.  No remote method can do a remote hybrid if hybrid is not the default and shutdown.

    Support for this is also dependent of vendor drivers and BIOS so some systems may not behave as expected.

    Much of the documentation for this is in the Microsoft Vendor Hardware and driver support site.


    \_(ツ)_/



    Thursday, January 21, 2016 8:08 AM
    Moderator
  • Hi The_Immortal,

    Thanks for the post. I would agree with jrv that the hybrid shutdown state (S4) for a remote computer can't be acheived. But if you do want to perform this action and think it's not a good design, you might post your feedback and suggestion on the below link.  

    https://connect.microsoft.com/

    Best Regards,

    Elaine


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, January 21, 2016 8:50 AM
    Moderator
  • jrv,

    Don't complain to us.

    I appologize for my reaction... It's just emotions taken me over from hopelessness.

    Actually "hybrid sleep" ...

    Hybrid sleep is ...

    You wrote about "hybrid sleep". But it's not the same as "hybrid shutdown". Hybrid sleep is essentially sleeping + hibernating both the user and the kernel session. Hybrid shutdown first shutting down the user session (log off) and then hibernate the kernel session.

    FWN,

    Correct me if I'm wrong, but wasn't Hybrid Shutdown essentially ...
    • Log Off all interactive user sessions
    • Hibernate the system

    So if you don't have any interactive session, all that remains is to hibernate the system. If you 'boot' the system again as the user afterwards, it will restore the system from hibernate, and offer the usual login screen. Same as a wake from Hybrid Shutdown.

    In general you're right. And yes, largerly I can go the way you suggested so thank you very much for giving me the idea. But actually it's not the same as hybrid shutdown (jrv has already clarified the difference). And I need to get hybrid shutdown for a remote machine ideally.

    Elaine Jing, thanks for the information!



    Thursday, January 21, 2016 10:35 AM
  • You really need to read the Microsoft discussion of what a "hybrid" shutdown/sleep is.  It does not logoff the user and requires hardware support so only the newest machines can do a hybid sleep.

    I still didn't get why are you involving hybrid sleep? Again, hybrid sleep is not hybrid shutdown. It's two different states. I hope you understand it.

    When a hybrid shutdown happens the user session is "torn down".  Its state is saved while the kernel is "hibernated".  On restart unlike other modes the kernel is loaded using all processors/cores.  THe user session is recovered after the system has restarted.  By the time the user logs in the user session is fully up and restored.

    All you've described above is called hybrid sleep (or just hibernation). After hybrid shutdown the user session will not be recovered because there is no user session after starting system from hybrid shutdown state. Look at this:

    "... the first thing that happens is that the user session shuts down just like in a regular shut down operation. However, instead of closing the kernel session, Windows hibernates the kernel session. Then, the hardware session shuts down normally."

    So the same I wrote before:

    Hybrid shutdown first shutting down the user session (log off) and then hibernate the kernel session.

    You also wrote:

    There is no such thing as sleep + hibernate.

    Are you sure? "You really need to read Microsoft" then:

    "Hybrid sleep is designed primarily for desktop computers. Hybrid sleep is a combination of sleep and hibernate—it puts any open documents and programs in memory and on your hard disk, and then puts your computer into a low-power state so that you can quickly resume your work. That way, if a power failure occurs, Windows can restore your work from your hard disk. When hybrid sleep is turned on, putting your computer into sleep automatically puts your computer into hybrid sleep. Hybrid sleep is typically turned on by default on desktop computers."





    Thursday, January 21, 2016 5:05 PM
  • Yes - I see what you mean. The hybrid sleep is misused on many sites including some MS blogs.  Hybrid shutdown is a half-way measure.  The SSDs apparently make this hard to detect as they are so fast.


    \_(ツ)_/

    Thursday, January 21, 2016 5:14 PM
    Moderator
  • Yes - I see what you mean. The hybrid sleep is misused on many sites including some MS blogs.  Hybrid shutdown is a half-way measure.

    Glad you got it :)

    Anyway I'm going to describe my problem here and hope this will help...

    Thursday, January 21, 2016 5:27 PM
  • In all cases hybrid sleep cannot be triggered remotely but, according to the docs,  a standard shutdown should cause a hybrid sleep if the system is configured for it. 

    Also note that hybrid default is set by selecting "Fast Boot" in settings.


    \_(ツ)_/


    Thursday, January 21, 2016 5:30 PM
    Moderator
  • standard shutdown should cause a hybrid sleep if the system is configured for it.

    Default shutdown in windows 8+ causes a hybrid shutdown :) And yes, you're right - it happens when you click on the button "Shut down". But to click the button it requires full (interactive) logon - it's the problem...


    Thursday, January 21, 2016 5:37 PM
  • Elaine Jing, could you please specify what program is proper for my suggestion? I don't see something like "Misrosoft Windows".

    Thursday, January 21, 2016 6:04 PM