Skip to content

[Question] Do you have an example for Powershell remoting through lambda function? #3

Closed
@liacha1986

Description

@liacha1986

I have followed all the MS guides on setting up Powershell remoting on the server and can confirm from my test environment that I am able to SSH into my test box. I added the public key to my lambda function and referenced it with the command below:

$session = New-PSSession -HostName "mydc01.xyz.com" -UserName "Administrator" -KeyFilePath "$env:LAMBDA_TASK_ROOT/examplemodule/id_ed25519.pub"

I just get a generic message saying that "An error has occurred which Powershell cannot handle. A remote session might have ended".

The use case here is, I am trying to run some Get/Set-ADUser commands on my test domain users from the lambda function (tor reset AD passwords). Did a bunch of research and it seems powershell core doesn't have native support for the ActiveDirectory modules so I was trying to start a session and use the Invoke-Command cmdlet to run the command(s) I wanted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions