Remote connect new-pssession fails - Unable to load shared library 'libpsrpclient' or one of its dependencies.
Followed the steps given in the URL and deployed below Powershell Core script as a Lambda Function.
--------------------------------------- Script ---------------------------------
#Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.335.0'}
$pw = convertto-securestring -AsPlainText -Force -String "Password" $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "UserID",$pw
$s = new-pssession -computername "AWSECS2DNS" -credential $cred
Invoke-Command -Session $s -ScriptBlock {Get-Service}
When trigger the Lambda function, It fails. This Powershell script tries to remote connect a Windows EC2 Instance and run Commandlet "Get-Service". It fails at the Commandlet "new-pssession". Same script runs fine in Windows Computer powershell.
--------------------------------------- Error -----------------------------------------------
{ "errorType": "DllNotFoundException", "errorMessage": "Unable to load shared library 'libpsrpclient' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibpsrpclient: cannot open shared object file: No such file or directory", "stackTrace": [ "at Amazon.Lambda.PowerShellHost.PowerShellFunctionHost.ExecuteFunction(Stream inputStream, ILambdaContext context)", "at lambda_method(Closure , Stream , Stream , LambdaContextInternal )" ] }
I have noticed the same problem when attempting to deploy a powershell lambda function. Executes locally correctly, but fails in lambda with the above error.
Same here, I notice the Get-PSSesssionOption is also missing. I'm thinking the Publish-AWSPowershellLambda is not capturing all the DLLs for PSCore into the zip.
This may also be relevant, they changed libpsrpclient to psrp, maybe something in the code didn't get the memo: https://github.com/PowerShell/PowerShell/pull/3477
Hi @softwaresamuraisarathy,
Good afternoon.
I was going through backlog and came across this issue. Please refer the forum article https://forums.aws.amazon.com/thread.jspa?messageID=918094 for possible solution. Kindly note that Lambda works on minimal RHEL image. Let me know if it works for you.
Thanks, Ashish
This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
The solutions suggested in the AWS forums doesn't work for me. I'm on MacOS and can't seem to find following dependecies : The missing deps are: libcrypto.so.1.0.0 libssl.so.1.0.0
I copied them from /opt/microsoft/powershell/6/ to ~/.nuget/packages/microsoft.powershell.native/6.1.0/runtimes/linux-x64/native.