It is currently April 25th, 2024, 8:47 am

A way to force links to run as admin?

Get help with installing and using Rainmeter.
madmist78
Posts: 3
Joined: October 24th, 2013, 8:10 pm

A way to force links to run as admin?

Post by madmist78 »

Hey, there, about 3 months ago got a new boss. He insists that the sysadmins use a non-privileged account to login to our computers, and elevate as necessary. I know this is a good thing, and I'm more than used to elevating and typing my password.

I'm new to Rainmeter, and I'm having fun with it... however I'm trying to see if there is a way I can force links to programs or MMC's to run as admin. Specifically I am playing with Blue Overview. On the edit, I find this for some of the links:

ButtonRight2 = "Computer Management"
ButtonRight2Path = "compmgmt.msc"
&
ButtonRight5 = "Snipping Tool"
ButtonRight5Path = "%windir%\system32\SnippingTool.exe"

Is there a way on either of these kinds of links to force them to run as admin? Again, I don't mind logging in with my credentials, I just don't see a way to do it.

Many thanks!
madmist78
Posts: 3
Joined: October 24th, 2013, 8:10 pm

Re: A way to force links to run as admin?

Post by madmist78 »

Not looking good huh?
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: A way to force links to run as admin?

Post by moshi »

you do not need to use the path to the executable in a Rainmeter skin.
you could just as well use the path to a Windows shortcut or to a script here.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: A way to force links to run as admin?

Post by jsmorley »

There is no way to have Rainmeter execute an application with elevated permissions. You could instead of directly running the applications, create shortcuts to them, and use Windows itself to set the shortcuts to "Run as administrator". Then run the .lnk shortcuts in Rainmeter instead of directly calling the application.
User avatar
Ryuzaki
Posts: 7
Joined: April 1st, 2015, 5:31 pm

Re: A way to force links to run as admin?

Post by Ryuzaki »

Yeah, I'm looking fo the same thing. But even using the .lnk to run as administrador it didnt work. Everytime I try to open, it opens the original.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: A way to force links to run as admin?

Post by jsmorley »

Ryuzaki wrote:Yeah, I'm looking fo the same thing. But even using the .lnk to run as administrador it didnt work. Everytime I try to open, it opens the original.
Yeah, you are right. it seems that if you open a .lnk file (shortcut) with Rainmeter, any "As administrator" setting that is applied to the shortcut in Properties is just ignored.

Windows is just very touchy about a program (Rainmeter) that does not have administrator privileges, executing something that does. it insists on "inheritance" for security settings when an application executes a shell command.

You will have to set Rainmeter itself to run "As administrator" for this to work for you. Then your elevated shortcut or program should run elevated.
MikeG621
Posts: 87
Joined: March 18th, 2013, 1:59 pm

Re: A way to force links to run as admin?

Post by MikeG621 »

If you have something specific that you may need to run as admin, you can call it from a batch file that will seek admin privs if they're available.

Code: Select all

@echo off
whoami /groups | find "S-1-16-12288" > nul && goto CONTINUE
whoami /groups | find "S-1-5-32-544" > nul && (
	rem Start batch again with UAC
	echo Admin rights available but not active, restarting...
	echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
	echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
	"%temp%\getadmin.vbs"
	del "%temp%\getadmin.vbs"
	exit /B
)
echo Admin rights are not available, contact an administrator
pause
exit /b
:CONTINUE
And then continue with calling out the application you need in the batch file after that. I use this is my deployment scripts; if the user has admin rights it'll restart and UAC will kick in but if not it'll just kick out with an error.
amanwithnobrain
Posts: 1
Joined: December 7th, 2016, 9:36 am

Re: A way to force links to run as admin?

Post by amanwithnobrain »

jsmorley wrote:Yeah, you are right. it seems that if you open a .lnk file (shortcut) with Rainmeter, any "As administrator" setting that is applied to the shortcut in Properties is just ignored.

Windows is just very touchy about a program (Rainmeter) that does not have administrator privileges, executing something that does. it insists on "inheritance" for security settings when an application executes a shell command.

You will have to set Rainmeter itself to run "As administrator" for this to work for you. Then your elevated shortcut or program should run elevated.
thank you . it works like a charm :D