次の方法で共有


Test-PswaAuthorizationRule

Test-PswaAuthorizationRule

Tests whether a rule exists.

Syntax

Parameter Set: ComputerName
Test-PswaAuthorizationRule [-UserName] <String> [-ComputerName] <String> [[-ConfigurationName] <String> ] [-Rule <PswaAuthorizationRule[]> ] [ <CommonParameters>]

Parameter Set: ConnectionUri
Test-PswaAuthorizationRule [-UserName] <String> [-ConnectionUri] <Uri> [[-ConfigurationName] <String> ] [-Rule <PswaAuthorizationRule[]> ] [ <CommonParameters>]

Detailed Description

The Test-PswaAuthorizationRule cmdlet tests whether a rule exists for a user, computer, or endpoint. This cmdlet can also be used to test authorization rules to validate that a user, computer or endpoint access request is authorized.

By default, this cmdlet evaluates all rules in the authorization file. However, you can specify a subset of rules to test.

You can use this cmdlet to help troubleshoot authentication failures.

The parameters for this cmdlet correspond to fields on the Windows PowerShell® Web Access sign-on page.

Parameters

-ComputerName<String>

Specifies the name of the computer to test.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ConfigurationName<String>

Specifies the name of the Windows PowerShell session configuration, also known as endpoint or runspace, to test.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ConnectionUri<Uri>

Specifies the connection URI to test.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Rule<PswaAuthorizationRule[]>

Specifies a subset of rules to test. If this parameter is not specified, then this cmdlet tests against all authorization rules.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-UserName<String>

Specifies the name of the user to test.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.Management.PowerShellWebAccess.PswaAuthorizationRule[]

    This cmdlet accepts a PswaAuthorizationRule object as input.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.PowerShellWebAccess.PswaAuthorizationRule[]

    This cmdlet produces a PswaAuthorizationRule object as output.

Examples

EXAMPLE 1: Test all rules for a user to display computer and session configuration rules

This command tests all authorization rules in order to display all the rules that allow the user contoso\pfuller to connect to the computer srv20 and use a Windows PowerShell session configuration named test.

PS C:\> Test-PswaAuthorizationRule -ComputerName "srv20.contoso.com" -UserName "contoso\pfuller" -ConfigurationName "test"

EXAMPLE2: Test all authorization rules to see which apply to a user

This command tests all authorization rules to check which authorization rules apply to the user contoso\pfuller.

PS C:\> Test-PswaAuthorizationRule -UserName "contoso\pfuller" -ComputerName "*"

Add-PswaAuthorizationRule

Get-PswaAuthorizationRule

Remove-PswaAuthorizationRule

Install-PswaWebApplication