Skip to content

Running powershell -command 'Get-FileHash' fails #8635

Description

Steps to reproduce

powershell -noprofile -command "(get-filehash $PSHOME\powershell.exe).hash"

Expected behavior

DE96A6E69944335375DC1AC238336066889D9FFC7D73628EF4FE1B1B160AB32C

Actual behavior

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:2
+ (get-filehash C:\Windows\System32\WindowsPowerShell\v1.0\powershell.e ...
+  ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (get-filehash:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Actual behavior on a different computer

get-filehash : The 'get-filehash' command was found in the module 'Microsoft.PowerShell.Utility', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'.
At line:1 char:2
+ (get-filehash $pshome\powershell.exe).hash
+  ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (get-filehash:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

Environment data

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

Activity

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-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-DuplicateThe issue is a duplicate.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions