Link to home
Start Free TrialLog in
Avatar of exhuser
exhuser

asked on

Permissions to C-dirve

I've setup a script that would output a log file to the root of C-drive. I've enabled it to run it as a task with admin privileges. However, the script failed to execute due to the permission errors. When I tried to create a file manually on the C-drive, I received a prompt "You'll need to provide administrator permissions to copy to this folder". And I would need to click "Continue". I am logged in as local admin. How can I disable this in Windows?
Avatar of bbao
bbao
Flag of Australia image

> a script that would output a log file to the root of C-drive

instead of the root folder, why not simply writing to a subfolder say C:\TEMP?

it is better to get thing done without compromising security rules. right?
disable the UAC on your system and see if that works and run the script.
if not,  start the powershell with "Run as administrator" by right clicking the "Windows powershell" icon and then run the script
"I've enabled it to run it as a task with admin privileges." No you haven't. If you had, it would work.
I guess, you have missed either step 1 or 2 of:
1) as executing account, use a local admin or the system account - if system, you can even skip step 2
2) check "run with highest privileges" in the task properties (on the tab "general")

If that does not work, do a test. As task action, choose
cmd /c echo test>c:\test.txt

Open in new window

From Vista on-wards the root of c:\ is a protected area. You can right click C: go to properties then security and change the permissions.  This is not recommended, what is recommended is to adjust your behavior and save to a subfolder
Avatar of exhuser
exhuser

ASKER

In Control Panel under Scheduled Tasks, I selected "Run Task with highest privileges". It still would not create a file on the root of C-drive. I did not want to change the default permissions or UAC, so I modified the script.

One question as to the script: I selected Run Hidden under the task property; however, it still displays taskeng.exe window. Is there a way to hide it?
What account are you using to execute your task? Let's clear that up, first. Is it an administrator? If so, try my test syntax and see if it works, see above, take
cmd /c echo test>c:\test.txt
as task action.
Avatar of exhuser

ASKER

cmd /c echo test>c:\test.txt -->'Access Denied' message


I now need to take care of the 'Hidden' option.
I do the same and it works, so please tell me what exactly does your task look like? Has nothing to do with hidden/not hidden.
Avatar of exhuser

ASKER

I understand and I gave up on modifying the root folder.

Now I need to make sure the scrip runs 'hidden' when 'hidden' option is selected
ASKER CERTIFIED SOLUTION
Avatar of McKnife
McKnife
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial