Last active
May 26, 2017 20:40
-
-
Save jhochwald/910300a5a9c87abfcaa48227975e4366 to your computer and use it in GitHub Desktop.
Related to my article https://hochwald.net/configure-windows-powershell-web-access/
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
# 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