A standalone, Windows 11 Fluent WPF GUI utility for creating .lnk Desktop shortcuts for PowerShell (.ps1) scripts, supporting Windows PowerShell 5.1 and PowerShell 7.x (pwsh.exe), adaptive Auto/Dark/Light themes, a visual icon grid picker with live preview, drag-and-drop, UAC elevation patching, and completely windowless background execution.
Tip: Looking for full PowerShell Gallery discovery, publishing, script updates, and integrated shortcut creation in one suite? Check out PSGallery-Manager (GitHub).
- PowerShell Gallery (Latest): https://www.powershellgallery.com/packages/create_desktop_shortcut
- PowerShell Gallery (v1.1.0): https://www.powershellgallery.com/packages/create_desktop_shortcut/1.1.0
- GitHub Repository: https://github.com/2civics/PowerShell-Desktop-Shortcut-Creator
- Companion Suite (
PSGallery-Manager): https://www.powershellgallery.com/packages/PSGallery-Manager
- Dual Runtime Support (PS 5.1 & PS 7.x): Target either Windows PowerShell 5.1 (
powershell.exe) or PowerShell 7.x (pwsh.exe). Automatically detects MSI and MSIX (WindowsApps) installations and offers a one-click background installer (wingetwith GitHub.msifallback) if PowerShell 7 is not installed. - Runtime-Aware Argument Builder: Automatically injects
-STAonly when targeting Windows PowerShell 5.1 (preventing invalid-argument crashes in PowerShell 7) and updates the live command preview as you toggle options. - Native Shell Icon Picker & Live Preview: Browse icons inside
.ico,.exe, or.dllfiles via Choose Icon..., jump straight intoshell32.dllvia Windows Icons..., or reset to the active PowerShell host icon with a live 32×32 preview. - Windowless Background Execution (
Hidden): Selecting Hidden adds-WindowStyle Hidden, configures the.lnkto start minimized (preventing console flash), and automatically disables-NoExitso background processes do not stay orphaned. - Run as Administrator (
.lnkElevation Patching): Sets theSLDF_RUNAS_USERbit (0x20at byte0x15) directly on the generated.lnkfile so Windows prompts for UAC elevation on launch. - Runtime-Preserving Self-Elevation & Hidden Host Console: Automatically elevates to Administrator in the same PowerShell runtime (
powershell.exeorpwsh.exe) that launched it and hides its own console window via Win32ShowWindow. - Windows 11 Dark / Light Mode: Automatically matches your Windows app theme (
AppsUseLightTheme) with a DWM dark title bar and an in-app toggle button.
- Operating System: Windows 10 or Windows 11
- PowerShell: Windows PowerShell 5.1 (built-in) or PowerShell 7.x (
pwsh.exe) - Privileges: Administrator (the script automatically requests UAC elevation on startup)
Open PowerShell and run:
Install-Script -Name create_desktop_shortcut -ForceTo update an existing installation to the latest version:
Update-Script -Name create_desktop_shortcut -ForceTo download the .ps1 file to a local folder using Save-Script:
Save-Script -Name create_desktop_shortcut -Path "$env:USERPROFILE\Downloads"Or download create_desktop_shortcut.ps1 directly from the GitHub Releases page.
If your PowerShell Scripts directory is in your $env:PATH, launch the utility from any terminal or Run prompt:
create_desktop_shortcut.ps1Or run it directly by path:
& "$env:ProgramFiles\WindowsPowerShell\Scripts\create_desktop_shortcut.ps1"- PowerShell Script (
.ps1): Click Browse... and select the target.ps1script. The Desktop shortcut name populates automatically from the script filename. - Shortcut Icon: Keep the default PowerShell icon, click Choose Icon... to pick from any
.ico,.exe, or.dll, or click Windows Icons... to browseshell32.dll. - PowerShell Mode: Choose PowerShell 5.1 (
powershell.exe) or PowerShell 7.x (pwsh.exe). If PowerShell 7 is selected and not installed, the tool prompts to install it automatically. - Launch Options:
- Run as Administrator: Triggers a UAC prompt whenever the shortcut is launched.
- Keep PowerShell window open (
-NoExit): Keeps the console open after script completion (disabled automatically when Window is set to Hidden). - Bypass Execution Policy: Adds
-ExecutionPolicy Bypass(enabled by default). - Window: Choose Normal, Minimized, Maximized, or Hidden.
- Script Arguments: Append any parameters passed directly to your
.ps1script.
- Create Shortcut: Verify the generated command in Shortcut Target Command Preview and click Create Shortcut to save
<Name>.lnkto your Desktop.
- Running scripts is disabled on this system:
Allow locally signed/installed scripts for your user account:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Downloaded
.ps1blocked by Windows Mark-of-the-Web: If you downloaded the script manually in a browser, unblock it before running:Unblock-File -Path .\create_desktop_shortcut.ps1
Added
- WPF Fluent Design UI: Rebuilt the entire interface from WinForms to WPF XAML using an
INotifyPropertyChangedThemeManager,Segoe Fluent Icons, rounded cards, slim scrollbars, placeholder watermarks, and native high-DPI scaling withWorkAreaclamping. - Adaptive
Auto | Dark | LightTheme Sync: Replaced the single dark/light toggle with a segmented pill control that syncs live with Windows theme changes (SystemEvents.UserPreferenceChanged) and applies native DWM dark title bars and rounded window corners. - Built-In Visual Icon Grid Picker: Added an interactive icon browser with index filtering and one-click presets for
imageres.dll,shell32.dll,ddores.dll, andpifmgr.dll, alongside live icon preview. - Drag-and-Drop Support: Drop any
.ps1script onto the window to populate the script path and shortcut name, or drop.ico,.exe, or.dllfiles to set the icon source. -ThemeStartup Parameter: Added optional-Theme Auto|Dark|Lightsupport, preserved automatically across UAC/STA relaunches.
Changed
- Zero WinForms /
System.DrawingDependencies: Migrated file dialogs toMicrosoft.Win32.OpenFileDialog, background PowerShell 7 installation timers to WPFDispatcherTimer, and icon extraction to nativeImaging.CreateBitmapSourceFromHIcon. - PowerShell 7.x
Add-TypeCompatibility: Explicitly referenced WPF assemblies during inline C# compilation so the script compiles cleanly on both Windows PowerShell 5.1 and PowerShell 7.x (.NET 8+).
- Fixed PowerShell 7.x High-DPI & Multi-Resolution Rendering: Configured
DpiUnawareGdiScaledhigh-DPI mode, DPIAutoScalebaselines, dynamicComboBoxitem heights, andWorkingAreascreen clamping so the UI scales cleanly across resolutions and Windows display scales. - Responsive 3-Zone Layout: Replaced fixed pixel coordinates with
TableLayoutPanel/FlowLayoutPanelcontainers, pinned the command preview and action buttons at the bottom, and auto-sized initial form height to eliminate side scrollbars on startup while supportingAutoScrollon smaller displays.
- Aligned PowerShell 5.1 / 7.x Integration: Aligned PowerShell 5.1 / 7.x mode selection,
Get-Pwsh7Infodetection, inline status indicator, and backgroundwinget/GitHub MSI installation withPSGallery-Manager. - Added Windows Icon Picker: Added the Windows Icons... button (
shell32.dll) alongside Choose Icon... and Reset. - Preserved Host Executable Across Elevation: Preserved the active PowerShell host executable across UAC self-elevation via
(Get-Process -Id $PID).Pathand restricted-STAto Windows PowerShell 5.1. - Fixed PowerShell 7 Assembly Compilation: Fixed
Add-Typecompilation on PowerShell 7 (.NET 8+) by dynamically resolving loaded assembly locations for-ReferencedAssemblies. - Improved Window Activation & COM Cleanup: Forced foreground window activation (
SW_SHOW+SetForegroundWindow) on form startup and ensured deterministic COM release before binary UAC patching.
- Hidden Console Window on Launch: Hid the PowerShell console window when running this utility via hidden relaunch flags and Win32
ShowWindowfallback. - Added Hidden Window Shortcut Option: Added a Hidden option to the Window dropdown to create shortcuts that execute target scripts with
-WindowStyle Hidden(and start minimized to prevent window flash). - Prevented Orphaned Background Processes: Automatically disables
-NoExitwhen Hidden is selected to prevent orphaned background PowerShell processes. - Dynamic Command Preview Updates: Updated the live command preview to reflect
-WindowStyle Hiddendynamically.