从AWS PowerShell lambda连接ExchangeOnline引发PSRemotingTransportE



我正在尝试从AWS Powershell Lambda函数连接到交换机。该脚本在本地运行良好,但从AWS执行时抛出以下错误。

Powershell脚本:

#Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.618.0'}
#Requires -Modules @{ModuleName='ExchangeOnlineManagement';ModuleVersion='2.0.4'}
Connect-ExchangeOnline 

错误消息:

{
"errorType": "PSRemotingTransportException",
"errorMessage": "This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.",
"stackTrace": [
"at Amazon.Lambda.PowerShellHost.PowerShellFunctionHost.ExecuteFunction(Stream inputStream, ILambdaContext context)",
"at lambda_method(Closure , Stream , Stream , LambdaContextInternal )"
],
"cause": {
"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 System.Management.Automation.Remoting.Client.WSManNativeApi.WSManInitialize(Int32 flags, IntPtr& wsManAPIHandle)",
"at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()"
]
}
}

对于任何看到这一点的人来说,答案是,你不能!AWS Lambda PowerShell是PowerShell核心。您当前无法在PowerShell Core中运行ExchangeOnline PowerShell命令。仅在Windows系统上的Windows Powershell中。

最新更新