472,950 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 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

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"
=@"C:\ProgramData\CompanyName\SomeFolder\somefile. dll /grant

Thanks in advance for your suggestions.

Kind regards,
Aug 2 '08 #1
1 5708
I have solved the issue by providing the manifest file to the project. The
video below shows how to do it in VS 2008:

Aug 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Matthew Lee | last post by:
I am using a C# / ASP.NET application to fire an XCOPY job from the webserver to a UNC share. This setup works fine when copying to a local machine but refuses to work on the remote copy. The...
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
by: NAGY | last post by:
hello, I created an asp.net web app in C# from a non administrative account in Visual Studio 2003, .net 1.1. when i try to run the application in debug mode from Debug start menu option, i get an...
by: SiD` | last post by:
when starting a windows service writte in vb.net, a messagebox appears: cannot start service from the command line or a debugger. A windows service must first be installed using installutil.exe ...
by: kk | last post by:
hello to all, I want to call an exe file on other system(on the same LAN)though a webservice(by placing the dll).For that i use the following code in C#...... Process ps = new Process();...
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified user, but hangs in a suspended state. In fact, any...
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
by: Daniel | last post by:
what permissions does a windows service need to execute another process? System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); just local administrator? any specific...
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.