Skip to content

Restart-Computer -cn -Force -Wait -Timeout is broken in latest build. #11002

@CranePet

Description

@CranePet

Steps to reproduce

1. Install Powershell 7 Release 5 x64 on a up-to-date Windows 10 Computer
2. Run Powershell 7
3. Run the following script...

$ComputerNames = "Computer1","Computer2", "Computer3"
$ComputerNames | ForEach-Object -Parallel {
     Restart-Computer -ComputerName $_ -Force -Wait -Timeout 1800
}
4. Wait the allotted Timeout period of 30 minutes.

Where Computer1-3 are test computers on the same network.

Paul Higin Tested this and commented in another tread;

"This appears to be an error in the Restart-Computer cmdlet. When I run it alone in the latest
preview build, it restarts the remote computer as expected, but never returns and eventually 
crashes PowerShell. I get the same behavior when running it within a foreach -parallel 
script block.

This appears to have nothing to do with foreach -parallel, except that foreach -parallel doesn't
currently support progress data (by design) and so there is no indicator of how the computer
restart is proceeding.

I feel this Issue should be closed and two new issues open:
a. Restart-Computer -cn -Force -Wait -Timeout is broken in latest build.
b. ForEach -Parallel to support progress data stream (not sure how this would work and it would 
be a new feature request anyway)."
--




 

Expected behavior

The remote computer will reboot and the script will continue without error.

Actual behavior

The computers reboot, but PowerShell never reconnects to them.

After 30 Minutes, the following errors are received;

Restart-Computer: Failed to restart the computer Computer1 with the following error
 message: The computer did not finish restarting within the specified time-out period..
Restart-Computer: Failed to restart the computer Computer2 with the following error
 message: The computer did not finish restarting within the specified time-out period..
Restart-Computer: Failed to restart the computer Computer3 with the following error
 message: The computer did not finish restarting within the specified time-out period..

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.5
PSEdition                      Core
GitCommitId                    7.0.0-preview.5
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions