GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `Start-Process` on Windows: `-Environment` is quietly ignored when `-Verb RunAs` is also specified, combination should be prevented. · Issue #20923 · PowerShell/PowerShell

Start-Process on Windows: -Environment is quietly ignored when -Verb RunAs is also specified, combination should be prevented. #20923

New issue
Copy link
New issue
Copy link
Closed
Closed
Start-Process on Windows: -Environment is quietly ignored when -Verb RunAs is also specified, combination should be prevented.#20923
Copy link
Labels
Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors

Description

@mklement0
Michael Klement (mklement0)
opened on Dec 14, 2023
Issue body actions

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
  • Refer to the FAQ.
  • Refer to Differences between Windows PowerShell 5.1 and PowerShell.

Steps to reproduce

Note:

  • I'm assuming that the underlying .NET / Windows APIs don't support this combination; if so, an error should be reported.

  • Indeed the .NET APIs actively prevent the analogous combination (not sure about direct use of the WinAPI): .Verb = "RunAs" requires .UseShellExecute = true, which in turn actively prevents modifying the environment via .Environment or .EnvironmentVariables (exception "The Process object must have the UseShellExecute property set to false in order to use environment variables.").

Start-Process -Verb RunAs cmd -Environment @{ foo='new' } '/c "echo [%foo%]" & pause' -Wait

Expected behavior

An error indicating that the specific parameter combination isn't supported.

Actual behavior

The process is launched, and the -Environment argument is quietly ignored.

[%foo%]

Error details

No response

Environment data

PowerShell 7.4.0 on W11 22H2

Visuals

No response

Activity

  1. Michael Klement (mklement0)
    added
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Dec 14, 2023
  2. StevenBucher98 commented on Dec 27, 2023

    @StevenBucher98
    Steven Bucher (StevenBucher98)
    on Dec 27, 2023
    Collaborator
    More actions

    Indeed the .NET APIs actively prevent the analogous combination

    Sounds like its an issue with .NET, have you opened an issue in there repo?

  3. Steven Bucher (StevenBucher98)
    added
    Resolution-ExternalThe issue is caused by external component(s).
    Waiting - DotNetCorewaiting on a fix/change in .NET
    and removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Dec 27, 2023
  4. mklement0 commented on Dec 27, 2023

    @mklement0
    Michael Klement (mklement0)
    on Dec 27, 2023
    ContributorAuthor
    More actions

    Steven Bucher (@StevenBucher98):

    • I can't speak to whether the by-design limitation in .NET is ultimately an unavoidable limitation in the Windows API.

      • I am not personally interested in researching this further.

      • If someone does, and if it turns out that the limitation could be overcome via a change in .NET, there's no guarantee that such a change would be made and, even if so, it would take a loooonng time for it to become available in PowerShell.

    • Therefore, I don't think the Resolution-External label is appropriate here.

      • Instead, this is an Issue-Bug, due to allowing you to specify unsupported parameter combinations without so much as a warning.

      • Another way to resolve this would be for PowerShell itself to work around the .NET limitation, via direct WinAPI calls if even possible.

  5. Steven Bucher (StevenBucher98)
    added
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    and removed
    Waiting - DotNetCorewaiting on a fix/change in .NET
    Resolution-ExternalThe issue is caused by external component(s).
    on Dec 27, 2023
  6. StevenBucher98 commented on Dec 27, 2023

    @StevenBucher98
    Steven Bucher (StevenBucher98)
    on Dec 27, 2023
    Collaborator
    More actions

    Marking up for grabs.

    Reacted by Michael Klement
  7. Steven Bucher (StevenBucher98)
    added
    Issue-BugIssue has been identified as a bug in the product
    on Dec 27, 2023
  8. microsoft-github-policy-service
    added
    Resolution-No ActivityIssue has had no activity for 6 months or more
    on Jun 25, 2024
  9. microsoft-github-policy-service commented on Jun 25, 2024

    @microsoft-github-policy-service
    microsoft-github-policy-serviceBot
    on Jun 25, 2024 – with Microsoft GitHub Policy Service
    Contributor
    More actions

    This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.

    Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.

  10. Steven Bucher (StevenBucher98)
    removed
    Resolution-No ActivityIssue has had no activity for 6 months or more
    on Jun 25, 2024
  11. microsoft-github-policy-service
    added
    Resolution-No ActivityIssue has had no activity for 6 months or more
    on Dec 22, 2024
  12. microsoft-github-policy-service commented on Dec 22, 2024

    @microsoft-github-policy-service
    microsoft-github-policy-serviceBot
    on Dec 22, 2024 – with Microsoft GitHub Policy Service
    Contributor
    More actions

    This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.

    Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.

  13. microsoft-github-policy-service
    closed this as completedon Dec 29, 2024
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-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.