Editar

Partilhar via


Test-PswaAuthorizationRule

Verifies whether a rule exists for a specified user, computer, or endpoint.

Syntax

Test-PswaAuthorizationRule
    [-ComputerName] <String>
    [[-ConfigurationName] <String>]
    [-Credential <PSCredential>]
    [-Rule <PswaAuthorizationRule[]>]
    [-UserName] <String>
    [<CommonParameters>]
Test-PswaAuthorizationRule
    [[-ConfigurationName] <String>]
    [-Credential <PSCredential>]
    [-ConnectionUri] <Uri>
    [-Rule <PswaAuthorizationRule[]>]
    [-UserName] <String>
    [<CommonParameters>]

Description

The Test-PswaAuthorizationRule cmdlet verifies whether a rule exists for a specified user, computer, or endpoint. This cmdlet can also be used to test authorization rules to validate that a particular 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.

Examples

EXAMPLE 1

PS C:\> Test-PswaAuthorizationRule -ComputerName srv2.contoso.com -UserName contoso\mhanson -ConfigurationName test

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

EXAMPLE 2

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

This example tests all authorization rules to check which authorization rules apply to the user contoso\mhanson.

Parameters

-ComputerName

Specifies the name of the computer to test.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ConfigurationName

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

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConnectionUri

Specifies the connection URI to test.

Type:Uri
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies a PSCredential object for a user account that you want to use to test Windows PowerShell Web Access authorization rules. If you do not add this parameter, the cmdlet uses the currently logged-on user account. To get a PSCredential object, which is required to test authorization rules remotely, run the Get-Credentialhttp://go.microsoft.com/fwlink/?LinkID=293936 cmdlet.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Rule

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

Type:PswaAuthorizationRule[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UserName

Specifies the name of the user to test.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Management.PowerShellWebAccess.PswaAuthorizationRule[]

This cmdlet accepts a PswaAuthorizationRule object as input.

Outputs

Microsoft.Management.PowerShellWebAccess.PswaAuthorizationRule[]

This cmdlet produces a PswaAuthorizationRule object as output.