Skip to content

Set-ADUserRemoteDesktopSettings

SYNOPSIS

Configures Remote Desktop settings for an Active Directory user.

SYNTAX

Set-ADUserRemoteDesktopSettings [-Identity] <String> [[-AllowLogon] <Boolean>]
 [[-TerminalServicesProfilePath] <String>] [[-TerminalServicesHomeDirectory] <String>]
 [[-TerminalServicesHomeDrive] <String>] [-PassThru] [[-Credential] <PSCredential>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

The `Set-ADUserRemoteDesktopSettings` function configures Remote Desktop settings for a specified Active Directory user. It allows setting properties such as `AllowLogon`, `TerminalServicesProfilePath`, `TerminalServicesHomeDirectory`, and `TerminalServicesHomeDrive`. The function supports using credentials for authentication and can return the updated user object if requested.

EXAMPLES

EXAMPLE 1

Set-ADUserRemoteDesktopSettings -Identity "jdoe" -AllowLogon $true -TerminalServicesProfilePath "\\server\profiles\jdoe"

Configures Remote Desktop settings for the user "jdoe" and allows logon with the specified profile path.

EXAMPLE 2

Set-ADUserRemoteDesktopSettings -Identity "jdoe" -TerminalServicesHomeDirectory "\\server\home\jdoe" -TerminalServicesHomeDrive "H:"

Sets the home directory and home drive for the user "jdoe" in their Remote Desktop session.

EXAMPLE 3

Set-ADUserRemoteDesktopSettings -Identity "jdoe" -AllowLogon $false -Credential (Get-Credential)

Disables Remote Desktop logon for the user "jdoe" using the specified credentials.

PARAMETERS

-Identity

The identity of the Active Directory user (e.g., DistinguishedName or SamAccountName).

Type: String
Parameter Sets: (All)
Aliases: DN, DistinguishedName

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-AllowLogon

Specifies whether the user is allowed to log on via Remote Desktop.

Type: Boolean
Parameter Sets: (All)
Aliases:

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

-TerminalServicesProfilePath

The profile path for the user's Remote Desktop session.

Type: String
Parameter Sets: (All)
Aliases: Profile

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TerminalServicesHomeDirectory

The home directory for the user's Remote Desktop session.

Type: String
Parameter Sets: (All)
Aliases: HomeDirectory

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TerminalServicesHomeDrive

The home drive for the user's Remote Desktop session.

Type: String
Parameter Sets: (All)
Aliases: HomeDrive

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns the updated user object with the configured Remote Desktop settings.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Credential

The credential to use for querying and updating the Active Directory user. If not specified, the current user's context is used.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES