Skip to content

Instantly share code, notes, and snippets.

@thepoppingone
Created March 22, 2019 01:57
Show Gist options
  • Save thepoppingone/4389bb360717c169934f759fd542fabb to your computer and use it in GitHub Desktop.
Save thepoppingone/4389bb360717c169934f759fd542fabb to your computer and use it in GitHub Desktop.
Restart RDP service of Windows Instance
Function Restart-RdpServices {
<#
.SYNOPSIS
Restarts services related to RDP.
.DESCRIPTION
Restarts services related to RDP: 'TermService' and 'Remote Desktop Services UserMode Port Redirector'
.PARAMETER ComputerName
ComputerName that will have it RDP related services restarted.
.EXAMPLE
Nuke-RDP -ComputerName 'Contoso1'
#>
param([string]$ComputerName = $env:computerName)
Get-Service -ComputerName $ComputerName -Name 'Remote Desktop Services UserMode Port Redirector' | Stop-Service -Force -Verbose
Get-Service -ComputerName $ComputerName -Name 'TermService' | Stop-Service -Force -Verbose
Get-Service -ComputerName $ComputerName -Name 'TermService' | Start-Service -Verbose
Get-Service -ComputerName $ComputerName -Name 'Remote Desktop Services UserMode Port Redirector' | Start-Service -Verbose
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment