< Back

Remove-CrmSecurityRoleFromUser

Sat Jan 18, 2020 4:05 pm

NAME Remove-CrmSecurityRoleFromUser



SYNOPSIS

Removes a security role to a user.





SYNTAX

Remove-CrmSecurityRoleFromUser [-conn <CrmServiceClient>] [-UserRecord] <PSObject> [-SecurityRoleRecord]

<PSObject> [<CommonParameters>]



Remove-CrmSecurityRoleFromUser [-conn <CrmServiceClient>] [-UserId] <String> [-SecurityRoleId] <String>

[<CommonParameters>]





DESCRIPTION

The Remove-CrmSecurityRoleFromUser cmdlet lets you remove a security role to a user.



There are two ways to specify records.

1. Pass record's Id for both records.

2. Get a record object by using Get-CrmRecord/Get-CrmRecords cmdlets, and pass it for both records.





PARAMETERS

-conn <CrmServiceClient>

A connection to your CRM organization. Use $conn = Get-CrmConnection <Parameters> to generate it.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UserRecord <PSObject>

A user record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you

don't use UserId.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SecurityRoleRecord <PSObject>

A security role record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord,

then you don't use SecurityRoleId.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UserId <String>

An Id (guid) of user record



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SecurityRoleId <String>

An Id (guid) of security role record



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS









OUTPUTS









NOTES









-------------------------- Example 1 --------------------------



Remove-CrmSecurityRoleFromUser -conn $conn -UserId 00005a70-6317-e511-80da-c4346bc43d94 -SecurityRoleId

66005a70-6317-e511-80da-c4346bc43d94



This example removes a security role to a user by using Id.







-------------------------- Example 2 --------------------------



Remove-CrmSecurityRoleFromUser 00005a70-6317-e511-80da-c4346bc43d94 66005a70-6317-e511-80da-c4346bc43d94



This example removes a security role to a user by using Id by omitting parameters names.

When omitting parameter names, you do not provide $conn, cmdlets automatically finds it.







-------------------------- Example 3 --------------------------



PS C:\\>$user = Get-CrmRecord sysetmuser 00005a70-6317-e511-80da-c4346bc43d94 fullname



PS C:\\>$role = Get-CrmRecord role 66005a70-6317-e511-80da-c4346bc43d94 name



PS C:\\>Remove-CrmSecurityRoleFromUser $user $role



This example removes a security role to a user by using record objects.









RELATED LINKS