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

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.

Related

Stop program from running as admin

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

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.

What permissions are required to run VS with IIS

When working on a project that uses IIS (not IIS Express) for local development, what permissions are actually required under window 8? I don't want to run as admin all the time...the first error message I get when running using the Local User Account (LUA) was about Metabase (probably a misnomer, as changing the permissions on that gave the same error message until the config files in inetsrv/config were also available). Now it builds, but then gives an error message "Unable to start debugging on web server. IIS does not list a web site that matches the launched URL".
The blog https://blogs.msdn.microsoft.com/jaredpar/2005/02/04/myth-creating-web-applications-with-visual-studio-requires-admin-privileges/ while old, at least hints that it should be possible to manually give myself (or a group that I create) the right permissions. Just need to figure out what those permissions are...
To run VS against IIS you need to run VS elevated (the process needs admin permissions).
From a non-admin account you could run VS "As Administrator", you will also need to do this with the tools necessary to configure IIS.
However I've never tried that, rather I run with a non-elevated admin account so any file changes from within an elevated VS are fully accessible to non-elevated processes.
Additional: note, VS really only needs the Debug Any Process privilege, but giving that one privilege gives the ability to gain all others (with some effort) going through the work to limit the VS process to just that one difference seems pointless.

Turn off 'Perforce change - o' command

I'm logged in with the Perforce viewer client on my MacBook Pro, and I keep getting this popup that says:
You don't have permission to execute the "P4 change -o" command
This happens ever 5 minutes or so. How do I turn this off?
The P4V client program will run certain commands as needed. It is possible that your workspace specification could have something mapped in it that you do not have sufficient permissions to run this command on. You can see what permissions are required for certain commands in the Server Administrator's Guide: http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.protections.html#DB5-35217 (the change command requires "open" access level).
You may wish to check with your server administrator to check what you do have access to and look at the client workspace mapping to see if there might be something mapped there that your user does not have sufficient permission to access.

Resources