PowerShell Create Remote Desktop Shortcut: Step-by-Step Guide

This guide shows how to use PowerShell to create remote desktop shortcuts quickly and easily. Instead of setting them up one by one, PowerShell helps you create many at once. You'll also see how AnyViewer makes it even easier to manage all your remote devices in one place.

Ellie

By Ellie / Updated on July 9, 2025

Share this: instagram reddit

Why use PowerShell to create RDP shortcuts?

RDP is essential for remote work and server management, but creating RDP shortcuts manually for multiple machines can be tedious. That’s why many IT professionals prefer to use PowerShell to create remote desktop shortcuts. This method automates the process, saving time and reducing errors.

powershell-create-remote-desktop-shortcut

You might wonder, “Why go through the trouble of scripting when I can right-click and save an RDP shortcut manually?” Fair question. But think about this: what if you need to set up RDP shortcuts for 100 machines? Or maybe you're part of a team deploying desktops for a remote workforce? Manual steps just won't cut it.

This is where the keyword PowerShell create RDP shortcut truly shines—giving you a programmatic and scalable solution.

  • Fast: Create multiple RDP shortcuts in seconds.
  • Consistent: Every file has the same settings, no mistakes.
  • Automated: Easily add to deployment scripts or schedules.
  • Customizable: Set screen resolution, credentials, and more.
  • Repeatable: Scripts can be reused and shared with your team.

So if you're dealing with large-scale environments, PowerShell to create RDP shortcuts isn’t just efficient—it’s essential.

Understanding the components of an RDP file

A Remote Desktop shortcut, or more technically, an .rdp file, is a configuration file that stores all the settings required to connect to a remote computer using Microsoft’s Remote Desktop service. When you double-click this file, your system uses its contents to initiate an RDP session without needing manual input.

Before you create an RDP file with PowerShell, it's crucial to understand what’s inside an .rdp file. These files are essentially plain text files that store session settings using key:value pairs. Knowing what each line does will help you fine-tune your script later.

Essential parameters in RDP file

These are the must-haves, if they're missing, your connection might fail:

  • full address:s: – The destination computer.
  • username:s: – Predefined user name (optional but helpful).
  • screen mode id:i:2 – Determines full-screen or windowed mode.
  • desktopwidth:i: and desktopheight:i: – Display resolution.

Optional parameters for customization

Here's where you can get fancy:

  • redirectprinters:i:1 – Redirect local printers.
  • redirectclipboard:i:1 – Share clipboard contents.
  • drivestoredirect:s: – Redirect all local drives.
  • authentication level:i:2 – Defines security settings.
  • prompt for credentials:i:0 – Skip the login prompt.

Understanding these parameters empowers you to create RDP files with PowerShell that are fine-tuned to your specific needs.

Prerequisites before running PowerShell scripts

Before jumping into using PowerShell to create remote desktop shortcuts, ensure your system is properly configured to run scripts.

System requirements

  • Windows 10 or later: Ideally on a system with PowerShell 5.1+ or PowerShell Core.
  • Remote Desktop Client Installed: Most versions of Windows include this by default.
  • Access to Target Machines: Ensure you can connect to the remote IPs or hostnames.

User permissions

  • Administrative Rights: Not always required to create .rdp files, but necessary for writing to certain directories.
  • Script Execution Policy: Run Get-ExecutionPolicy in PowerShell. If it returns Restricted, you'll need to change it to RemoteSigned or Unrestricted using:Set-ExecutionPolicy RemoteSigned
  • Directory Access: Make sure your script has permission to write to the destination folder.

With all these checked off, you're ready to roll.

How to create an RDP shortcut using PowerShell

Creating an RDP shortcut using PowerShell is surprisingly simple once you know the structure of an .rdp file. In essence, you're just writing a text file with specific settings. The key is to ensure your script handles input values cleanly and creates usable shortcuts every time.

Step-by-step script to create an RDP file

Here's a basic script to get you started:

# Define the file path

$RdpPath = "C:\Users\Public\Desktop\MyRemotePC.rdp"

# Define the content of the RDP file

$RdpContent = @"

screen mode id:i:2

use multimon:i:0

desktopwidth:i:1920

desktopheight:i:1080

session bpp:i:32

winposstr:s:0,3,0,0,800,600

compression:i:1

keyboardhook:i:2

audiocapturemode:i:0

videoplaybackmode:i:1

connection type:i:7

