Skip to content

Add ARSO option to Restart-Computer and Stop-Computer cmdlets #14222

Closed

Description

Summary of the new feature/enhancement

As a Windows user I want to be able to use the Automatic Restart Sign-On functionality that is available using shutdown.exe with the /g and /sg switches. I want to be able to use a PowerShell native cmdlet instead of having to use a Windows executable to restart and auto sign-in. This feature is detailed at https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/winlogon-automatic-restart-sign-on--arso-

Proposed technical implementation details (optional)

Add a switch parameter to the existing cmdlets that enable the ARSO option for shut down or restart of a Windows system. Use "EnableARSO" or "ARSO" as the switch parameter name.

Activity

  1. added
    Issue-Enhancement
    on Nov 22, 2020
  2. Windos commented on Nov 22, 2020

    @Windos
    Contributor

    This is PowerShell, with Tab Completion... as a user I have no idea what ARSO means and would much rather the switch be "Auto(matic)RestartSignOn" or something equally verbose and descriptive

  3. steviecoaster commented on Nov 22, 2020

    @steviecoaster
    Contributor

    I'll see what I can do with this this week.

  4. iSazonov commented on Nov 23, 2020

    @iSazonov
    Collaborator

    We need a public API to implement this. Do you know such API?

  5. jborean93 commented on Nov 23, 2020

    @jborean93
    Collaborator

    The public API (for Windows) that I know of is the AutoLogon registry keys https://docs.microsoft.com/en-us/troubleshoot/windows-server/user-profiles-and-logon/turn-on-automatic-logon. One big disadvantage of this is the password is encoded either in plaintext or in a reversible format. The plaintext option is the easiest as it's literally just setting the registry keys, the "encrypted" option is a lot more complicated and requires some PInvoking to call the LSA functions required to get the encrypted data to store in the registry. This is what I've done in Ansible to create the encrypted data which is then stored in the registry key.

    While encrypted it is still reversible by any admin on that host so we should definitely be documenting this limitation.

    This article describes how to turn on the automatic logon feature in Windows by editing the registry.
  6. iSazonov commented on Nov 23, 2020

    @iSazonov
    Collaborator

    Jordan Borean (@jborean93) I guess we cannot use this for security reasons. While PowerShell makes good use of the OS's capabilities, it remains secure as long as the OS is secure.
    The only option is if MSFT makes ARSO public in Windows SDK.

  7. jborean93 commented on Nov 23, 2020

    @jborean93
    Collaborator

    The only option is if MSFT makes ARSO public in Windows SDK.

    I'm not sure how that would change the security aspects of this functionality. For Windows to log automatically it would need to access your password which means however it is stored it needs to be reversible. There are ways to limit this by making it encrypted and only reversible by admins on the host. Even if it was exposed as an API in Windows the end result will be the same, there are just less steps for us to take.

    I'm neither +1 or -1 on this feature. I can only talk about the Windows side of things and mention that this has some security risks but there are ways to slightly mitigate them.

  8. iSazonov commented on Nov 24, 2020

    @iSazonov
    Collaborator

    this has some security risks but there are ways to slightly mitigate them.

    It is very sensitive area. It is a common rule to delegate such things to OS. If a security hole is found, it will be fixed there.

  9. stevenjudd commented on Jan 26, 2021

    @stevenjudd
    Author

    Jordan Borean (@jborean93), I think the security risks are assumed. The goal is to enable the same level of functionality available to shutdown.exe to the Restart-Computer and Stop-Computer cmdlets. This would allow someone to be able to get the expected functionality from PowerShell where as it stands now they must use shutdown.exe to get the functionality.

  10. TobiasPSP commented on Oct 14, 2021

    @TobiasPSP
    Collaborator

    After thorough debate, the cmdlet WG concluded:
    A platform-specific feature for which a native command exists generally is easily accessible from within PowerShell as-is. For example, it is trivial on a Windows system to use shutdown.exe in a PowerShell script.
    Using native commands may not be easily discoverable, though: the PowerShell help system wouldn't suggest this native command or provide help. This part could indeed be solved by adding the functionality to a core cmdlet.
    On the down side, this would decrease consistency and user experience on non-targeted systems though.
    So for platform specific features, the cmdlet WG recommends to continue to directly use appropriate native commands provided by the particular platform on the platforms where it is available. If additional PowerShell-specific functionality like risk mitigation (-whatif) etc is needed - native commands can easily be wrapped inside a PowerShell function.
    For these reasons, the issue was closed, and we hope our reasoning resonates with the community.

  11. iSazonov commented on Oct 14, 2021

    @iSazonov
    Collaborator

    Since it (ARSO) is public API it could be new cmdlet in a custom public project.

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-EnhancementResolution-DeclinedWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions