How to create a powershell session with a specific configuration context

How to create a powershell session with a specific configuration context

avatar

PowerShell Virtual Account leverages Just Enough Administration (JEA) to work around Windows Update API restrictions that prevent calling updates from remote sessions.

https://learn.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/session-configurations?view=powershell-7.2

We run the following commands on the server to create a "VirtualAccount" configuration context.

New-PSSessionConfigurationFile -RunAsVirtualAccount -Path .\VirtualAccount.pssc
Register-PSSessionConfiguration -Name 'VirtualAccount' -Path .\VirtualAccount.pssc -Force

This creates a persistent virtualaccount session context. We then use the following command to connect to that specific session from our workstations.

Enter-PSSession -ComputerName <hostname> -Credential <domain\username> -ConfigurationName 'VirtualAccount'

The question I have for the devs is, how would we leverage RDM to connect to a remote server being able to specify the ConfigurationName ?

All Comments (9)

avatar

Hell hazen,

The configuration name could be saved in the custom fields, and then referenced with the variable $CUSTOM_FIELD#$ in your PowerShell script of RDM:

It could also be saved at a folder level, and the referenced with $FOLDER_CUSTOM_FIELD1$. To view all the possible variables, you can click on the "Variables" button in the bottom left corner of any entry:

Best regards,

Richard Boisvert

avatar

where are you accessing the above settings? You aren't clear how you're getting to whatever menu's are in the screenshots.