Create Desktop Shortcut (PowerShell)
Log In or Register to download the BES file, and more.

0 Votes

Description

Deploys a shortcut to the currently logged in user's desktop.

Prompts for:

  • All Users or Current User
  • The name of the shorcut
  • The URL (or file path)
  • The icon path and code
    • Many apps and dll files have multiple icons attached to them  For example, the Shell32 Icon (http://help4windows.com/windows_8_shell32_dll.shtml) has a couple dozen (17 or 13 are excellent choices)
    • Internet Explorer's default icon is set as the default option.  Change it to any program.  You can go to a desktop shortcut and click the "change icon" button to view other icon options and help you pick the one that works for you.

 


Property Details

ID25589
StatusProduction - Fully Tested and Ready for Production
TitleCreate Desktop Shortcut (PowerShell)
SourceInternal
Source Release Date11/27/2018 12:00:00 AM
KeywordsDesktop Shortcut
Added by on 11/30/2018 11:56:53 AM
Last Modified by on 11/30/2018 11:57:42 AM
Counters 267 Views / 4 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance


Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
//Actions to ask the user for the input
action parameter query "SCTarget" with description "Enter 'Current' for Current User or 'All' for All Users." with default value "Current"
action parameter query "SCName" with description "Enter the name for the icon." with default value "Google"
action parameter query "SCurl" with description "Enter the URL or path to file" with default value "http://www.google.com"
action parameter query "SCIcon" with description "Enter the path, code for the icon" with default value "c:\Program Files (x86)\Internet Explorer\iexplore.exe, 1"

//Select Current User or All Users
if {parameter "SCTarget" of action = "All"}
parameter "Desktop" = "c:\users\Public\Desktop"
else
parameter "Desktop" = "c:\users\{name of current user}\Desktop"
endif

//Create the file
delete __appendfile
delete makeshortcut.ps1
appendfile $Shell = New-Object -ComObject ("WScript.Shell")
appendfile $ShortCut = $Shell.CreateShortcut("{parameter "Desktop"}\{parameter "SCName"}.lnk")
appendfile $ShortCut.TargetPath="{parameter "SCurl"}"
appendfile $ShortCut.Arguments=""
appendfile $ShortCut.WorkingDirectory = "c:\temp";
appendfile $ShortCut.WindowStyle = 1;
appendfile $ShortCut.Hotkey = "";
appendfile $ShortCut.IconLocation = "{parameter "SCIcon"}";
appendfile $ShortCut.Description = "";
appendfile $ShortCut.Save()

//Execute the file
move __appendfile makeshortcut.ps1
waithidden "{pathname of system folder & "\WindowsPowerShell\v1.0\powershell.exe"}" ./makeshortcut.ps1
Success Criteria

This action will be considered successful when all lines of the action script have completed successfully.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!
jgstew -
different/old example: https://www.bigfix.me/fixlet/details/720
jgstew -
This can also be done using VBScript: https://github.com/jgstew/tools/blob/master/VBS/MakeShortcutStartMenu.vbs