Stop program from running as admin - windows-10

I have a program that runs with elevated privileges when I double click on the icon(Task Manger shows Elevated = Yes). I do not want it to run with elevated privileges but I have not been able to figure out how to turn it off.
I checked the following places:
1.)Right Click on the shortcut -> Advanced -> Run as admin is unchecked
2.)Right Click on the shortcut -> Compatibility -> Run as admin is unchecked
3.)Right Click on the exe -> Compatibility -> Run as admin is unchecked
I've tried the following commands:
1.)runas /trustlevel:0x20000 "newapp.exe"
2.)runas /user:domain\username "newapp.exe"
No matter what I do or check the app still runs with elevated privileges. Any ideas on how to resolve this issue is greatly appreciated.

There are at least 4 reasons why Windows might decide to UAC elevate a new process.
requestedExecutionLevel in the manifest is set to requireAdministrator or highestAvailable.
Installer detection.
The compatibility tab for the shortcut or .exe has set certain properties (run as Windows XP etc.)
ShellExecute was invoked with the RunAs verb.
The application manifest is embedded in the .exe or in a file next to it named "applicationname.exe.manifest". You can explore the embedded manifest with a tool like Manifest View or Resource Hacker.
If you did not write the application yourself, do you actually know if it will even work if not elevated? You can try to force it in cmd.exe:
set __COMPAT_LAYER=RunAsInvoker
c:\path\theapp.exe

Related

NSIS, Do not show uac dialog

After installation of the program, can not make uac dialog box disappear when the program is run?
Can I grant administrator privileges to install and have it run automatically at install time?
You cannot bypass UAC, the user is supposed to be in control of their computer, that is the whole point of UAC! If you want to do machine wide changes that require administrator privileges there is no way around it, the user has to elevate with UAC at least once.
If you want the installed application to run elevated automatically then you must write a custom service that can be started on demand. When a administrator starts your application un-elevated the application must start your service and ask it to launch a elevated instance. The service must then call CreateProcessAsUser with the linked elevated token. This is too difficult for most developers and most applications just have to accept the fact that they must display a UAC prompt when they are started.

How do I get my application to run with administrator rights automatically?

I've made a console application that is supposed to update some registry entries so that I can access 32 bit COM components from a 64 bit application. If I have admin rights, it works great, but I can't seem to get the application run with admin rights out of the box.
This is what I've done.
Create a Windows Console Application.
Add my code.
Right click on my project and select Properties.
Navigate to Configuration Properties > Linker > Manifest File > UAC Execution Level and set to requireAdministrator (/level='requireAdministrator').
It took a lot to figure out this because all of the info on the web is for Visual Studio 2010 or earlier which required manually creating an XML manifest file and conflicts with the auto generated one that this creates.
However, this doesn't seem to be enough to get it to run as an admin. It is a real PITA that this information isn't made easily findable. Is there some other step that I am missing? Something like a signing process?
Turns out it is how this mini application is run.
From my main programme, using ShellExecute() or ShellExecuteEx() with the "runas" verb will allow running of this executable with administrator privileges without popping up a UAC dialog.
Running this from the command line however, will result in this mini app being executed in the user's security context, which is what I was doing.

Custom Action exe with evaluated privilege for Installsheild Limited edition

I am using the Limited edition and in my installer I have a custom action where I open a cmd.exe and passing a batch file for executing.
The cmd is executing but its not in the elevated permission. I need to execute this in elevated permission since my batch file has operations which needs admin privilege.
I tried many options and the screen shots attached describes what I have done.
Let me know if this is possible with Limited Edition. I am installing in windows 10 machine.
the whole "Elevetad privilege" thing changed a lot during the lasts years.
if I were you, I'd put the schema to version 500 (the last one)
you'll might wan't to double check that your batch file is correctly found, as properties in system context can be unavailable. (use /k so the cmd prompt will not close and you'll be able to see the result of your batch file.)
also if the UAC is disabled on the client machine the user won't have the right to elevate your installer so setting the Require Administrative privilege won't change anything.
in order to be sure, you'll might wan't to use a install condition validating the Privileged property.

Windows Server 2012: trying to copy files via command line, getting permission denied

I'm trying to programmatically copy major folders from C: to E:, for the purpose of automatically backing these folders up. It seems to me, as Administrator, I should have full access like root does on Linux, especially for only reading files.
This makes no sense to me. I'm logged in as Administrator, I run powershell as administrator, and I even went to the Control Panel and moved the UAC slider thing all the way down.
So why am I getting access/permissions errors when trying to copy C:\Users or 'C:\Program Files'?
This will get migrated hopefully, but the answer is that Windows is not like Linux. The Administrator account is not like the root account. It does not, by default, have various rights unless you do the equivalent of a sudo, which is to run the prompt at an elevated rights. Right click on your powershell prompt and choose Run as Administrator.
Dragging the UAC slider down does not turn off UAC, it just turns off the UAC warnings when something wants elevation.

Problem in registering a 32 bit C++ COM/ATL Service on Windows7 64 bit

My product have a ATL/COM based C++ service (32 bit). It get registered and run fine on XP 32 bit and Vista 32 bit.
But now I want to run the same on Windows7 64 bit also. I tried to register the service the following way:
1 I did Copy MyService.exe at C:\Windows\SysWOW64.
2 Then executing "C:\Windows\SysWOW64\MyService.exe" -RegServer from Start->Run
3 Then executing "C:\Windows\SysWOW64\MyService.exe" -Service from Start->Run
But my service is not getting registered. While registering it, I don't get any error message. Also I didn't find any entry in event viewer (I saw event viewer first time. Don't know where to see the log about registration of my service). And I didn't find entry for my service at Control Panel\Administrative Tools\Services.
Please advise me how can I register my service?
Thanks in Advance
Regards
If UAC is enabled on the machine then registering it via Start -> Run is unlikely to work as it would almost certainly need full administrator rights to register its objects and create its service.
Open an Administrator command prompt and try registering it from there.
(Find Command Prompt in the start menu, right-click it and select Run as Administrator.)
Alternatively, instead of using Start -> Run, type the command directly into the Windows 7 start menu and then push Ctrl-Shift-Return to run it as Administrator.
Try commands at cmd running at administrator rights.

Resources