Skip to content

Powershell Framework is broken (again) under Powershell Core #18108

Description

@AssortedBits

Prerequisites

Steps to reproduce

C:\Users\keith.russell>pwsh
PowerShell 7.2.1
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

   A new PowerShell stable release is available: v7.2.6
   Upgrade now, or check out the release page at:
     https://aka.ms/PowerShell-Release?tag=v7.2.6

PS C:\Users\keith.russell> cmd
Microsoft Windows [Version 10.0.19044.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Users\keith.russell>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\keith.russell> get-filehash
get-filehash : The term 'get-filehash' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

### Expected behavior

```console
C:\Users\keith.russell>pwsh
PowerShell 7.2.1
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

   A new PowerShell stable release is available: v7.2.6
   Upgrade now, or check out the release page at:
     https://aka.ms/PowerShell-Release?tag=v7.2.6

PS C:\Users\keith.russell> cmd
Microsoft Windows [Version 10.0.19044.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Users\keith.russell>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\keith.russell> get-filehash
get-filehash : The term 'get-filehash' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Actual behavior

PS C:\Users\keith.russell> get-filehash

cmdlet Get-FileHash at command pipeline position 1
Supply values for the following parameters:
Path[0]:

Error details

get-filehash : The term 'get-filehash' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ get-filehash
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (get-filehash:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Environment data

PS C:\Users\keith.russell> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

  1. added
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Sep 16, 2022
  2. AssortedBits commented on Sep 16, 2022

    @AssortedBits
    Author

    NOTICE THE cmd.exe LAYER SANDWICHED IN THE MIDDLE. THIS IS NECESSARY TO MANIFEST THE BUG.

  3. iSazonov commented on Sep 16, 2022

    @iSazonov
    Collaborator

    Please re-check with latest 7.2.6 version and latest 7.3 Preview.

  4. jhoneill commented on Sep 16, 2022

    @jhoneill

    Ilya (@iSazonov) just tried it, it repos on both.

    What's odd is

    > (get-module Microsoft.PowerShell.Utility).exportedCommands.keys | where {$_ -like "Get-*"}
    Get-Alias
    Get-Culture
    Get-Date
    Get-Event
    Get-EventSubscriber
    Get-FormatData
    Get-Host
    Get-Member
    Get-PSBreakpoint
    Get-PSCallStack
    Get-Random
    Get-Runspace
    Get-RunspaceDebug
    Get-TraceSource
    Get-TypeData
    Get-UICulture
    Get-Unique
    Get-Variable
    

    Get-FileHash has gone missing. It's there in Pwsh and PowerShell.exe normally, but not if one follows the steps

  5. dkaszews commented on Sep 16, 2022

    @dkaszews
    Contributor

    That looks like a fun bug. Does Get-FileHash depend on some environment implementation like Get/Set-Clipboard on xclip? Maybe putting cmd in the middle causes the environment variables to get messed up?

  6. iSazonov commented on Sep 16, 2022

    @iSazonov
    Collaborator

    Get-FileHash id binary cmdlet in pwsh and script in Windows PowerShell. This says WinPS doesn't load Microsoft.PowerShell.Utility module in right way.

    Root of the issue both PowerShell modify PSModule environment variable to insert version specific paths.

    Obviously, this leads to conflict. While pwsh uses tricks to fix this WinPS knows nothing about it and works the same old way. Also pwsh cannot apply its tricks if it do not call WinPS directly.
    There have already been a few PRs made around this. Each time with different tricky bugs. There will probably be more attempts until a move is made to eliminate the conflict at the root.

    My suggestion was to abandon this practice (modify PSModule), but MSFT team says it will break some scenarios, but doesn't say which ones - apparently it's their big secret :-)

  7. kilasuit commented on Sep 24, 2022

    @kilasuit
    Collaborator

    Seems the Issue template managed to get broken on this issue

  8. tusharsnx commented on May 12, 2023

    @tusharsnx

    As a workaround, you can import WinPS compatible 'Microsoft.PowerShell.Utility' which contains 'Get-FileHash' function:

    Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash

    This can be run at the top of the script.

  9. nannerpusser commented on Aug 2, 2023

    @nannerpusser

    As a workaround, you can import WinPS compatible 'Microsoft.PowerShell.Utility' which contains 'Get-FileHash' function:

    Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash

    This can be run at the top of the script.

    For anyone having this crop up while using scoop (CLI or via WinGet UI, etc.) add that Import-Module command at the top of %SCOOP_DIR%\apps\scoop\current\lib\install.ps1 and carry on without frequent hash check failures.

  10. AssortedBits commented on Aug 4, 2024

    @AssortedBits
    Author

    The team auto-closes bugs with "no activity" as measured by comments. But this ticket has had multiple recent references from other bugs recently. Seems to me those should count as well as comments.

  11. 4 remaining items

  12. AssortedBits commented on May 14, 2025

    @AssortedBits
    Author

    (not completed, but won’t let me reopen)

  13. joffrey-bion commented on Jul 6, 2026

    @joffrey-bion

    This issue wasn't resolved, could it please be re-opened by someone with appropriate permissions?

  14. jazzdelightsme commented on Jul 10, 2026

    @jazzdelightsme
    Contributor

    This issue wasn't resolved, could it please be re-opened by someone with appropriate permissions?

    Joffrey Bion (@joffrey-bion) did you hit "The PSModulePath Problem", as described above? If so, the problem is environmental, not inside pwsh. If you hit some different problem, you probably need to open a new Issue.

  15. AssortedBits commented on Jul 14, 2026

    @AssortedBits
    Author

    This issue wasn't resolved, could it please be re-opened by someone with appropriate permissions?

    @joffrey-bion did you hit "The PSModulePath Problem", as described above? If so, the problem is environmental, not inside pwsh. If you hit some different problem, you probably need to open a new Issue.

    Dan Thompson (@jazzdelightsme) Happened with a clean, out-of-the-box env, as that comment you linked to also states can happen when there is an intervening cmd layer between pwsh and powershell. So, this is an actual design problem with either pwsh or powershell, until MS states in its documentation somewhere that they do not support running the latter under the former.

  16. joffrey-bion commented on Jul 15, 2026

    @joffrey-bion

    Yes, sorry I forgot to reply. It is indeed a PSModulePath problem for me, but I never set this env var myself. So I do consider it a problem with Powershell, and more specifically pwsh+Powershell combination.

    If the env is not compatible, I would expect the 2 tools to use different variables for their respective environments.

  17. added
    WG-NeedsReviewNeeds a review by the labeled Working Group
    and removed
    Resolution-No ActivityIssue has had no activity for 6 months or more
    on Jul 19, 2026
  18. kilasuit commented on Aug 6, 2026

    @kilasuit
    Collaborator

    AssortedBits - whilst this and #27774 are essentially the same issue, I am going to mark this one as as duplicate of that one, as the title on that is easier for us in coming back to and is more likely to be found in future & whilst I know that may seem like "Issue

    This is my comment in that issue & please follow that one for further updates.

    My question always when I see this sort of thing (irrespective of the PowerShell vs pwsh) is where is the benefit in the multiple layered approach going to grandchild/great-granchild/great-great-granchild etc

    Using Start-Process as opposed to direct calling of the python executable may help here with the -UseNewEnvironment parameter (not tested this as I don't have a python install to hand)

    I don't think we could do anything in this codebase to aid with pwsh -> other executable/s -> powershell other than perhaps provide guidance which would be docs updates.

  19. added and removed
    Issue-BugIssue has been identified as a bug in the product
    WG-Enginecore PowerShell engine, interpreter, and runtime
    WG-NeedsReviewNeeds a review by the labeled Working Group
    on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions