Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Script para Habilitar RDP Multiusuário no Windows 10

Script:

# Script para habilitar RDP Multiusuário no Windows 10

# Verifique se o script está sendo executado como administrador
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    Write-Warning "Execute este script como Administrador."
    exit
}

# Caminho para o arquivo termsrv.dll
$termsrvPath = "$env:SystemRoot\System32\termsrv.dll"

# Backup do arquivo original
$backupPath = "$termsrvPath.bak"
if (-Not (Test-Path -Path $backupPath)) {
    Copy-Item -Path $termsrvPath -Destination $backupPath
    Write-Host "Backup do arquivo termsrv.dll criado em $backupPath"
}

# Código hexadecimal para permitir múltiplas conexões RDP
$hexPattern = @(
    [byte[]] (0x39, 0x81, 0x3C, 0x06, 0x00, 0x00, 0x0F, 0x84, 0xC7, 0xD3, 0x00, 0x00)
)
$hexReplacement = @(
    [byte[]] (0xB8, 0x00, 0x01, 0x00, 0x00, 0x89, 0x81, 0x38, 0x06, 0x00, 0x00, 0x90)
)

# Leitura do arquivo termsrv.dll
$termsrvBytes = [System.IO.File]::ReadAllBytes($termsrvPath)

# Substituição do padrão hexadecimal
$index = [System.Array]::IndexOf($termsrvBytes, $hexPattern[0])
for ($i = 0; $i -lt $termsrvBytes.Length - $hexPattern.Length; $i++) {
    $match = $true
    for ($j = 0; $j -lt $hexPattern.Length; $j++) {
        if ($termsrvBytes[$i + $j] -ne $hexPattern[$j]) {
            $match = $false
            break
        }
    }
    if ($match) {
        [System.Array]::Copy($hexReplacement, 0, $termsrvBytes, $i, $hexReplacement.Length)
        Write-Host "Padrão hexadecimal substituído com sucesso."
        break
    }
}

# Gravação do arquivo modificado
[System.IO.File]::WriteAllBytes($termsrvPath, $termsrvBytes)

# Reiniciar o serviço de RDP
Restart-Service -Name "TermService"

Write-Host "RDP Multiusuário habilitado com sucesso!"

Como Executar o Script:

  1. Abra o "PowerShell" como Administrador. Para isso, clique com o botão direito no menu Iniciar e selecione "Windows PowerShell (Admin)".
  2. Copie o script acima e cole no console do PowerShell.
  3. Pressione "Enter" para executar o script.
  4. O script irá criar um backup do arquivo termsrv.dll e realizar as modificações necessárias para habilitar o RDP Multiusuário.
  5. Após a execução, o serviço de RDP será reiniciado automaticamente.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.