Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows 7, when you pin an application to the taskbar, you can right-click on it to display a "jump list". For example, Windows Media Player displays your recent playlists and some common tasks.

If you pin PowerShell, the jump list is headed "Tasks" and has "Run as Administrator", etc. on it.

One thing I find myself doing each time I log on is running PowerShell as Administrator, and then running a VsVars command to set it up as a Visual Studio command prompt. On other occasions, I might want to run a different action on starting PowerShell.

Is there any way to customize the PowerShell jump list to run different scripts when I start PowerShell?

share|improve this question
    
I will do some further research if I have a chance, but as of right now all the documentation that I see indicates that this needs to be implemented by the application. msdn.microsoft.com/en-us/library/windows/desktop/… –  EBGreen Sep 28 '11 at 14:14

1 Answer 1

To Pin Scripts:

Drag them over the powershell taskbar icon, wait until the "Pin to Powershell" tooltip appears and there you go.

To run things at startup you need first define what you refer with it. Windows Startup or Powershell startup? In the first case add a task in the Taskscheduler, for the second case add what you need to run in the Powershell profile.

Edition to answer the embedded "Second Question":

To launch it as admin, in the script that your going to pin put this:

  start powershell -verb runas -argumentlist "-noexit", "-command &{YourScriptCommandsHere}"

Is not perfect solution because is going to launch two powershell, the first is going to invoke the second elevated and then is going to disappear, then you could continue using the second after the block of code that you want to execute (marked as "YourScriptCommandsHere") runs.

share|improve this answer
    
Not bothered about Startup; I meant PoSh startup, not Windows. Edited question to clarify. –  Roger Lipscombe Oct 4 '11 at 20:36
    
Read the answer again and see if there is something missing. At the end i mention about Powershell profile, that is what you need to modify Posh Startup... to obtain help about, run get-help about_profiles –  mjsr Oct 4 '11 at 20:58
    
OK. Pin's useful. How do I get it to leave PowerShell running? Can I set it to prompt for elevation? –  Roger Lipscombe Oct 5 '11 at 8:53
    
It appears there is no way to edit how a script is run when you pin it. There is not "-noexit" to use within the script like you do calling it with PowerShell.exe apparently. I would suggest just putting it in your profile. If you don't want it to actually run the command just set it up as a function. I have functions that let me grab directory paths and values when I need them, in place of it showing everytime I start powershell.exe on a server. –  Shawn Melton Oct 7 '11 at 11:54
    
Check the edition, I put a working solution to achieve what you need –  mjsr Oct 7 '11 at 13:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.