Last active
October 18, 2019 19:25
-
-
Save raandree/54fd682980ffa3bdac67abf456d70f13 to your computer and use it in GitHub Desktop.
JEA: Connect to a administrative endpoint created by 'New-RestrictedPSSessionConfiguration.ps1'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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