Create Shortcut in PowerShell and Shutdown Icon Shortcut in PowerShell

In this post, we are going to see various shortcut tips related to PowerShell.  Initially, we are going to see how to create a shortcut using the built-in shortcut command-let.  Then we will move on to other interesting things that we can do using the create shortcut command-let.

Jump to:

  1. 6 Steps to create a shortcut in PowerShell.
  2. 3 Steps to create PowerShell shortcut to ShutDown Computer.
  3. Verdict.

People also search for:

Shut Down yours and multiple remote computers using PowerShell

6 Steps to create a shortcut in PowerShell:

  1. Create variables to store the location of the executable and the destination location of the shortcut. Note that Event Viewer is located in System 32.
    $SourceFileLocation = “$env:SystemRoot\System32\eventvwr.exe”
    $ShortcutLocation = “C:\Users\$env:USERNAME\Desktop\Event Viewer.lnk”
  2. Create a new WScript.Shell object.
    $WScriptShell = New-Object -ComObject WScript.Shell
  3. Pass the shortcut location and target file path to the WScript.Shell object.
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutLocation)
    $Shortcut.TargetPath = $SourceFileLocation
  4. Save the shortcut.
  5. The code on the shell will look as follows.
    create a shortcut in PowerShell
  6. The created shortcut is shown in the image.
    The created shortcut in PowerShell

3 steps to create PowerShell Shortcut to Shutdown computer:

We can take the shortcut solution to the next level using the shutdown command.  We will create a Microsoft Edge icon on the Desktop.  We will add a command to the icon such that on, clicking it, the system will shut down.  We have demonstrated it below.

    1. We need the Microsoft Edge icon.  We can right-click the below icon and use save as option to save it to the Downloads folder. Please note that you have to save it to the Downloads folder.
      icon image
      icon image
    2. Open the PowerShell terminal and enter the following script.
      $SourceFileLocation = “%windir%\System32\shutdown.exe”
      $ShortcutLocation = “C:\Users\$env:USERNAME\Desktop\Microsoft Edge.lnk”
      $WScriptShell = New-Object -ComObject WScript.Shell
      $Shortcut = $WScriptShell.CreateShortcut($ShortcutLocation)
      $Shortcut.TargetPath = $SourceFileLocation
      $Shortcut.IconLocation = “C:\Users\$env:USERNAME\Downloads\Microsoft-Edge.ico”
      $Shortcut.Arguments = “/s /t 0”
    3. Try out the icon and see how the computer shuts down.

If you have completed the above steps correctly, you will be able to shut down the computer by clicking the edge icon.

Create shut down shortcut
Created shutdown shortcut


It is very easy to create a shortcut using PowerShell.  We use WScript.Shell’s create shortcut object to create a custom shortcut.  In the first part, we learned how to create a shortcut using a few simple steps.  In the second part, we created a shortcut that helps us shut down the computer using the shortcut.

If you want more such interesting posts, please stay tuned to TecKangaroo.

2 thoughts on “Create Shortcut in PowerShell and Shutdown Icon Shortcut in PowerShell”

  1. Exception setting “IconLocation”: “The property ‘IconLocation’ cannot be found on this object. Verify that the property
    exists and can be set.” Getting the above error. PLEASE HELP.


Leave a Comment