I wrote my last item for Win10.Guru to report that PowerShell 7 is out as a General Availability (GA) release. This time, I’ll explain how to add it to the built-in pop-up admin tools menu that shows up when you strike WinKey+X. The lead-in image for this story shows the results of my efforts, which turned out to be successful. But not before some asking around: I quickly discovered the Win+X Editor available through Sergey Tkachenko’s WinAero.com website. If you download and run this tool (no installation required), it will remove any old WinKey+X menu entries you don’t want (in my case, that included the old PowerShell 5.6 versions that come up by default). It will also let you add PowerShell 7 to the WinKey+X menu. But it doesn’t handle calling a version with admin privileges, nor does it offer controls over the order in which menu items appear. I had to turn to other resources to solve those problems.
Setting Up the PowerShell 7 (Admin) Menu Entry
I turned to Shawn Brink at TenForums.com, who graciously pointed me at a couple of his very helpful tutorials:
The first of these explains how to create a shortcut with administrative privileges for any Windows 10 application you might wish to call. It’s dead simple: once you’ve created the shortcut, right-click and open its properties window. On the Shortcut tab, click the Advanced button and then check the “Run as administrator” checkbox on the resulting pop-up windows. Click OK, Apply, OK and that’s now set up.
The second of these explains how to use Rafael Rivera’s nifty hashlnk program to create the necessary hash link file to create a new WinKey+X menu entry from a shortcut. All the syntax details are in the tutorial, so I’ll simply say that you must create the hash link, and then copy it to the right folder in the Windows X menu hierarchy at %LocalAppdata%\Microsoft\Windows\WinX. Counter-intuitively, Group 3 is the top group in that menu, so you must copy the hash link file to the Group 3 folder in C:\Users\AppData\Local\Microsoft\Windows\WinX.
This gets you most of where you need to go. But if you want to collate the entries in the menu according to your liking or preference, there’s one more step involved. First, take a look at the contents of the Group 3 folder and the item named 11-pwsh and its Properties window Shortcut tab.
Getting the WinKey+X Menu Order Right
The real name of the shortcut in this folder is 11-pwsh. I added the “11-” before the filename after experimenting with arranging it in the WinKey+X menu order (notice that the plain vanilla PS7 starts with “12-“, and others likewise use numeric strings). Handle this using the rename function in Explorer until you get it right. Then, whatever text you enter in the Comment field is what actually shows up in the corresponding WinKey+X menu entry. In this case that PowerShell 7 (Admin), as you can see in other screen captures here.
One more thing: you need to restart File Explorer before the WinKey+X menu will show any changes or additions you’ve made. Fortunately, Win+X Editor includes a button for that very purpose (lower right corner, as shown above). Click it, and wait for the navigation bar to come back, and you should be able to check your changes by striking WinKey+X.
That’s it! Now that there’s a new PowerShell out, I want to use it whenever I can. I figured that adding it to the WinKey+X menu would do the trick. For me, it’s working like a charm. If you follow these instructions and use the tools and tutorials I’ve linked to, you can do likewise.
Author: Ed Tittel
Ed Tittel is a 30-plus-year computer industry veteran. He’s a Princeton and multiple University of Texas graduate who’s worked in IT since 1981 when he started his first programming job. Over the past three decades he’s also worked as a manager, technical evangelist, consultant, trainer, and an expert witness. See his professional bio for all the details.