Search code examples
powershellopensslwindows-server-2012

Powershell openssl ObjectNotFound in windows server 2012


while trying to convert the private key file in PKCS12 format to PEM format (which is used by Wireshark) in two stages by using the openssl tool got the below error

PS C:\OpenSSL-Win64\bin> openssl pkcs12 -nodes -in test_cer123456.pfx -out key.pem -nocerts -nodes
openssl : The term 'openssl' 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
+ openssl pkcs12 -nodes -in test_cer123456.pfx -out key.pem -nocerts -nodes
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (openssl:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command openssl was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by
default. If you trust this command, instead type ".\openssl". See "get-help about_Command_Precedence" for more details.
PS C:\OpenSSL-Win64\bin>

Could some one help me on this.?

Note : I was following this post


Solution

  • Powershell doesn't include current directory as a part of search path. The error message actually tells you this and explains what to do (emphasis added):

    Suggestion [3,General]: The command openssl was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type ".\openssl". See "get-help about_Command_Precedence" for more details.