Repository navigation
Add Suspend-Computer #28164
Description
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 likeSuspend-Computer(or use a-State Sleep|-Hibernateparameter),
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 withStop-ComputerandRestart-Computer.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsQueue
Activity
soroshsabz commentedon Oct 7, 2026
-Delay,-Reasonto Stop-Computer #28163soroshsabz commentedon Oct 7, 2026
I think it can implement as a cross-platform