Skip to main content

Desktop Shortcut Creation

Summary

Creates a shortcut in the Public Desktop.
Implementation of EPM - Windows Configuration - Agnostic - New-DesktopUriShortcut.

Example Agent Procedure Log

TimeActionStatusUser
12:38:59 pm 20-Dec-22Desktop Shortcut CreationSuccess THENprovaltech.com/dan.hicks
12:38:58 pm 20-Dec-22Desktop Shortcut Creation-0001Log: 2022-12-20 12:32:38 INIT ----------------------------------------------- 2022-12-20 12:32:38 INIT New-DesktopUriShortcut 2022-12-20 12:32:38 INIT System: DEV 2022-12-20 12:32:38 INIT User: DEV$ 2022-12-20 12:32:38 INIT OS Bitness: AMD64 2022-12-20 12:32:38 INIT PowerShell Bitness: 64 2022-12-20 12:32:38 INIT PowerShell Version: 5 2022-12-20 12:32:38 INIT ----------------------------------------------- 2022-12-20 12:36:57 INIT ----------------------------------------------- 2022-12-20 12:36:57 INIT New-DesktopUriShortcut 2022-12-20 12:36:57 INIT System: DEV 2022-12-20 12:36:57 INIT User: DEV$ 2022-12-20 12:36:57 INIT OS Bitness: AMD64 2022-12-20 12:36:57 INIT PowerShell Bitness: 64 2022-12-20 12:36:57 INIT PowerShell Version: 5 2022-12-20 12:36:57 INIT ----------------------------------------------- 2022-12-20 12:36:57 LOG URI Detected as a web link. 2022-12-20 12:36:57 LOG ...provaltech.com/dan.hicks
12:38:58 pm 20-Dec-22Desktop Shortcut CreationRaw PS1 Data: 2022-12-20 12:38:54 INIT ----------------------------------------------- 2022-12-20 12:38:54 INIT New-DesktopUriShortcut 2022-12-20 12:38:54 INIT System: DEV 2022-12-20 12:38:54 INIT User: DEV$ 2022-12-20 12:38:54 INIT OS Bitness: AMD64 2022-12-20 12:38:54 INIT PowerShell Bitness: 64 2022-12-20 12:38:54 INIT PowerShell Version: 5 2022-12-20 12:38:54 INIT ----------------------------------------------- 2022-12-20 12:38:54 LOG URI Detected as a web link. 2022-12-20 12:38:54 LOG Getting webpage Favicon from www.google.com. 2022-12-20 12:38:55 LOG Shortcut Saved Successfullyprovaltech.com/dan.hicks
12:38:58 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)Success THENprovaltech.com/dan.hicks
12:38:57 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0016Powershell command complete. Results returned to global variable #global:psresult# and saved in Agent's Documents tab of server.provaltech.com/dan.hicks
12:38:57 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0016Informational: GetFile command overwrote the server file C://Kaseya//UserProfiles//229175768944442//GetFiles//..//docs//psoutput.txt with the new contents from c://provaltech//psoutput.txt in THEN step 3.provaltech.com/dan.hicks
12:38:54 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0011Executing 64-bit Powershell command as System: "" -command "$InformationPreference = 'Continue'; %ProgramData%//_automation//AgentProcedure//DesktopShortcutCreation//New-DesktopUriShortcut.ps1 -TargetUri https://www.google.com -ShortcutName test" >"c://provaltech//psoutputtmp.txt"provaltech.com/dan.hicks
12:38:54 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0013Sending output to global variable.provaltech.com/dan.hicks
12:38:54 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0008Custom commands detected as $InformationPreference = 'Continue'; %ProgramData%//_automation//AgentProcedure//DesktopShortcutCreation//New-DesktopUriShortcut.ps1 -TargetUri https://www.google.com -ShortcutName testprovaltech.com/dan.hicks
12:38:53 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0003No powershell file variable detected.provaltech.com/dan.hicks
12:38:52 pm 20-Dec-22Execute Powershell Command (64-bit, Run As System)-0002Powershell is present.provaltech.com/dan.hicks
12:38:45 pm 20-Dec-22Execute Powershell CommandSuccess THENprovaltech.com/dan.hicks
12:38:45 pm 20-Dec-22Execute Powershell Command-0011Powershell command completed!provaltech.com/dan.hicks
12:38:43 pm 20-Dec-22Execute Powershell Command-0011Executing powershell "" -Command "New-Item -Type Directory -Path $env:ProgramData//_automation//AgentProcedure -name DesktopShortcutCreation" ""provaltech.com/dan.hicks
12:38:43 pm 20-Dec-22Execute Powershell Command-0010Not sending output to variable.provaltech.com/dan.hicks
12:38:43 pm 20-Dec-22Execute Powershell Command-0008New command variable is: -Command "New-Item -Type Directory -Path $env:ProgramData//_automation//AgentProcedure -name DesktopShortcutCreation"provaltech.com/dan.hicks
12:38:43 pm 20-Dec-22Execute Powershell Command-0008Custom commands detected as New-Item -Type Directory -Path $env:ProgramData//_automation//AgentProcedure -name DesktopShortcutCreationprovaltech.com/dan.hicks
12:38:41 pm 20-Dec-22Execute Powershell Command-0002Powershell is present.provaltech.com/dan.hicks
12:38:34 pm 20-Dec-22Run Now - Desktop Shortcut CreationAdmin provaltech.com/dan.hicks scheduled procedure Run Now - Desktop Shortcut Creation to run at Dec 20 2022 12:38 PM

Process

Runs the agnostic script EPM - Windows Configuration - Agnostic - New-DesktopUriShortcut.
Prompts for a shortcut path, shortcut target, and an optional custom icon.
The custom icon will need to be uploaded to managed files. Once uploaded, point the writeFile function on line 8 to the icon. The file on the endpoint should always be #directory#/icon.ico.

Output

  • $env:PUBLIC/Desktop/link.lnk
  • $env:PUBLIC/Pictures/icon.ico
  • New-DesktopUriShortcut-log.txt
  • New-DesktopUriShortcut-error.txt
  • Agent Procedure Log