Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.2 kB
1
Indexable
# Prompt user for new computer name
$newComputerName = Read-Host -Prompt "Enter the new computer name"

# Rename the computer
Rename-Computer -NewName $newComputerName -Force

# Step 1: Activate Multiple RDP Connections

# Define the registry paths for the group policy settings
$singleSessionPath = "HKLM:\Software\Policies\Microsoft\Windows NT\Terminal Services"
$maxConnectionsPath = "HKLM:\Software\Policies\Microsoft\Windows NT\Terminal Services"

# Create the registry key if it doesn't exist
if (-not (Test-Path $singleSessionPath)) {
    New-Item -Path $singleSessionPath -Force | Out-Null
}

if (-not (Test-Path $maxConnectionsPath)) {
    New-Item -Path $maxConnectionsPath -Force | Out-Null
}

# Disable "Restrict Remote Desktop Services users to a single Remote Desktop Services Session"
Set-ItemProperty -Path $singleSessionPath -Name "fSingleSessionPerUser" -Value 0

# Enable "Limit number of connections" and set the maximum connections allowed to 2
Set-ItemProperty -Path $maxConnectionsPath -Name "MaxConnections" -Value 999999

# Apply the changes by forcing the group policy update
gpupdate /force


# Restart the computer to apply changes
Restart-Computer -Force
Leave a Comment