Revoke-SCResource

Revokes access to a resource from a user or user role.

Syntax

Revoke-SCResource
      [-VMMServer <ServerConnection>]
      -Resource <ClientObject>
      [-UserRoleName <String[]>]
      [-UserRoleID <Guid[]>]
      [-UserName <String>]
      [-JobGroup <Guid>]
      [-RunAsynchronously]
      [-PROTipID <Guid>]
      [-JobVariable <String>]
      [-OnBehalfOfUser <String>]
      [-OnBehalfOfUserRole <UserRole>]
      [<CommonParameters>]

Description

The Revoke-SCResource cmdlet revokes access to a resource from a user or user role.

Examples

Example 1: Revoke access to a resource from a specific user

PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "Template01"} 
PS C:\> Revoke-SCResource -Resource $Resource -Username "Contoso\Katarina"

The first command gets the template object named Template01 and stores the object in the $Resource variable.

The second command revokes access to the resource stored in $Resource (Template01) from the user named Katarina. If the user is a member of multiple user roles, access will be revoked from the user in all of its user roles.

Example 2: Revoke access to a resource from a user who is a member of multiple user roles

PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "Template01"}
PS C:\> Revoke-SCResource -Resource $Resource -Username "Contoso\Katarina" -UserRoleName @("ContosoSelfServiceUsers", "SelfServiceUserRole02")

The first command gets the template object named Template01 and stores the object in the $Resource variable.

The second command revokes access to the resource stored in $Resource (Template01) from the user named Katarina, but only if the user is using the ContosoSelfServiceUsers or SelfServiceUserRole02 user roles. If Katarina uses a different user role that has access to the resource then she will still be able to access the resource.

Example 3: Revoke access to a resource from all members of a user role

PS C:\> $Resource = Get-SCVMTemplate | where {$_.Name -eq "Template01"}
PS C:\> Revoke-SCResource -Resource $Resource -UserRoleName "ContosoSelfServiceUsers"

The first command gets the template object named Template01 and stores the object in the $Resource variable.

The second command revokes access to the resource stored in $Resource (Template01) from all members of the ContosoSelfServiceUsers user role.

Parameters

-JobGroup

Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs.

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

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

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

-OnBehalfOfUser

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

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

-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

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

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

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

-Resource

Specifies a resource object.

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

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

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

-UserName

Specifies a the name of a user. Enter a user name with the format Domain\User.

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

-UserRoleID

Specifies the ID of a user role.

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

-UserRoleName

Specifies the name of a user role. Types of user roles that are named include Delegated Administrator, Read-Only Administrator, and Self-Service User.

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

-VMMServer

Specifies a VMM server object.

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

Outputs

Resource

This cmdlet returns a Resource object.