Monday, September 12, 2022

Registering JEA sessions

 $cmds = @{ Name = 'Restart-Service'; Parameters = @{ Name = 'Name'; ValidateSet = 'wuauserv', 'Spooler' }},@{ Name = 'Get-Service'; Parameters = @{ Name = 'Name'; ValidateSet = 'wuauserv', 'Spooler' }}


New-PSSessionConfigurationFile -SessionType Empty -ModulesToImport Microsoft.PowerShell.Management -VisibleCmdlets $cmds -Path .\GetService.pssc -RunAsVirtualAccount



Register-PSSessionConfiguration -Name GetService -Path .\GetService.pssc


Set-PSSessionConfiguration -Name GetService -ShowSecurityDescriptorUI -Force