Skip to content

Add Suspend-Computer #28164

Open
Open

Description

@soroshsabz

Summary of the new feature / enhancement

Problem Statement:
PowerShell currently provides cmdlets to turn off or reboot a system (Stop-Computer, Restart-Computer), but lacks any native cmdlet to put a machine into a low-power state (Sleep or Hibernate). System administrators and automation engineers must resort to loading WinForms/.NET assemblies via Add-Type ([System.Windows.Forms.Application]::SetSuspendState(...)) or calling undocumented rundll32.exe powrprof.dll,SetSuspendState commands. This creates unnecessary boilerplate code, reduces script readability, and introduces cross-platform/cross-edition compatibility quirks.


User Story

As an IT administrator or power user automating power management policies via PowerShell,
I want to run a dedicated cmdlet like Suspend-Computer (or use a -State Sleep|-Hibernate parameter),
So that I can programmatically place workstations and laptops into low-power states without relying on .NET reflection or brittle Win32 API workarounds.

Proposed technical implementation details (optional)

Proposed Syntax / Design

Option A: New dedicated cmdlet (Recommended)

Suspend-Computer [-Hibernate] [-Force] [-WhatIf] [-Confirm]

Option B: Parameter on existing cmdlets

Set-ComputerPowerState -State <Sleep | Hibernate> [-Force]

Proposed Parameters

  • -Hibernate (Switch): Enters Hibernate mode ($S4$) instead of standard Sleep/Standby ($S3$/Modern Standby), if enabled on the host. Defaults to Sleep if omitted.
  • -Force (Switch): Suspends the machine immediately without waiting for hung applications or active lock states.
  • -ComputerName (String[]): (Optional) Target remote systems via standard remoting/WMI/CIM, consistent with Stop-Computer and Restart-Computer.

Activity

  1. added
    Issue-Enhancementthe issue is more of a feature request than a bug
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Oct 7, 2026
  2. soroshsabz commented on Oct 7, 2026

    @soroshsabz
    Author
  3. soroshsabz commented on Oct 7, 2026

    @soroshsabz
    Author

    I think it can implement as a cross-platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.WG-Cmdletsgeneral cmdlet issuesWG-NeedsReviewNeeds a review by the labeled Working Group

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions