MS RDS Cheatsheet PowerShell
Posted: 24 Jun 2023, 10:49
PRE-REQUISITE: the remotedesktop PowerShell module
Many commands described here are part of the PowerShell remotedesktop module.
So, firstly, you have to import the 'remotedesktop' module
Than, you can have a look at all of them (70+) simply giving this command:
Lastly, if you need to get help on them, use this command:
example:
Lastly, remember that the Get-Help has 5 level of details
BASIC LEVEL OF DETAILS: Get-Help <command> with no other parameters
EXAMPLE: Get-Help <command> -Examples
DETAILED LEVEL OF DETAILS: Get-Help <command> -Detailed
FULL LEVEL OF DETAILS: Get-Help <command> -Full
ONLINE PAGE: Get-Help <command> -Online - this will open a web page from Microsoft website
===========================================
Ends a user session and closes all running applications
Disconnect a specified user from a session that runs on the remote server
All applications continue to run.
Many commands described here are part of the PowerShell remotedesktop module.
So, firstly, you have to import the 'remotedesktop' module
Code: Select all
Import-Module remotedesktop
Code: Select all
Get-Command -Module remotedesktop
Code: Select all
Get-Help <command>
Code: Select all
Get-Help Invoke-RDUserLogoff
BASIC LEVEL OF DETAILS: Get-Help <command> with no other parameters
EXAMPLE: Get-Help <command> -Examples
DETAILED LEVEL OF DETAILS: Get-Help <command> -Detailed
FULL LEVEL OF DETAILS: Get-Help <command> -Full
ONLINE PAGE: Get-Help <command> -Online - this will open a web page from Microsoft website
===========================================
Ends a user session and closes all running applications
Code: Select all
Invoke-RDUserLogoff
===========================================HINT: You should use the -force parameter if you need to close the user's session without asking for confirmation
Disconnect a specified user from a session that runs on the remote server
All applications continue to run.
Code: Select all
Disconnect-RDUser