Skip to content

Instantly share code, notes, and snippets.

@jhochwald
Last active May 26, 2017 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhochwald/910300a5a9c87abfcaa48227975e4366 to your computer and use it in GitHub Desktop.
Save jhochwald/910300a5a9c87abfcaa48227975e4366 to your computer and use it in GitHub Desktop.
# Cleanup
Get-PswaAuthorizationRule | Remove-PswaAuthorizationRule -Force
$paramAddPswaAuthorizationRule = @{
UserGroupName = 'DOMAIN\ACCESS-GROUP'
ComputerGroupName = 'DOMAIN\COMPUTER-GROUP'
ConfigurationName = 'Microsoft.PowerShell'
RuleName = 'Admin Rule for PowerShell Remote Web Access via Gateway'
Force = $true
ErrorAction = 'Stop'
WarningAction = 'SilentlyContinue'
}
try
{
# No output
$null = (Add-PswaAuthorizationRule @paramAddPswaAuthorizationRule)
} catch
{
Write-Error -Message 'Unable to create the PowerShell Remote Web Access Rule' -ErrorAction Stop
}
# Get Info
Get-PswaAuthorizationRule
<#
Id RuleName User Destination ConfigurationName
-- -------- ---- ----------- -----------------
0 Admin Rule fo... DOMAIN\ACCESS-GROUP DOMAIN\COMPUTER-GROUP Microsoft.PowerShell
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment