Skip to content

Start-Process -Credential prevents interactive input in both the caller and the new window #12129

Closed
@mklement0

Description

@mklement0

This is a long-standing bug that also affects Windows PowerShell.

On Windows, -Credential can be used to start a process in a new window with a given user identity.

Currently, doing so effectively prevents interactive use of both the caller's window and the new window, because they seem to be competing for keyboard input.

Note: Curiously, if you start powershell.exe specifically, the problem does not occur; other shells, however - such as pwsh itself and cmd - do exhibit the problem.

Update:

Steps to reproduce

On Windows (update: problem verified on Windows 10 versions 1809 and 1909 - see (Get-ComputerInfo).WindowsVersion)

# Enter a different user's credentials (or even your own) when prompted.
Set-Location C:\; Start-Process cmd -Credential (Get-Credential)

Expected behavior

The call should return after having launched the cmd process and both the calling shell and the cmd shell in the new window should function normally and independently.

Actual behavior

Typing in either window either has no effect or sometimes makes what was typed show up in the respective other window.

Behavior returns to normal when the new window is closed.

Environment data

PowerShell Core v7.0.0 (7.0.0) on Microsoft Windows 10 Pro (64-bit; Version 1909, OS Build: 18363.720)

Workarounds

  • Use runas.exe

  • Launch the initial process hidden, non-interactively, and use it as an intermediary to launch an interactive session in a new, visible window; e.g.:

Start-Process -WindowStyle Hidden -Credential (Get-Credential) cmd '/c start cmd' -WorkingDirectory c:\

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productOS-WindowsResolution-ExternalThe issue is caused by external component(s).WG-Cmdletsgeneral cmdlet issuesWG-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