Just Enough Administration
 
$Name = (Read-Host "Domain\Username")
$Role = (Read-Host "Role")
$File = (Read-Host "File name")
$Path1 = "C:\Program Files\WindowsPowerShell\$File.pssc"
$Path2 = "C:\Program Files\WindowsPowerShell\Modules\JEA\RoleCapabilities\$File.psrc"
$RD = @{ $Name = @{ RoleCapabilities = $Role }}
$RRS = 'RestrictedRemoteServer'
$TDir = 'C:\Transcripts\'
New-PSSessionConfigurationFile -Path $Path1 -SessionType $RRS -TranscriptDirectory $TDir -RunAsVirtualAccount:$true -RoleDefinitions $RD
$Path1
New-PSRoleCapabilityFile -Path $Path2 -VisibleCmdlets 'get-disk','get-volume'
$Path2
Register-PSSessionConfiguration -Name $Role -Path $Path1