Set-RDMUserTag
Synopsis
Set the tags of a user.
Syntax
__AllParameterSets
Set-RDMUserTag [-User] <IPSUser> [-Tag] <string[]> [-PassThru] [-Set]
[-ForcePromptAnswer <DialogResult[]>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Set the tags of a user. This replaces the tags on the user object; use the Set switch to save it, or pass the user to Set-RDMUser to persist the change. The list replaces the user's tags in full, so anything it does not name is cleared: to change one tag and keep the rest, start from the list returned by Get-RDMUserTag. Custom tags may only contain letters, digits, spaces and the characters . - _ : Contractor is not freely assignable: it identifies a contractor user, so it is refused on any other user and always kept on a contractor one, whether or not the list names it. Requires the permission to edit users.
Examples
Example 1
PS C:\> $user = Get-RDMUser -Name 'jdoe'
PS C:\> Set-RDMUserTag -User $user -Tag @('External', 'Finance', 'Tier 1')
PS C:\> Set-RDMUser $userReplaces every tag on the user jdoe, then saves the user. External becomes a system tag; Finance and Tier 1 become custom tags.
Example 2
Replaces every tag on the user jdoe and saves it in one call, without a separate Set-RDMUser.
Example 3
Tags the users whose description marks them as service accounts, then saves them. Starting from the user's own list is what keeps its other tags.
Example 4
Clears every tag on the user jdoe, then saves the user.
Parameters
-Confirm
Prompts for confirmation before running the cmdlet.
-ForcePromptAnswer
Switch to use with caution. It will automatically answer prompt asking yes/no, yes/no/cancel, or ok/cancel questions. In case of multiple prompts, multiple values can be passed to this parameter. Here are the accepted values:
Yes: Accept the prompt. Cover the OK and Automatic value.
No: Refuse the yes/no/cancel prompt. "Cancel" is the fallback option if there is no "No" option.
Cancel: Cancel the yes/no/cancel prompt. "No" is the fallback option if there is no "Cancel" option.
-PassThru
Return the modified user.
-Set
Save the modified user. Without it, the tags are only applied to the in-memory user object.
-Tag
Tags to assign, obtained from Get-RDMUserTag or given as a list of names. Replaces the user's tags in full: pass an empty array to clear them.
-User
User to tag, obtained from Get-RDMUser or New-RDMUser.
-WhatIf
Shows what would happen if the cmdlet were to run. The cmdlet does not run.
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
RemoteDesktopManager.PowerShellModule.PSOutputObject.PSUserInfo
User to tag, obtained from Get-RDMUser or New-RDMUser
RemoteDesktopManager.PowerShellModule.PSOutputObject.PSCloudUserInfo
Cloud user to tag, obtained from Get-RDMUser or New-RDMUser
Outputs
RemoteDesktopManager.PowerShellModule.PSOutputObject.PSUserInfo
User with the newly assigned tags when PassThru is specified
RemoteDesktopManager.PowerShellModule.PSOutputObject.PSCloudUserInfo
Cloud user with the newly assigned tags when PassThru is specified
Notes
For more information, type "Get-Help Set-RDMUserTag -detailed". For technical information, type "Get-Help Set-RDMUserTag -full".
Last updated
Was this helpful?