471,330 Members | 1,490 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

How to start a Process as administrator mode

Hi all,

In Vista, I am triying to assign the following file read-write-modify rights.

"C:\ProgramData\CompanyName\SomeFolder\somefile.dl l"

I can do that manually by starting the command promt as administrator mode
then use the following utility.

takeown /f "C:\ProgramData\CompanyName\SomeFolder\somefile.dl l"
icacls "C:\ProgramData\CompanyName\SomeFolder\somefile.dl l" /grant
BUILTIN\Users:RWM

I need to automate this process as part of the installer so I created a C#
wrapper to perform then above tasks but it does not work it it complians that
I do not have proper rights. I think reason is because the Process I started
is not admin. My question is how can I start a process as admin and perform
the task. See the code below:

-----------------------------------------------------------------
process.StartInfo.FileName = @"C:\Windows\System32\takeown.exe"
process.StartInfo.Arguments
=@"C:\ProgramData\CompanyName\SomeFolder\somefile. dll /grant
BUILTIN\Users:RWM";
process.Start();
process.WaitForExit();
-----------------------------------------------------------------

Thanks in advance for your suggestions.

Kind regards,
MA
Aug 2 '08 #1
1 5621
I have solved the issue by providing the manifest file to the project. The
video below shows how to do it in VS 2008:
http://channel9.msdn.com/posts/Danie...s-with-VS2008/

Thanks,
MA
Aug 2 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Matthew Lee | last post: by
16 posts views Thread by Serdar Kalaycý | last post: by
5 posts views Thread by SiD` | last post: by
11 posts views Thread by Kirk | last post: by
4 posts views Thread by =?Utf-8?B?VkIgSm9ubmll?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.