Freigeben über


Get-SCSMUserRole

Get-SCSMUserRole

Retrieves user roles that are defined in Service Manager.

Syntax

Parameter Set: FromDisplayName
Get-SCSMUserRole [[-DisplayName] <String[]> ] [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromId
Get-SCSMUserRole [-Id] <Guid[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Parameter Set: FromName
Get-SCSMUserRole [-Name] <String[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]

Detailed Description

The Get-SCSMUserRole cmdlet retrieves user role profiles that are defined in Service Manager. You can then use this list to add users to one of the user role profiles. Optionally, you can provide a regular expression to search for a specific user role profile.

Parameters

-ComputerName<String[]>

Specifies the name of the computer on which the System Center Data Access service runs. The user account that is specified in the Credential parameter must have access rights to the specified computer.

Aliases

none

Required?

false

Position?

named

Default Value

localhost

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the credentials that this cmdlet uses to connect to the server on which the System Center Data Access service runs. The specified user account must have access rights to that server.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-DisplayName<String[]>

Specifies the display name of the user role to retrieve. You can specify a regular expression.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Id<Guid[]>

Specifies the ID of the user role to retrieve.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String[]>

Specifies the name of the user role to retrieve. You can specify a regular expression.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SCSession<Connection[]>

Specifies an object that represents a session to a Service Manager management server.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

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.

  • System.String

    You can pipe a name to the DisplayName parameter.

  • System.Guid

    You can pipe a GUID to the Id parameter.

Outputs

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

  • Microsoft.EnterpriseManagement.ServiceManager.Sdk.UserRoles.Role

    The UserRole object provides the information about the Service Manager User Roles. This object can be used in conjunction with the Update-SCSMUserRole cmdlet to add a user to a user role.

Examples

Example 1: Get the user roles for the local computer

This command retrieves the list of user roles from the local computer.

PS C:\>Get-SCSMUserRole

Example 2: Get the Administrators role

This command retrieves the Administrators user role.

PS C:\>Get-SCSMUserRole -Name "Administrators"

Example 3: Get the Administrators role for a specific computer

This command retrieves the Administrators user role from the Service Manager instance that is running on the computer that has the specified name.

PS C:\>Get-SCSMUserRole -Name "Administrators" -ComputerName "WIN-752RWDX24M"

Example 4: Display the classes of a role

The first command gets the user role named CustomRole, and then stores it in the $Role variable.

The second command displays the contents of $Role.

The third command displays the classes of $Role.

PS C:\>$Role = Get-SCSMUserRole -DisplayName "CustomRole"
PS C:\> $Role
PS C:\> $Role.Classes

New-SCSMUserRole

Remove-SCSMUserRole

Update-SCSMUserRole