networkautodetect:i:1

bandwidthautodetect:i:1

displayconnectionbar:i:1

enableworkspacereconnect:i:0

disable wallpaper:i:0

allow font smoothing:i:1

allow desktop composition:i:1

disable full window drag:i:0

disable menu anims:i:0

disable themes:i:0

bitmapcachepersistenable:i:1

full address:s:192.168.1.10

audiomode:i:0

redirectprinters:i:1

redirectcomports:i:0

redirectsmartcards:i:1

redirectclipboard:i:1

redirectposdevices:i:0

autoreconnection enabled:i:1

authentication level:i:2

prompt for credentials:i:1

negotiate security layer:i:1

remoteapplicationmode:i:0

alternate shell:s:

shell working directory:s:

gatewayhostname:s:

gatewayusagemethod:i:4

gatewaycredentialssource:i:4

gatewayprofileusagemethod:i:0

promptcredentialonce:i:1

use redirection server name:i:0

rdgiskdcproxy:i:0

kdcproxyname:s:

username:s:DOMAIN\UserName

"@

# Save to file

Set-Content -Path $RdpPath -Value $RdpContent

Write-Host "RDP Shortcut Created at $RdpPath"

Customizing the script

You can easily adapt this script to fit your unique environment:

  • Change Display Settings: Want 4K resolution? Just modify desktopwidth:i:3840 and desktopheight:i:2160.
  • Add Credential Prompts: Change prompt for credentials:i:1 to i:0 if you want users to be logged in automatically (not recommended for security reasons).
  • Include Different Hostnames: Use a variable to set full address:s:$RemoteHost.

This flexibility means you can create tailored shortcuts for every department, user, or use case in seconds.

Batch creating multiple RDP shortcuts

One of PowerShell's superpowers is handling loops. If you have a list of computers you need to generate shortcuts for, use a loop structure and a CSV file to automate the entire batch.

Create a CSV file named computers.csv with the following columns:

ComputerName,Username

192.168.1.10,Admin1

192.168.1.11,Admin2

192.168.1.12,Admin3

Now use this PowerShell script:

$computers = Import-Csv -Path "C:\scripts\computers.csv"

foreach ($comp in $computers) { $fileName = "C:\Users\Public\Desktop\$($comp.ComputerName).rdp" $content = @"full address:s:$($comp.ComputerName)

username:s:$($comp.Username)

prompt for credentials:i:1

screen mode id:i:2

desktopwidth:i:1920

desktopheight:i:1080

session bpp:i:32

"@

Set-Content -Path $fileName -Value $content Write-Host "RDP file created: $fileName"}

Now you can deploy dozens of RDP files in one sweep. Each one is uniquely customized based on the host and user. It's like a digital assembly line, efficient and scalable.

Take it further with AnyViewer: A smarter way to manage remote connections

While PowerShell gives you powerful control over creating and customizing RDP shortcuts, managing multiple devices, especially in larger environments, still presents challenges. That's where AnyViewer, one of the best remote desktop software, becomes the perfect complement to your PowerShell automation strategy.

main-page

Instead of juggling dozens of .rdp files or manually sorting connection targets, AnyViewer provides a centralized control panel where all your remote devices are listed in one intuitive interface. Whether you're supporting a remote workforce, managing a server farm, or providing technical assistance across departments, this makes tracking and connecting to machines far easier.

Even better, AnyViewer supports device grouping, allowing you to organize endpoints by department, role, or usage. Need to separate development systems from admin workstations? Simply assign them to different groups for clear navigation and instant access.

For organizations that require fine-grained control, AnyViewer also offers customizable role-based permissions. You can define who on your team has access to specific devices or features, ensuring secure and efficient remote management at scale.

In short, if PowerShell helps you build RDP connections fast and consistently, AnyViewer helps you manage those connections smarter, with better visibility, structure, and security. Use them together, and you've got a remote access system that's both scalable and streamlined.

Download Freeware Win PCs & Servers
Secure Download

Conclusion

Using PowerShell to create remote desktop shortcuts is a no-brainer for IT admins, sysadmins, and remote support teams. Whether you’re setting up a handful of systems or hundreds, the ability to create RDP files with PowerShell gives you total control, consistency, and speed.

And if you want to elevate your workflow, pair PowerShell with AnyViewer. While PowerShell handles the scripting, AnyViewer simplifies management. Together, they offer a powerful, modern solution for secure, efficient remote access.