
Referencesġ in 3 organizations using Microsoft Configuration Manager rely on Right Click Tools to surface vulnerabilities and remediate quicker than ever before. That’s it, simple concept, simple to add to your task sequence, and super handy. Feel free to change "14" to a different number and re-run and keep going until you find one you like. For the icon, we steal one of the many icons that are built into Windows 11 by calling Shell32.dll, and then choosing one from the many available, the index for the one I wanted was 14. In the next section, we connect to the com object, and leverage the CreateShortcut method. The EXE, any additional arguments, many times you won’t need this for creating shortcuts to files or programs, and then the destination of where you want the shortcut placed, in this example, it’s the all users desktop. Looking for a simple way to place a shortcut on multiple users desktops using a Powershell script lead me to tools like mklink (which creates symbolic links, but not shortcuts).
Powerhsell create lnk file how to#
So breaking that down, the first section is building the information required to be used in the shortcut itself. How to create a desktop shortcut using Powershell Sometimes I find that simple tasks like creating a shortcut to an Application using a script are not straight forward. Write-output "Creating ConfigMgr Control Panel Icon on Desktop" HOW TO FIX LNK FILES IN WINDOWS 7 Windows allows you to customize your shortcuts so that you can quickly access your favorite webpages and programs directly from your computer's desktop. $Shortcut.Arguments = $ArgumentsToSourceExe $Shortcut.IconLocation = "C:WindowsSystem32SHEL元2.dll, 14" $Shortcut = $WshShell.CreateShortcut($DestinationPath) $WshShell = New-Object -comObject WScript.Shell $DestinationPath = "$env:PublicDesktopConfigMgr Panel.lnk" $SourceExe = "$env:windirsystem32control.exe" This is just a few lines of PowerShell code that you can run in system context, so Intune or CM is a great way to deploy the script to create shortcuts. The idea behind this was I wanted to create a shortcut to the Configuration Manager Control Panel applet on the desktop during OSD on all test machines.
Powerhsell create lnk file windows 10#
Windows 10 / Windows 11 customizations leveraging powershell.
