Remote Desktop Cmdlets in Windows PowerShell

Windows PowerShell® is a task-based command-line shell and scripting language designed especially for system administration. This reference topic for the information technology (IT) professional provides assistance in utilizing the Windows PowerShell cmdlets to script and automate tasks.

Remote Desktop Services Cmdlets

This reference provides cmdlet descriptions and syntax for all Remote Desktop Service-specific cmdlets. It lists the cmdlets in alphabetical order based on the verb at the beginning of the cmdlet.

Cmdlet Description

Add-RDServer

Adds an RDS server to a Remote Desktop deployment.

Add-RDSessionHost

Adds one or more RD Session Host servers to a session collection.

Add-RDVirtualDesktopToCollection

Adds virtual desktops to a virtual desktop collection.

Disable-RDVirtualDesktopADMachineAccountReuse

Prevents the RD Connection Broker server from reusing existing Active Directory (AD) computer accounts.

Disconnect-RDUser

Disconnects a user from a session that runs on a remote server.

Enable-RDVirtualDesktopADMachineAccountReuse

Configures the RD Connection Broker server to reuse existing AD DS computer accounts.

Export-RDPersonalVirtualDesktopAssignment

Exports the current associations between users and personal virtual desktops to a file.

Get-RDAvailableApp

Retrieves a list of publishable applications from a collection.

Get-RDCertificate

Gets certificates associated with RDS roles.

Get-RDConnectionBrokerHighAvailability

Gets high availability settings for the RD Connection Broker server in a Remote Desktop deployment.

Get-RDDeploymentGatewayConfiguration

Gets configuration settings for the RD Gateway for a Remote Desktop deployment.

Get-RDFileTypeAssociation

Displays the file extensions associated with a RemoteApp program.

Get-RDLicenseConfiguration

Retrieves the current settings for the RD Licensing server and the licensing mode of the Remote Desktop deployment.

Get-RDPersonalVirtualDesktopAssignment

Retrieves a list of personal virtual desktops and associated user accounts.

Get-RDPersonalVirtualDesktopPatchSchedule

Gets a patch schedule for a virtual desktop.

Get-RDRemoteApp

Gets RemoteApp programs in a Remote Desktop deployment.

Get-RDRemoteDesktop

Gets published Remote Desktop connections.

Get-RDServer

Gets RDS servers in a Remote Desktop deployment.

Get-RDSessionCollection

Gets session collections in a Remote Desktop deployment.

Get-RDSessionCollectionConfiguration

Gets configuration information for a session collection.

Get-RDSessionHost

Gets a list of RD Session Host servers in a session collection.

Get-RDUserSession

Gets a list of all user sessions in a collection or in a Remote Desktop deployment.

Get-RDVirtualDesktop

Gets a list of virtual desktops in the remote desktop deployment.

Get-RDVirtualDesktopCollection

Gets a list of virtual desktop collections in a remote desktop deployment.

Get-RDVirtualDesktopCollectionConfiguration

Gets configuration settings of a virtual desktop collection.

Get-RDVirtualDesktopCollectionJobStatus

Gets the status of a job on a virtual desktop collection.

Get-RDVirtualDesktopConcurrency

Gets the number of virtual desktops that RDS can create in parallel.

Get-RDVirtualDesktopIdleCount

Gets the number of idle virtual desktops on hosts.

Get-RDVirtualDesktopTemplateExportPath

Gets the export path setting of the virtual desktop template.

Get-RDWorkspace

Gets the workspace name for a Remote Desktop deployment.

Grant-RDOUAccess

Grants the Remote Desktop Connection Broker (RD Connection Broker) server access to one or more organizational units (OUs) in a given domain of Active Directory Domain Services (AD DS).

Import-RDPersonalVirtualDesktopAssignment

Imports associations between user accounts and personal virtual desktops from a text file.

Invoke-RDUserLogoff

Ends a user session and closes all running applications.

Move-RDVirtualDesktop

Moves a virtual desktop to a new Remote Desktop Virtualization Host (RD Virtualization Host) server.

New-RDCertificate

Creates a certificate for an RDS role.

New-RDPersonalVirtualDesktopPatchSchedule

Creates a patch schedule for a personal virtual desktop.

