How to automatically run a shortcut with "RunAs" w/ credentials

Page 1 of 2 12 LastLast

  1. Posts : 71
    Windows 7 Ultimate x64
       #1

    How to automatically run a shortcut with "RunAs" w/ credentials


    WHat would I need to put in the target field of a shortcut properties in order to automatically run as a diff user? (Instead of holding down shift and right clicking on shortcut and selecting RunAs different user.) I am trying to run remote assistance as a diff user and I added /runas /user:username %windir%\systm32\msra.exe /offerra but nothing comes up, i see a window flash for a moment but nothing happens. also tried adding /passwordpassword) and that did not work either.


    thanks.
    Last edited by JustWatching; 16 Jan 2014 at 13:29.
      My Computer


  2. Posts : 72,258
    64-bit Windows 11 Pro for Workstations
       #2

    Hello JustWatching,

    This should be able to help you create a shortcut to run a program as a different user.

    Run as Different User Shortcut - Create for Specified Program and User

    You would want to use this command below. It will remember the password after you enter the password the first time it's opened.

    runas /savecred /user:USER-NAME "C:\full\path\of\Program.exe"

    Hope this helps, :)
    Shawn
      My Computer


  3. Posts : 71
    Windows 7 Ultimate x64
    Thread Starter
       #3

    Appreciate the reply. I do that, enter the password when it prompts and nothing happens msara,exe /offerra does not open. i tried removing the /offerra switch, still nothing opened.
    I just don't get it
      My Computer


  4. Posts : 72,258
    64-bit Windows 11 Pro for Workstations
       #4

    I used this below in a .bat file to test and debug with, and appears that it's failing because it requires elevation.

    Code:
     
    runas /savecred /user:USER-NAME "C:\Windows\System32\msra.exe"
     
    pause
    How to automatically run a shortcut with "RunAs" w/ credentials-command.jpg

    I've tried every possible way to run it elevated from the shortcut to setting msra.exe itself to "Run as administrator" when opened, but they all failed to run.
      My Computer


  5. Posts : 71
    Windows 7 Ultimate x64
    Thread Starter
       #5

    Well that is unfortunate.
    Thank you for all the help.
      My Computer


  6. Posts : 72,258
    64-bit Windows 11 Pro for Workstations
       #6

    If you like, you could still use the normal method to "Run as different user" with msra.exe, but you will still have to enter the other user's password each time. The tutorial below will help a bit by not having to press and hold Shift at least.

    Run as Different User - With or Without Shift+Right Click Context Menu
      My Computer


  7. Posts : 71
    Windows 7 Ultimate x64
    Thread Starter
       #7

    Well thats very cool and i works perfect except for one thing. My msra.exe /offerra is pinned to my taskbar, Always lots of windows open so its quicker than trying to use a shortcut on the desktop. The modified right click menu does not work when the item is pinned to to the taskbar. I can right click on it once, and it will give me 'unpin from taskbar' and the exe, i then right click on that exe and it just give me the default right click menu
      My Computer


  8. Posts : 72,258
    64-bit Windows 11 Pro for Workstations
       #8

    Ah, yeah I forgot that it didn't affect the context menu of an icon on the taskbar.
      My Computer


  9. Posts : 71
    Windows 7 Ultimate x64
    Thread Starter
       #9

    Well I appreciate all the help anyways. Very odd that I cannot' force' it to run even with elevated privileges. I don't suppose ti would be possible to have a power-shell script make it auto 'runas' with the credentials? I guess if it won't work manually, it won't work with a PS script either. Oh well. I guess you can close this :)
      My Computer


  10. Posts : 72,258
    64-bit Windows 11 Pro for Workstations
       #10

    I'm afraid I don't know much about PowerShell scripts.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 02:58.
Find Us