Create shortcut to .exe using PowerShell

Create a ShortCut for an Exe File

Creating a shortcut to an application on multiple end user desktops can be a laborious task. However, the process is pretty straightforward when using a PowerShell script. In the following script, provide the path of the EXE file and the exact path where the shortcut has to be created as parameters and run the script. The necessary shortcut will be created at the required place. 

Script

<#
.SYNOPSIS
This script can be used to Create a ShortCut for an Exe File
.DESCRIPTION
This script can be used to Create a ShortCut for an Exe File
.EXAMPLE
C:\PS> C:\Script\Create_a_shortcut.ps1 C:\Program Files (x86)\Mozilla Firefox\firefox.exe C:\Users\gautam-2374\Desktop\Firefox.lnk
Create a ShortCut for an Exe File in Desktop.
#>

param ( [string]$ExePath, [string]$ShortcutPath )
#Use the New-Object cmdlet to create an instance of the Wscript.Shell object

$WshShell = New-Object -comObject WScript.Shell
#As soon as we have that object in hand we can then use the CreateShortcut method to create a new shortcut in memory

$Shortcut = $WshShell.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = $ExePath
$Shortcut.Save()