Overview

Managing systems across a network can be time-consuming, especially when dealing with multiple servers or workstations. PowerShell Remoting is a game-changer for system administrators — it allows you to execute commands and scripts on remote machines directly from your admin workstation.

However, setting up remoting manually involves several steps: enabling the WinRM service, configuring Windows Firewall rules, and managing trusted hosts. And if you also want to enable Remote Desktop, that’s even more configuration.

This is where the Enable-VBPsremoting function comes in — a powerful, automated solution for deploying remoting (and optionally RDP) across your infrastructure.

What’s New in v2.0?

The updated Enable-VBPsremoting.ps1 now features:

  • PowerShell Function — Reusable function you can import into your profile or modules
  • RDP Support — Optional -EnableRDP switch to enable Remote Desktop alongside PS Remoting
  • Enhanced Error Handling — Comprehensive try-catch blocks with detailed error reporting
  • Status Report Output — Returns a detailed PSCustomObject with configuration status
  • Verification Section — Displays actual configuration values after setup completes
  • Formatted Console Output — Color-coded progress indicators and status summary table

What Does the Script Do?

The Enable-VBPsremoting function automates the entire PowerShell remoting setup process by:

  • Enabling WinRM Service — Activates the Windows Remote Management service required for remoting
  • Configuring Firewall Rules — Opens WinRM ports (5985/HTTP, 5986/HTTPS) for remote connections
  • Setting Trusted Hosts — Establishes trust relationships between your admin machine and target systems
  • Validating Configuration — Displays actual settings and verifies remoting is operational

Optional RDP Configuration (when -EnableRDP is specified):

  • Enabling Remote Desktop — Sets registry value to allow RDP connections
  • Opening RDP Firewall Rules — Enables port 3389 (TCP) for RDP traffic
  • Configuring NLA — Enables Network Level Authentication for enhanced security

Once the function completes, you can immediately use PowerShell remoting and/or RDP to manage target systems.

Why Use PowerShell Remoting?

Benefits

  • Remote Command Execution — Run PowerShell commands on multiple systems without RDP
  • Faster Automation — Execute scripts simultaneously across many servers
  • Reduced Overhead — No need for RDP sessions or third-party remote management tools
  • Consistent Management — Ensure standardized configurations across your infrastructure
  • Scalability — Easily manage growing numbers of systems from a central location

Real-World Scenarios

  • Deploying patches or software updates to 50+ servers in minutes
  • Gathering system diagnostics from remote machines for troubleshooting
  • Managing services and processes across domain-joined and standalone systems
  • Running inventory scripts to collect hardware and software information
  • Executing administrative tasks without leaving your admin workstation
  • Enabling RDP for emergency access while keeping remoting as primary management interface

How to Use Enable-VBPsremoting

Prerequisites

  • Local Administrator Rights — Required to enable WinRM, RDP, and modify firewall rules
  • Windows PowerShell 4.0+ (or Windows Management Framework 4.0+)
  • Target Machines — Must be Windows Server 2008 R2+ or Windows 7+ (with WMF 4.0+)

Step 1: Download the Script

Grab the script from the public repository:

# Clone or download from GitHub
git clone https://github.com/Vibhu2/ITAdmin_Public_Scripts.git
cd ITAdmin_Public_Scripts\SCRIPTS

# Or download directly
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Vibhu2/ITAdmin_Public_Scripts/main/SCRIPTS/Enable-VBPsremoting.ps1" -OutFile "Enable-VBPsremoting.ps1"

Step 2: Run with Appropriate Privileges

# Option 1: Run as Administrator (simplest approach)
# Right-click PowerShell → Run as Administrator
.\Enable-VBPsremoting.ps1

# Option 2: Run from existing admin session
cd C:\path\to\script
.\Enable-VBPsremoting.ps1

# Option 3: Enable both PS Remoting and RDP
.\Enable-VBPsremoting.ps1 -EnableRDP

Step 3: Review the Output

The function displays a detailed configuration report showing:

  • PowerShell Remoting status
  • WinRM service configuration
  • Firewall rules status
  • Remote Desktop status (if enabled)
  • Next steps for testing

Usage Examples

Enable PS Remoting Only

# Direct execution
.\Enable-VBPsremoting.ps1

