cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JohnLewis
Engaged Sweeper II
How do you create a command to drop a shortcut on the current logged on user's desktop under the deployment options?

1 ACCEPTED SOLUTION
esr
Champion Sweeper
I'm sure there are several ways to accomplish this task. We elected to use a powershell script to create the desktop shortcut since we can specify items such as the target path and extra arguments/switches. Needing to set the details of the shortcut to our specific install was what required the custom desktop shortcut.


We placed the ps script in the package and call it with the a Command action in the deployment and after the application is installed.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile  -Command {PackageShare}\Installers\PATH TO YOUR PACKAGE\MakeLnk.ps1



The PS script itself is pretty short & sweet for a ps script....

# Create Shortcut with modified Target Directory
#$DesktopPath = [Environment]::GetFolderPath("Desktop")
$DesktopPath = 'C:\Users\Public\Desktop'
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$DesktopPath\NAME OF SHORTCUT HERE.lnk")
$Shortcut.TargetPath = "C:\Program Files (x86)\PATH TO\YOUR APPLICATION\YOUR FILE.exe"
$Shortcut.Arguments = 'YOUR TARGET COMMAND LINE ARGUMENTS (SWITCHES) GO HERE'
$Shortcut.Save()

View solution in original post

2 REPLIES 2
esr
Champion Sweeper
I'm sure there are several ways to accomplish this task. We elected to use a powershell script to create the desktop shortcut since we can specify items such as the target path and extra arguments/switches. Needing to set the details of the shortcut to our specific install was what required the custom desktop shortcut.


We placed the ps script in the package and call it with the a Command action in the deployment and after the application is installed.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile  -Command {PackageShare}\Installers\PATH TO YOUR PACKAGE\MakeLnk.ps1



The PS script itself is pretty short & sweet for a ps script....

# Create Shortcut with modified Target Directory
#$DesktopPath = [Environment]::GetFolderPath("Desktop")
$DesktopPath = 'C:\Users\Public\Desktop'
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$DesktopPath\NAME OF SHORTCUT HERE.lnk")
$Shortcut.TargetPath = "C:\Program Files (x86)\PATH TO\YOUR APPLICATION\YOUR FILE.exe"
$Shortcut.Arguments = 'YOUR TARGET COMMAND LINE ARGUMENTS (SWITCHES) GO HERE'
$Shortcut.Save()
PeterJG
Champion Sweeper II
use example from Upgrade LSpush on how to copy file using the provided scripts.. just create shortcut and copy to c:\users\public\Desktop on target computer.