Run as Administrator greyed out on shortcut

63,942

Solution 1

You may be able to use the run as administrator available on the compatibility tab.

One way third party way would be with nircmd. http://www.nirsoft.net/utils/nircmd2.html#elevate

Solution 2

It works if you add the executable to the shortcut target. For example:

Right-click on the shortcut and change the target from:

C:\Scripts\helloworld.js

to

wscript.exe C:\Scripts\helloworld.js

(or)

cscript.exe C:\Scripts\helloworld.js

Then the Run as Administrator checkbox is activated in properties.

Eg:

for a python script add in the target field:

"C:\Users\......\Python36\python.exe" "C:\Users\......\test.py"

For PowerShell script add this in the target:

powershell.exe -command "& 'C:\A path with spaces\MyScript.ps1'"

(if you want to also pass some args see this)

Don't forget to check the "run as admin" after...

All the glory to Ramesh Srinivasan

Solution 3

It seems as though the "run as administrator" context menu option and/or shortcut checkbox are unavailable for batch files/scripts. This was answered for PowerShell here: How to run script as administrator?

I don't have an answer yet for running a common batch file.

Solution 4

This seems to happen when a shortcut points to an object identifier rather than a directory path.

You can tell if this is the case because the target in the shortcut properties is something like {0AFACED1-E828-11D1-9187-B532F1E9575D} instead of a directory path.

If you want to create a shortcut to something in C:\Windows\System32, create the shortcut directly off an item in that folder, rather than trying to create it from an existing shortcut on the start menu.

Solution 5

  1. Go to the properties of shortcut file
  2. Click on shortcut tab
  3. add "powershell.exe" before the path of file in Target

it should look like below:

powershell.exe -file "H:\Powershell\MyPoshScript.ps1"

  1. Click apply
  2. Click advance button
  3. Run as administrator now selectable.
  4. Check Run as administrator and apply --> OK

Done

reference from: How to run script as administrator?

Share:
63,942

Related videos on Youtube

man-qa
Author by

man-qa

.

Updated on September 18, 2022

Comments

  • man-qa
    man-qa over 1 year

    I have a shortcut to a program that only works when run as administrator but in the shortcuts advanced options "always run as administrator" is greyed out. I've looked at the other similar questions but none apply to my issue. UAC is enabled, I am an administrator and i have no idea how to run it in cmd.

    • Franchesco
      Franchesco about 9 years
      The program is in a network? Programs in a network won't run as administrator.
    • Mawg says reinstate Monica
      Mawg says reinstate Monica about 9 years
      Of course you would prefer to set & forget "always run as administrator", but, until you get that working, you can right click the icon and select "run as administrator,", although you will have to do that every time that your want to run it.
    • man-qa
      man-qa about 9 years
      @Earendul The program isnt in a network.
    • man-qa
      man-qa about 9 years
      @Mawg I'm not sure why but right click the shortcut doesn't bring up the option to run as admin, even though i can click the original .exe and run that as admin
    • Mawg says reinstate Monica
      Mawg says reinstate Monica about 9 years
      Can you start it from the command line by using an elevated command prompt? windows.microsoft.com/en-us/windows/…
    • man-qa
      man-qa about 9 years
      @Mawg Like i said in the question, I have no idea how to run it in cmd
    • Mawg says reinstate Monica
      Mawg says reinstate Monica about 9 years
      Does right click offer nothing at all? If you can select Properties, then Target will give you the command line that you need.
    • Moab
      Moab about 9 years
      Make a new user admin account and log into it, does it still have the issue?
    • man-qa
      man-qa about 9 years
      @Mawh I can right click it to see the target but I still don't know how to run it in cmd.
    • man-qa
      man-qa about 9 years
      @Moab I tried to follow your advice but it wouldn't let me create a new admin account as it is a work PC.
    • Moab
      Moab about 9 years
      Since it is a work PC, contact your computer administrator about the issue.
    • Ramhound
      Ramhound about 9 years
      @man-qa - Sounds like you are not actually an Administrator domain permissions overrule your local permissions.
    • David Wilson
      David Wilson over 8 years
      What level is your UAC set to? The always run as administrator is usually only greyed out if UAC is set too low. It should be set to "Notify me when applications try to make changes to my computer (default)"
  • Ramhound
    Ramhound about 9 years
    The author indicated this option is grayed out.
  • birdman3131
    birdman3131 about 9 years
    No they did not. They stated the option was greyed out on the advanced options on the shortcut tab. I was referring to the spot on the compatibility tab.
  • man-qa
    man-qa about 9 years
    @birdman3131 Wow i didn't expect this to work but it did. Thanks birdman :)
  • SamB
    SamB over 8 years
    That's not the only way this can happen; I think it can also happen when you need admin in order to modify the shortcut file. At any rate, I'm seeing this with a path-based shortcut that was put on my start menu by an installer. Oh, it could also be because the target is an .ini file, not an executable...
  • killjoy
    killjoy about 7 years
    When I try creating a shortcut to hosts, it says cannot create shortcut here, would you like it on the desktop instead; but why am I suffering through this even when I am admin on this box ??
  • JinSnow
    JinSnow over 5 years
    I have this problem on a python script shortcut
  • Jeff Jenkins
    Jeff Jenkins over 5 years
    This is a nice little workaround. I was able to make a shortcut to my "hosts" file using this technique with Visual Studio Code. Example shortcut: "C:\Users\quantastical\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\Windows\system32\drivers\etc\hosts"
  • Alex Essilfie
    Alex Essilfie about 3 years
    Your question does not directly answer the question. Please add it as a comment to the question instead.
  • AlainD
    AlainD about 2 years
    This option worked for me trying to start a service. Shortcuts to both a batch file running net start Spooler and a Powershell script running Start-Service Spooler both had Run as Administrator greyed out. Changing the shortcut target to cmd.exe /c "blah" and powershell.exe -file "blah" worked.