# Or import and call as a function
. .\Enable-VBPsremoting.ps1
Enable-VBPsRemoting

Enable PS Remoting + RDP

# With RDP enabled
.\Enable-VBPsremoting.ps1 -EnableRDP

# Or as a function call
. .\Enable-VBPsremoting.ps1
Enable-VBPsRemoting -EnableRDP

Get Help

# View full help documentation
. .\Enable-VBPsremoting.ps1
Get-Help Enable-VBPsRemoting -Full

# View examples
Get-Help Enable-VBPsRemoting -Examples

Common Use Cases

1. Mass Server Patching

$servers = "Server01", "Server02", "Server03"
$servers | ForEach-Object {
    Invoke-Command -ComputerName $_ -ScriptBlock {
        Install-WindowsUpdate -AcceptAll -AutoReboot
    }
}

2. Service Management Across Multiple Servers

$servers = Get-Content servers.txt
Invoke-Command -ComputerName $servers -ScriptBlock {
    Restart-Service -Name "ServiceName" -Force
}

3. System Inventory Collection

$servers = "Server01", "Server02"
$servers | ForEach-Object {
    Invoke-Command -ComputerName $_ -ScriptBlock {
        Get-ComputerInfo | Select-Object CsSystemType, CsNumberOfProcessors, CsTotalPhysicalMemory
    }
}

4. Batch Enable RDP on Multiple Servers

# Import the function
. .\Enable-VBPsremoting.ps1

# Enable on local machine
$report = Enable-VBPsRemoting -EnableRDP

# Check status
$report

Troubleshooting Tips

IssueSolution
WinRM service won’t startCheck service startup type: Set-Service WinRM -StartupType Automatic
Firewall still blocks remotingVerify port 5985 (HTTP) is open: Get-NetFirewallRule -DisplayGroup "Windows Remote Management"
“Access Denied” errorsEnsure you’re running PowerShell as Administrator
Trusted hosts not setManually configure: Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
RDP not working after scriptVerify firewall rule: Get-NetFirewallRule -DisplayGroup "Remote Desktop"
NLA causing RDP issuesDisable NLA if needed: Set-ItemProperty "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name SecurityLayer -Value 0

Security Considerations

Best Practices

  • Use HTTPS (Port 5986) — Enable SSL/TLS for encrypted remoting sessions
  • Restrict TrustedHosts — Don’t set to "*" in production; specify explicit IP ranges
  • Implement Kerberos Authentication — When working within Active Directory domains
  • Enable CredSSP for Delegation — If delegating credentials to nested sessions
  • Audit Remoting Activity — Monitor remote access for security
  • RDP Security — Enable Network Level Authentication (NLA) and enforce strong passwords
# Set specific trusted hosts instead of wildcard
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.0/24" -Force

# Enable remoting over HTTPS
Enable-PSRemoting -SkipNetworkProfileCheck -Force

# For RDP: Enforce NLA
Set-ItemProperty "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name SecurityLayer -Value 1

Next Steps

After enabling PowerShell remoting on your infrastructure:

  1. Test Connections — Verify you can connect to at least one remote system
  2. Document Trusted Hosts — Keep a record of which systems are trusted
  3. Create Baseline Scripts — Develop reusable scripts for common administrative tasks
  4. Implement Logging — Enable Module Logging and Script Block Logging for security auditing
  5. Plan RDP Strategy — Decide which systems need RDP enabled alongside PS Remoting
  6. Train Your Team — Share PowerShell remoting and RDP best practices with your team

Conclusion

The Enable-VBPsremoting v2.0 function transforms PowerShell remoting from a manual, error-prone setup process into a quick, automated deployment. With optional RDP support, it handles both primary management channels (PowerShell Remoting) and fallback access (Remote Desktop) in a single operation.

Whether managing a small network of servers or a large-scale infrastructure, this function saves time, reduces configuration mistakes, and provides comprehensive status reporting.

Get started today — download the script, test it in a safe environment, and unlock the power of remote PowerShell administration across your organization.


Find the script here: GitHub Repository

Questions or Issues? Reach out or file an issue on GitHub!

🤝 Connect with Me

Found this useful? I write about PowerShell, Windows infrastructure, and enterprise automation.