View Full Version : Run as Administrator
NewsArchive
03-08-2016, 01:03 AM
There are certain things that need administrator privileges to run,
Example Setting Path
I have the end users edit the properties of the icon to "Run as
Administrator for all users
Is there a way programmatically do this in SB10 when creating the Icon?
Dan
NewsArchive
03-08-2016, 01:04 AM
You would do that via "#embed UAC manifest..."
UAC Execution Level would be requireAdministrator.
Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.
Grammar troll's, are the worse.
NewsArchive
03-08-2016, 01:04 AM
Jeff
Ok, I misunderstood what this meant. I figured it meant that only
administrator could run the program
Thanks
dan
NewsArchive
03-08-2016, 01:04 AM
It does
Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.
Grammar troll's, are the worse.
NewsArchive
03-08-2016, 01:05 AM
Ok, then that is not what I want.
Right now we have the end users go to the properties of the Icon and set the
program to "run as administrator"
Most are too stupid to accomplish this, I was hoping to be able to do this
for them on install of Icons
Dan Scott
NewsArchive
03-08-2016, 01:05 AM
Hi Dan,
> Right now we have the end users go to the properties of the Icon and set
> the program to "run as administrator"
> Most are too stupid to accomplish this, I was hoping to be able to do
> this for them on install of Icons
That is exactly what the manifest does when set to "requireAdministrator"
Best regards,
--
Arnor Baldvinsson
Icetips Alta LLC
NewsArchive
03-08-2016, 01:06 AM
Arnor
Ok then, if I create the manifest then it will make the program run as
administrator?
Dan
NewsArchive
03-08-2016, 01:06 AM
Assuming that the user has administrative rights on the computer.
Otherwise, it will refuse to run.
jf
NewsArchive
03-08-2016, 01:07 AM
Hi Dan,
> Ok then, if I create the manifest then it will make the program run as
> administrator?
Correct.
Best regards,
--
Arnor Baldvinsson
Icetips Alta LLC
NewsArchive
03-08-2016, 01:08 AM
Friedrich, Jane, Jeff & Arnor,
Is "Run as administrator" from the shortcut Advanced Properties the
same as setting the manifest UAC requireAdministrator?
Lee White
NewsArchive
03-08-2016, 01:08 AM
I'll say, "not quite."
A shortcut is a shortcut. I have on my laptop, for example, two shortcuts
to cmd.exe - one normal and one "as administrator". (I also use a different
background color for the administrator prompt, but that's a different
fetish.) It's the shortcut and not the app that's requesting elevation.
Embedding a manifest means that the app must ALWAYS run as administrator.
But as to actually running the program, either approach results in running
using an administrator token ("elevated").
jf
NewsArchive
03-08-2016, 02:20 AM
Hi Dan,
> There are certain things that need administrator privileges to run,
> Example Setting Path
>
> I have the end users edit the properties of the icon to "Run as
> Administrator for all users
> Is there a way programmatically do this in SB10 when creating the Icon?
The "Run as Administrator" option in the Shortcut is not really a Shortcut
property (you can't enable or disable the checkbox when you create a
Shortcut). It is a 'compatibility setting' for older (legacy) Windows
applications.
The recommended way is to embed a UAC manifest into your own application.
If you can't or don't want to do it, then you can set it through the "Set
App Compatibility Mode..." script function.
BTW, if your application really needs administrator execution level
privileges (only system tools should request this execution level) then I
would suggest to embed an "requireAdministrator" manifest into you own app
(e.g. with the "#embed UAC manifest..." compiler directive).
Does this help?
Friedrich
NewsArchive
03-08-2016, 07:10 AM
> The "Run as Administrator" option in the Shortcut is not really a Shortcut
> property (you can't enable or disable the checkbox when you create a
> Shortcut). It is a 'compatibility setting' for older (legacy) Windows
> applications.
BTW, what I said is not really accurate, technically speaking. I'll explain
later with examples.
Friedrich
NewsArchive
03-08-2016, 09:54 AM
Yes, Please do
Dan Scott
NewsArchive
03-08-2016, 12:25 PM
>
> Yes, Please do
>
Based on your original question and the discussions, I have done some
research on this. This research gave interesting results, which will lead
to new SetupBuilder options.
More to this tomorrow.
Friedrich
NewsArchive
03-09-2016, 03:08 AM
You Da Man Friedrich
Dan Scott
NewsArchive
03-09-2016, 08:33 AM
Hi Lee,
> Is "Run as administrator" from the shortcut Advanced Properties the
> same as setting the manifest UAC requireAdministrator?
Both the "Run as administrator" from the shortcut Advanced Properties and
the "requireAdministrator" UAC manifest will request administrator execution
level privileges for the application. So the execution level is identical.
But a "requireAdministrator" manifested application will always run
elevated, you can't run it non-elevated. So the advantage of "Run as
administrator" from the shortcut Advanced Properties is that it can run an
"asInvoker" manifested application elevated.
I know that quite a few developers have "asInvoker" manifested applications
that are normally launched as a "normal user", but need to be launched as
administrator to make some configuration settings. In this case, they can
create a second Shortcut with the "Run as administrator" property enabled.
Very cool.
I was following this interesting discussion here and suddenly an idea popped
into my head. Result: we can now programmatically set this "Run as
administrator" in the shortcut Advanced Properties from SetupBuilder 10.
Thank you all for being my inspiration :-)
Friedrich
--
Friedrich Linder
Lindersoft | SetupBuilder | www.lindersoft.com
954.252.3910 (within US) | +1.954.252.3910 (outside US)
--SetupBuilder "point. click. ship"
--Helping You Build Better Installations
--Create Windows 10 ready installations in minutes
--Official COMODO Code Signing and SSL Certificate Partner
NewsArchive
03-09-2016, 08:38 AM
Hi Dan,
>
> You Da Man Friedrich
>
I have added a new "Run as administrator (Advanced Property)" option to the
Shortcut Properties. See attached screenshots. This option can be used to
programmatically mark the "Run as administrator" checkbox on UAC-aware
operating systems (from Vista up to Windows 10 and Server 2016).
This will be available in the next maintenance build. But I can create an
internal build for you tomorrow, if you are interested.
Friedrich
NewsArchive
03-09-2016, 08:39 AM
Friedrich,
> I have added a new "Run as administrator (Advanced Property)" option to the
> Shortcut Properties. See attached screenshots. This option can be used to
> programmatically mark the "Run as administrator" checkbox on UAC-aware
> operating systems (from Vista up to Windows 10 and Server 2016).
You just keep raising that bar don't ya?!<g>
As always, excellent job!
--
Lee White
RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
RPM Review........: http://www.clarionmag.com/cmag/v11/v11n06rpm.html
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com
Creative Reporting: http://www.CreativeReporting.com
Product Release & Update Notices
http://twitter.com/DeveloperPLUS
Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"
And, now, Windows 10 brings us "The Inch Worm, Bumper Car of Wait!"
NewsArchive
03-09-2016, 01:23 PM
Hi Friedrich,
> administrator to make some configuration settings. In this case, they can
> create a second Shortcut with the "Run as administrator" property enabled.
> Very cool.
Some software will have stubs that they can execute elevated and then
call whatever function is needed. Or a program will elevate itself.
This can be done with ShellExecute/ShellExecuteEx and the 'runas' verb.
It will simply force elevation of the program being called. This
should not be used on OS' prior to Vista - XP behaves really weird if
you do this<g>
Best regards,
--
Arnor Baldvinsson
Icetips Alta LLC
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.