locked
Start PowerShell as different user by default RRS feed

  • Question

  • I've got the PS icon pinned to my start menu. I'd like to set it up to start as a different user when I left-click on the icon. I know I can SHIFT + Right-click to get the "Run as different user" option, but I don't want to do that if it can be avoided. Any thoughts?

    Thanks.
    • Moved by Bill_Stewart Monday, January 21, 2013 2:56 AM Moving to more appropriate forum
    Sunday, January 20, 2013 5:27 PM

Answers

  • Also you can use “Run As” command to run program with different users:

    More detail you can refer

    http://technet.microsoft.com/de-de/library/cc771525(v=ws.10).aspx

    Hope that helps:

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang
    TechNet Community Support

    • Marked as answer by Leo Huang Tuesday, January 29, 2013 2:09 AM
    Tuesday, January 22, 2013 2:58 AM
  • Hi,

     

    As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as ‘Answered’ as the previous steps should be helpful for many similar scenarios. If the issue still persists, please feel free to  reply this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish.

    BTW,  we’d love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems. Thanks for your understanding and efforts.

     

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang
    TechNet Community Support

    • Marked as answer by Leo Huang Tuesday, January 29, 2013 2:09 AM
    Tuesday, January 29, 2013 2:09 AM

All replies

  • I've got the PS icon pinned to my start menu. I'd like to set it up to start as a different user when I left-click on the icon. I know I can SHIFT + Right-click to get the "Run as different user" option, but I don't want to do that if it can be avoided. Any thoughts?

    Thanks.

    For information on ho to use your version of Windows you need to post in the Windows OS forum for the version of Windows you are trying to learn,

    http://social.technet.microsoft.com/Forums/en/category/w8itpro


    ¯\_(ツ)_/¯

    Sunday, January 20, 2013 6:13 PM
  • Create a shortcut to the runas command, and configure the shortcut's properties appropriately.

    Bill

    Sunday, January 20, 2013 6:17 PM
  • You can create your own icon that launches a batch file that runs a basic "runas" command with the right options.  Teh credentials will be stored and work until they expire.  When they expire the batch file will fail without telling you why.

    go to a command prompt and type "runas /?" for the options.

    I have done it several times before so I know this works.

    cs


    • Edited by CountryStyle Sunday, January 20, 2013 6:19 PM
    • Proposed as answer by CountryStyle Monday, January 21, 2013 12:36 AM
    Sunday, January 20, 2013 6:19 PM
  • You can create your own icon that launches a batch file that runs a basic "runas" command with the right options.  Teh credentials will be stored and work until they expire.  When they expire the batch file will fail without telling you why.

    go to a command prompt and type "runas /?" for the options.

    I have done it several times before so I know this works.

    cs


    It can be done with a simple shortcut. 

    I noted that this is not a scripting question.  The resolution of this for a new user is about learning how to use basic Windows and the desktop. The proper place to discuss the is in the Windows user forum.

    If we consider Windows 8 then the issue can get very much more complicated because you cannot do this on the start menu easily.

    I believe that new user questions about how to use basic windows features would be best handled by the OS users forums.


    ¯\_(ツ)_/¯

    Sunday, January 20, 2013 6:51 PM
  • To clarify; on all platforms except for Windows 8 it takes one small edit of a shortcut (one checkbox) to set it to run as another user. On W8 it takes an extra step.  Ther eis no need for scritps or batch files.

    You know what they say: "To a carpenter the solution to any problem includes a hammer and nail."


    ¯\_(ツ)_/¯


    • Edited by jrv Sunday, January 20, 2013 7:10 PM
    Sunday, January 20, 2013 7:08 PM
  • To clarify; on all platforms except for Windows 8 it takes one small edit of a shortcut (one checkbox) to set it to run as another user. On W8 it takes an extra step.  Ther eis no need for scritps or batch files.

    You know what they say: "To a carpenter the solution to any problem includes a hammer and nail."


    ¯\_(ツ)_/¯


    I thought you were not about to give an answer JRV.  As to your clarification...maybe you can provide a screenshot?
    Where exactly is that one small edit of a shortcut to be done?  I can't find that anywhere.

    I have not seen it on xp or Windows 7.  Does it allow the caching of credentials?  Are you talking about that run as administrator checkbox?

    Sunday, January 20, 2013 7:25 PM
  • To clarify; on all platforms except for Windows 8 it takes one small edit of a shortcut (one checkbox) to set it to run as another user. On W8 it takes an extra step.  Ther eis no need for scritps or batch files.

    You know what they say: "To a carpenter the solution to any problem includes a hammer and nail."


    ¯\_(ツ)_/¯


    I thought you were not about to give an answer JRV.  As to your clarification...maybe you can provide a screenshot?
    Where exactly is that one small edit of a shortcut to be done?  I can't find that anywhere.

    I have not seen it on xp or Windows 7.  Does it allow the caching of credentials?  Are you talking about that run as administrator checkbox?


    Second hint: Look for checkbox that says "run with different credentials.".  That part is the same on all versions.

    You canalso just use the system help to find out how to do this.

    You can also just post in the user forum or on Microsoft "Answers" for a quick answer. ( to be sure I just looked it up on "Answers" (first on list)).

    Google and Bing can also answer this question very quickly.  (first in list)

     


    ¯\_(ツ)_/¯

    Sunday, January 20, 2013 8:15 PM
  • On XP this taakes a total of three clicks.  On right click and two clicks - four if you count clicking the 'Save' button.


    ¯\_(ツ)_/¯

    Sunday, January 20, 2013 8:18 PM
  • WOW...thank JRV.  I never thought to look for something that said that.

    Sorry.  not on this box or other boxes I have used (I have windows 7 in front of me).

    Maybe you installed something on your machines.

    Trust me, if it was their by default I would have used it.


    Sunday, January 20, 2013 10:39 PM
  • AND there is NO WAY this takes 3 clicks or even 4

    click 1: right-click on icon

    click 2: select properties

    click 3: select some tab because this is not on the default tab.

    click 4: where is the check box?

    What you are describing is the item on the right-click menu.  <--that is not what the OP wants.

    maybe you could walk me through it a bit better because I think you are sending me on a wild goose chase.

    Maybe you are thinking of an XP computer joined to a domain?


    Sunday, January 20, 2013 10:43 PM
  • right - left - left - left - close.

    The OP asked how to make the shortcut use alternate credentails.  That is exactly what htis does. 

    Look very closely at each click result and you will see where the check box is.  It is in the same place it has been since Windows XP was delivered.

    HINT: You have to use a very 'Advanced' form of thinking about this.


    ¯\_(ツ)_/¯

    Sunday, January 20, 2013 11:45 PM
  • Here is another possibility that does not require a script or a batch file.

    Create a short cut with this line.

    runas /u:joeuser /savecred "%windir%\explorer.exe /e,/separate"

    This give you a new copy of E#xplorer running as the alternate user.  It i susefule for gaining access to the machine as an admin so you can just run any program or utility as an admin.


    ¯\_(ツ)_/¯

    Sunday, January 20, 2013 11:51 PM
  • right - left - left - left - close.

    The OP asked how to make the shortcut use alternate credentails.  That is exactly what htis does. 

    Look very closely at each click result and you will see where the check box is.  It is in the same place it has been since Windows XP was delivered.

    HINT: You have to use a very 'Advanced' form of thinking about this.


    ¯\_(ツ)_/¯


    Feeling a little too high and mighty?  That button is for run as admin.  The OP did not ask for that.
    Sunday, January 20, 2013 11:56 PM
  • Here is another possibility that does not require a script or a batch file.

    Create a short cut with this line.

    runas /u:joeuser /savecred "%windir%\explorer.exe /e,/separate"

    This give you a new copy of E#xplorer running as the alternate user.  It i susefule for gaining access to the machine as an admin so you can just run any program or utility as an admin.


    ¯\_(ツ)_/¯


    Thanks for reposting a differently worded version of the solution I had in my first post of this thread jrv.  I am glad we agree.
    Sunday, January 20, 2013 11:57 PM
  • Feeling a little too high and mighty?  That button is for run as admin.  The OP did not ask for that.

    Go back and look closely. Try very hard to actually try it.  YOu will see that is not just for admins.


    ¯\_(ツ)_/¯

    Monday, January 21, 2013 12:05 AM
  • Thanks for reposting a differently worded version of the solution I had in my first post of this thread jrv.  I am glad we agree.

    That is for a shortcut. You posted a solution for a batch file.  Your exact words:

    "

    You can create your own icon that launches a batch file that runs a basic "runas" command with the right options.  Teh credentials will be stored and work until they expire.  When they expire the batch file will fail without telling you why.

    go to a command prompt and type "runas /?" for the options.

    I have done it several times before so I know this works.

    cs

    "

    Note that you called it a batch file.

    Bill posted a note that a shortcut was all that was needed.

    Still - my point is still that all of this is about fundamental Windows operations and has nothing to do with script.  Remember that I said it would get longwinded.   The whole discussion belongs in a Windows Desktop users forum for new Windows users.


    ¯\_(ツ)_/¯





    • Edited by jrv Monday, January 21, 2013 12:14 AM
    Monday, January 21, 2013 12:10 AM
  • You are just too much lately jrv.    You answer my questions sometimes too and I have liked those responses.  You post a lot of good solutions but lately I am not seeing that.

    Instead of being short, aloof, flippant or telling people it cant be done why don't you start giving good answers again?

    1) Yes...I said use a batch file with the cred....it is the same thing as you posted after me except much easier to troubleshoot the command line.  But you have to make it sound like you have the answer.  You told the guy to go elsewhere for this trivial thing.  I am pretty sure the guy could have figured out that a one liner can go in a shortcut himself.

    2) instead of saying something is just 3 or 4 clicks away say what those clicks are.  If the button name is misleading then say so. 

    3) BTW: you are wrong.  That check box will not let you run it as a different user (at least on the non-domain computer) and I think you knew that already but have the "I am always right" blinders on.

    Monday, January 21, 2013 12:35 AM
  • Like I said - Windows 8 is different.

    Why are you getting so upset about this.  It is a simple issue.  Windows has shortccuts which are designed so any user withtou batch or wscripting skills can create specialized access to programs and it allows them to easily specify alternate credentials. This is fundamental to WIndows.

    If you were asked in an MCP certification exam your answer for a batch file would be considered as wrong.  Yes it works but it is not the primary method for doing this in WIndows.

    The OP is asking a question that shows they do not know about alternate credentials or shortcuts.  This is what a person learning Windows usually asks.

    Using a batch file oi OK but overkill.  A shortcut is all that is needed. 

    Now the OP has all possible methods and prpbably doesn't quite understand what the discussion is about.  Hopefully they find something useful.  Posting in a Windows user forum would have been more direct for a new user.

    The OP does not have Windows 8 if the statement is worded correctly although it may be.  The OP says that the "icon" is pinned to the start menu.  Icons are only on the start menu of pre-Windows 8 systems.  On WIndows 8 the "Start" menu is not a menu and has "tiles" and not icons.

    To RunAs on WIndows 8 we need to create a shortcut using 'RunAs' and pin it to the 'Start' menu.  That is why I posted the "RunAs" solution.

    Shortcuts are dynamically created in the 'StartMenu" folder under user\appdata\roaming.  They can be managed like all other shortcuts.

    Again - none of this is about scripting. My original issue here.

     

     

     


    ¯\_(ツ)_/¯

    Monday, January 21, 2013 1:08 AM
  • Agreed that the question really isn't a scripting question but rather a platform question ("how do I start a program with alternate credentials by default.") The fact that the shortcut points to powershell.exe doesn't make it a scripting question.

    Bill

    Monday, January 21, 2013 1:19 AM
  • blah blah blah.  You were wrong in this thread jrv.  Even for Windows XP and Windows 7 you are wrong.  Overly long and OT verbose posts won't make you right, you can't travel back in time.  I have probably been wrong more than you.  It is no big deal.

    You also could not accept that others gave a correct answer when you had a chance to answer it.  It is like you are addicted to forum points.

    Just admit it :)

    anyways.......this thread is about 8 posts longer than it needs to be.


    Monday, January 21, 2013 1:22 AM
  • I am sorry that you need to take this so personally. 

    I am not wrong for Windows 7 and XP. I have both and have tested on both. This is Windows.  Look it up in the help system.

    I suspect you are not seeing this because you have not really tried it.

    P.S.- I am test ing on both domain and non-domain PCs.

    The only thing I cannot check is XP "Home" edition which has more restrictions.


    ¯\_(ツ)_/¯

    Monday, January 21, 2013 1:29 AM

  • I tried it as soon as you mentioned it a long time ago....I don't have the I am always right blinders on.

    Windows 7 Ultimate:

    1) you did not try it on a system that is or has not been on a domain.

    2) you are lying

    3) you misinterpreted the help/support wrong

    4) the help/support is wrong

    If you are running the not ever hooked up to a domain windows 7 that I am you will see that it does not ask for credentials and simply has the run as administrator option.

    If you want me to look something up you better say what it is I am looking up.  There are way to many hits in the Help and Support.  Stop being vague and high handed (It is rude.), did you look it up?  Good then it should be easy for you to narrow down the search.   Like I said stop being so vague and aloof.

    Monday, January 21, 2013 1:42 AM
  • Agreed that the question really isn't a scripting question but rather a platform question ("how do I start a program with alternate credentials by default.") The fact that the shortcut points to powershell.exe doesn't make it a scripting question.

    Bill


    Who cares about that?  Someone had a question....they thought they were posting in the right forum but were not.  It was so easy to answer why not answer it?

    I (and you) decided to give a correct answer.  Someone else did not like it that someone else was able to post a correct answer.

    Monday, January 21, 2013 1:45 AM

  • I tried it as soon as you mentioned it a long time ago....I don't have the I am always right blinders on.

    Windows 7 Ultimate:

    1) you did not try it on a system that is or has not been on a domain.

    2) you are lying

    3) you misinterpreted the help/support wrong

    4) the help/support is wrong

    If you are running the not ever hooked up to a domain windows 7 that I am you will see that it does not ask for credentials and simply has the run as administrator option.

    If you want me to look something up you better say what it is I am looking up.  There are way to many hits in the Help and Support.  Stop being vague and high handed (It is rude.), did you look it up?  Good then it should be easy for you to narrow down the search.   Like I said stop being so vague and aloof.

    I have two machines that have never been on a domain and both allow full alternate credentials.

    You are mistaken about how this works.  I do not know why you are seeing what you are but it does not jive with and of the many systems I support.

    We will not agree so let's just let it be.


    ¯\_(ツ)_/¯

    Monday, January 21, 2013 1:46 AM
  • I should probably note one thing.  If you do not select the "Run with alternate credentials" check box the extra options are grayed out.  Many miss seeing how this works unless they actually check the checkbox.

    ¯\_(ツ)_/¯

    Monday, January 21, 2013 1:49 AM
  • That is not an option for me.  This is what is on my screen and it is not what you are seeing.  Where is this "run with alternate credentials" checkbox?.  Word for word from going to the ShortCut Tab>Advanced button>pop up form comes up:

    The Title:
    Choose the advanced properties you want for this shortcut.

    Not Greyed out:
    [checkbox] Run as administrator
    This option allows you to run this shortcut as an administrator, while protecting your computer from unauthorized activity.

    Greyed out:
    [checkbox-checked] Run in separate memory Space

    That is it.......maybe you have a windows feature turned on elsewhere that you did not know you turned on?  Maybe some service of feature was installed we don't know is required?


    Monday, January 21, 2013 1:58 AM

  • ¯\_(ツ)_/¯

    Monday, January 21, 2013 2:35 AM
  • I forgot to mention.  On WIndows 7 and 8 we can also use "Shift-RtClk" to get to the "Run As A Different User" command on executable files.


    ¯\_(ツ)_/¯

    • Proposed as answer by Leo Huang Tuesday, January 22, 2013 2:54 AM
    Monday, January 21, 2013 2:51 AM
  • Not on my system (see, I am not lying....).  So how do I get that option on my system?

    So maybe "runas" is the right answer?
    Maybe you can add more information to the advanced property solution to make it correct (instead of wrong) too???


    Monday, January 21, 2013 2:51 AM
  • Yes - my mistake. I got so caught up in shortcuts that I forgot that in Vista and later these things are all built into the system.   We just need to add the shift key to an right context menu click to cause the menu to be displayed with ALL items.  By default all menus are displayed with minimal items.

    I believe there is a way to assign the items to always be displayed.

    This would allow either one or two click to use alternate credentials.

    Finally, 'RunAs' can be embedded in the context menu with credentials and a password so by pointing at an item we can launch it with different credentials.  I have this set up under both XP and Windows 7. This should also work on W8.


    ¯\_(ツ)_/¯

    Monday, January 21, 2013 3:32 AM
  • Past Windows XP (I believe), Microsoft removed the ability to set a shortcut to run as a different user by default. (An annoying and irritating limitation, IMO.) SysInternals noticed this as well:

    ShellRunas

    Bill

    Tuesday, January 22, 2013 2:19 AM
  • Past Windows XP (I believe), Microsoft removed the ability to set a shortcut to run as a different user by default. (An annoying and irritating limitation, IMO.) SysInternals noticed this as well:

    ShellRunas

    Bill

    Don't look now but that is built into Windows and Windows 8.


    ¯\_(ツ)_/¯

    Tuesday, January 22, 2013 2:36 AM
  • Thank you Leo - I had completely forgotten that and went looking for what Bill just posted.  It then hit me that the 'shift' had been added.

    ¯\_(ツ)_/¯

    Tuesday, January 22, 2013 2:57 AM
  • Also you can use “Run As” command to run program with different users:

    More detail you can refer

    http://technet.microsoft.com/de-de/library/cc771525(v=ws.10).aspx

    Hope that helps:

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang
    TechNet Community Support

    • Marked as answer by Leo Huang Tuesday, January 29, 2013 2:09 AM
    Tuesday, January 22, 2013 2:58 AM
  • Hi,

    How’s everything going? Please feel free to give me any update.

    Thank you for your cooperation.

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang
    TechNet Community Support

    Thursday, January 24, 2013 9:11 AM
  • Hi,

     

    As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as ‘Answered’ as the previous steps should be helpful for many similar scenarios. If the issue still persists, please feel free to  reply this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish.

    BTW,  we’d love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems. Thanks for your understanding and efforts.

     

    Regards,

    Leo   Huang

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Leo Huang
    TechNet Community Support

    • Marked as answer by Leo Huang Tuesday, January 29, 2013 2:09 AM
    Tuesday, January 29, 2013 2:09 AM