Today I needed to create a shortcut for a program in a package. not that big a challenge I thought, as I have created lots of shortcuts during my 16 years deploying Windows and related software. But then the customer said ”oh, can you set the Run as Administrator flag on that?”.

Well, never had to do that before but it turns out that PowerShell once again comes to the rescue!

We can create the shortcut like we normally do, using the WScript.Shell.CreateShortcut method, and the using the System.IO.FileStream to modify the bitstream on the shortcut that controls the elevation prompt.

The following script contains a PowerShell cmdlet that will create shortcuts with or without elevation (Run as Administrator). The last line contains the call to the cmdlet that creates a shortcut for Notepad++ that will have the Run as Administrator flag set.

2014-12-16 14_13_19-2014-12-16 14_13_31-Notepad Admin Properties2014-12-16 14_13_49-Advanced Properties

The script


Download the script here:

Download “” – Downloaded 500 times – 1 KB