New-RDRemoteApp

Publishes a RemoteApp program to a Remote Desktop deployment.

New-RDSessionCollection

Creates a session collection of RD Session Host servers.

New-RDSessionDeployment

Installs the required role services for session-based desktop deployment.

New-RDVirtualDesktopCollection

Creates a new virtual desktop collection.

New-RDVirtualDesktopDeployment

Installs role services for Virtual Desktop Infrastructure.

Remove-RDPersonalVirtualDesktopAssignment

Removes the association between a personal virtual desktop and a user.

Remove-RDPersonalVirtualDesktopPatchSchedule

Removes a patch schedule from a personal virtual desktop.

Remove-RDRemoteApp

Removes a RemoteApp program.

Remove-RDServer

Removes a server from a Remote Desktop deployment.

Remove-RDSessionCollection

Removes a session collection from a Remote Desktop deployment.

Remove-RDSessionHost

Removes one or more RD Session Host servers from a session collection.

Remove-RDVirtualDesktopCollection

Removes a virtual desktop collection.

Remove-RDVirtualDesktopFromCollection

Removes virtual desktops from a virtual desktop collection.

Send-RDUserMessage

Sends a system message to a specified user session.

Set-RDActiveManagementServer

Sets the active Remote Desktop Connection Broker (RD Connection Broker) server, or management server, in a remote desktop deployment.

Set-RDCertificate

Imports and secures a certificate to use with an RDS role.

Set-RDClientAccessName

Sets a DNS name that clients use to connect to a Remote Desktop deployment.

Set-RDConnectionBrokerHighAvailability

Sets high availability settings for RD Connection Broker servers for a Remote Desktop deployment.

Set-RDDatabaseConnectionString

Configures the database connection string for the SQL Server database used in high availability environments.

Set-RDDeploymentGatewayConfiguration

Specifies settings for the RD Gateway server for a Remote Desktop deployment.

Set-RDFileTypeAssociation

Changes the file type association of a RemoteApp program in a Remote Desktop deployment.

Set-RDLicenseConfiguration

Defines settings for the RD Licensing server and the licensing mode of the Remote Desktop deployment.

Set-RDPersonalVirtualDesktopAssignment

Creates an association between a personal virtual desktop and a user account.

Set-RDPersonalVirtualDesktopPatchSchedule

Changes patch schedule settings for a personal virtual desktop.

Set-RDRemoteApp

Modifies configuration settings for a RemoteApp program.

Set-RDRemoteDesktop

Changes whether to publish a Remote Desktop to a collection.

Set-RDSessionCollectionConfiguration

Modifies configuration options for an existing session collection.

Set-RDSessionHost

Configures one or more RD Session Host servers in a session collection.

Set-RDVirtualDesktopCollectionConfiguration

Changes configuration settings for a virtual desktop collection.

Set-RDVirtualDesktopConcurrency

Sets the number of virtual desktops that RDS can create in parallel.

Set-RDVirtualDesktopIdleCount

Sets the maximum number of idle virtual desktops on host servers.

Set-RDVirtualDesktopTemplateExportPath

Sets the export path for virtual desktop templates.

Set-RDWorkspace

Assigns a workspace name for a Remote Desktop deployment.

Stop-RDVirtualDesktopCollectionJob

Stops a job on a virtual desktop collection.

Test-RDOUAccess

Verifies that the Remote Desktop Connection Broker (RD Connection Broker) server can access an Active Directory Domain Services (AD DS) organizational unit (OU).

Test-RDVirtualDesktopADMachineAccountReuse

Detects whether the RD Connection Broker server is configured to reuse existing AD DS computer accounts.

Update-RDVirtualDesktopCollection

Associates a virtual desktop collection with a new virtual desktop template.

备注

To list all the cmdlets that are available, use the Get-Command –Module RemoteDesktopServices cmdlet.

For more information about, or for the syntax of, any of the cmdlets, use the Get-Help <cmdlet name> cmdlet, where <cmdlet name> is the name of the cmdlet that you want to research. For more detailed information, you can run any of the following cmdlets:

Get-Help <cmdlet name> -Detailed
Get-Help <cmdlet name> -Examples
Get-Help <cmdlet name> -Full