Skip to content

Instantly share code, notes, and snippets.

@raandree
Last active October 18, 2019 19:25
Show Gist options
  • Save raandree/54fd682980ffa3bdac67abf456d70f13 to your computer and use it in GitHub Desktop.
Save raandree/54fd682980ffa3bdac67abf456d70f13 to your computer and use it in GitHub Desktop.
JEA: Connect to a administrative endpoint created by 'New-RestrictedPSSessionConfiguration.ps1'
function Connect-SupportSession
{
param(
[Parameter(Mandatory)]
[string]$ComputerName,
[pscredential]$Credential
)
$s = New-PSSession @PSBoundParameters -ConfigurationName Support #-ErrorAction SilentlyContinue
if (-not $s)
{
Write-Error "The session to $ComputerName could not be created"
return
}
$module = Import-PSSession -Session $s -AllowClobber
Write-Host "Session to '$ComputerName' created and published the following commands:"
foreach ($command in $module.ExportedCommands.Keys)
{
Write-Host "`t$command"
}
}
$cred = New-Object pscredential('contoso\Sue', ('Somepass1' | ConvertTo-SecureString -AsPlainText -Force))
Connect-SupportSession -ComputerName dsctfs01 -Credential $cred
#Reset-AAPassword -Idengettity a411677
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment