I was searching for some information on how to add custom menus to PowerShell ISE. I’d been meaning to play around with this for a while and had some time last night. So I went searching and came across what looked at first sight to be the perfect answer: a blog post by Jeffrey Snover entitled My PowerShell_ISE Profile. It did just want I wanted – so I added to my ISE profile and restarted ISE. WHOOPS – there were some really weird errors.
To make a long story short, PowerShell changed post CTP3 – in this case the $psISE.CustomMenu.Submenus.Add calls at the bottom of Jeffrey’s post no longer work. After tweeing my confusion, I got pointed to: http://powershellers.blogspot.com/2009/05/what-happened-to-custommenu-property.html which resolved the issue for me. Sadly, that page had not come up at all in the searching I’d done. While it’s not the point of this post, here’s the erroneous and corrected lines of Jeffrey’s script:
At the end of his script, the lines:
$null = $psISE.CustomMenu.Submenus.Add("Edit Selected", {Edit-Selected}, 'Ctrl+E')
$null = $psISE.CustomMenu.Submenus.Add("Export Session Files", {Export-SessionFiles}, 'Ctrl+SHIFT+E')
$null = $psISE.CustomMenu.Submenus.Add("Import Session Files", {Import-SessionFiles}, 'Ctrl+SHIFT+I')
Should read:
$null = $psISE.CurrentPowerShellTab.AddOnsMenu.submenus.Add("Edit Selected",{edit-selected}, 'Ctrl+E')
$null = $psISE.CurrentPowerShellTab.AddOnsMenu.submenus.Add("Export Session Files", {Export-SessionFiles}, 'Ctrl+Alt+E')
$null = $psISE.CurrentPowerShellTab.AddOnsMenu.submenus.Add("Import Session Files", {Import-SessionFiles}, 'Ctrl+Alt+I')
But that’s not the real problem – and I sure do not want to criticise the PowerShell Team! The problem is wider than this one post.The problem is that there’s been so much blog and web traffic around PowerShell that the Search Engines are promoting old content. For example: try searching for “PowerShell V2 dowload” – On Google the first three hits return links to Pre-RTM downloads. Bing is no better at present!
I think the solution is twofold. To some degree, the issue will tend to go away – as new content is created, indexed, referenced and used, the search engines will ‘learn’ the new content and ‘forget’ the older stuff. So let’s get going and start pointing to the updated key content! At the same time, it’ll be useful for bloggers to update their older content – either dropping it totally, or updating the content somehow. I’ll do what I can on that front!
In some respects, it’s a nice problem and one almost worth having! The search engines are just a reflection of the creators and consumers of content – if PowerShell wasn’t so popular, the links would be even worse!
1 comment:
Hmm...
When I search on Google with keywords "powershell ISE custommenu", my original blog post (http://powershellers.blogspot.com/2009/05/what-happened-to-custommenu-property.html) is the 4th link, and the one mirrored on http://powershell.com/cs/blogs/aleksandar/archive/2009/05/04/what-happened-to-a-custommenu-property.aspx is the 7th link (the 5th link on Bing).
Post a Comment