Created
March 22, 2019 01:57
-
-
Save thepoppingone/4389bb360717c169934f759fd542fabb to your computer and use it in GitHub Desktop.
Restart RDP service of Windows Instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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