Skip to content

Restart-Computer performs shutdown on Ubuntu 18.04 #14684

@janegilring

Description

@janegilring

Steps to reproduce

Restart-Computer

Expected behavior

The computer should restart.

Actual behavior

The computer is shut down.

PS /home/adminjer> Restart-Computer
Shutdown scheduled for Sun 2021-01-31 20:10:52 UTC, use 'shutdown -c' to cancel.
PS /home/adminjer> Connection to ubnt-az-01 closed by remote host.
Connection to ubnt-az-01 closed.

The computer running into this issue on is running in Azure, where the platform logs stated the following after finding that the VM was in a Stopped state:

    "properties": {
        "title": "Stopped by user or process",
        "details": "This virtual machine is stopping as requested by an authorized user or by a process running inside the virtual machine.",
        "currentHealthStatus": "Available",
        "previousHealthStatus": "Available",
        "type": "Downtime",
        "cause": "UserInitiated"
    }

Environment data

PSVersion                      7.1.1
PSEdition                      Core
GitCommitId                    7.1.1
OS                             Linux 5.4.0-1039-azure #41~18.04.1-Ubuntu SMP Mon Jan 18 14:00:01 UTC 2021
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I have not tested whether the issue is also present on other Linux distros, but I would suspect so.

I haven't looked very closely at the source code, but what is supposed to happen seems correct:
https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs#L45

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.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