AAC - Create a Public Desktop Shortcut for all users on Windows
| 2 Votes |
Description
Uses Powershell to create a public destop shortcut that works on most modern Windows systems (those supported by powershell)
When prompted you can provide an application full path or an URL:
URL example
Application example:
C:\Program Files\Notepad++\notepad++.exe
When prompted for the name you can enter any valid filename (Warn: no checks are done)
Note: If you use the same name of an existing Public Desktop shortcut, it will be replaced. If you use the same name of a Private Desktop shortcut, two shortcuts will exist on User's desktop.
Property Details
| 25073 | |
| Beta - Preliminary testing ready for more | |
| AAC - Create a Public Desktop Shortcut for all users on Windows | |
| Utility | |
| andrea.capasso@hcl.com | |
| 2/8/2018 12:00:00 AM | |
| Public Desktop Shortcut | |
| True | |
| kapax on 2/8/2018 9:22:34 AM | |
| kapax on 6/18/2021 5:46:24 AM | |
| 8905 Views / 67 Downloads | |
* Average over 1 rating.
** 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
action parameter query "TargetURL" with description "Enter the URL or the ApplicationFullPath pointed by the Shortcut (for example: C:\Program Files\Notepad++\notepad++.exe )" and with default value "http://bigfix.me"
action parameter query "ShortcutName" with description "Enter the Name of the Desktop Shortcut" and with default value "Bigfix_Me"
// Retrieve Public Desktop location
parameter "DesktopPath"="{value "Common Desktop" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" of native registry}"
// locate PowerShell .exe file
parameter "PowerShellexe"="{value "Path" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry}"
if {(parameter "TargetURL") as lowercase starts with "http"}
parameter "Shortcut_ext"=".url"
elseif {(parameter "TargetURL") as lowercase ends with ".exe"}
parameter "Shortcut_ext"=".lnk"
else
continue if {false}
endif
// build full path of Shortcut
parameter "ShortcutFile" = "{(parameter "DesktopPath") & "\" & (parameter "ShortcutName") & (parameter "Shortcut_ext")}"
// create PowerShell script
delete __createfile
createfile until __EOF__
$Target = "{parameter "TargetURL"}"
# $ShortcutFile = (Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders').'Common Desktop'
# $ShortcutFile = $ShortcutFile + "{"\" & (parameter "ShortcutName") & ".url" }"
$ShortcutFile = "{parameter "ShortcutFile"}"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $Target
$Shortcut.Save()
__EOF__
delete "shortcut.ps1"
copy __createfile "shortcut.ps1"
// just in case, remove the old shortcut should it exists
delete "{parameter "ShortcutFile"}"
// execute PS script and check we did it or fail
waithidden "{parameter "PowerShellexe"}" -ExecutionPolicy Bypass ".\shortcut.ps1"
continue if {exit code of action = 0 }
continue if {exists file (parameter "ShortcutFile")}
Success Criteria
This action will be considered successful when the applicability relevance evaluates to false.
Sharing
| Social Media: |
Comments
|
|
|
| Digging up this old thread to ask if it is possible to use this fixlet to create a shortcut that includes command-line switches? Specifically to use Edge browser to open a particular URL. Command line/shortcut would be: "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" https://www.nameofsite.com Attempting to enter this in to the fixlet prompt results in a task failure- have tried with and without the quotes | |
|
|
|
| Good Script | |
|
|
|
| it's working thank you | |
|
|
|
| related: https://bigfix.me/fixlet/details/741 | |

