Hi all,
In Vista, I am triying to assign the following file read-write-modify rights.
"C:\ProgramData \CompanyName\So meFolder\somefi le.dll"
I can do that manually by starting the command promt as administrator mode
then use the following utility.
takeown /f "C:\ProgramData \CompanyName\So meFolder\somefi le.dll"
icacls "C:\ProgramData \CompanyName\So meFolder\somefi le.dll" /grant
BUILTIN\Users:R WM
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.StartIn fo.FileName = @"C:\Windows\Sy stem32\takeown. exe"
process.StartIn fo.Arguments
=@"C:\ProgramDa ta\CompanyName\ SomeFolder\some file.dll /grant
BUILTIN\Users:R WM";
process.Start() ;
process.WaitFor Exit();
-----------------------------------------------------------------
Thanks in advance for your suggestions.
Kind regards,
MA
In Vista, I am triying to assign the following file read-write-modify rights.
"C:\ProgramData \CompanyName\So meFolder\somefi le.dll"
I can do that manually by starting the command promt as administrator mode
then use the following utility.
takeown /f "C:\ProgramData \CompanyName\So meFolder\somefi le.dll"
icacls "C:\ProgramData \CompanyName\So meFolder\somefi le.dll" /grant
BUILTIN\Users:R WM
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.StartIn fo.FileName = @"C:\Windows\Sy stem32\takeown. exe"
process.StartIn fo.Arguments
=@"C:\ProgramDa ta\CompanyName\ SomeFolder\some file.dll /grant
BUILTIN\Users:R WM";
process.Start() ;
process.WaitFor Exit();
-----------------------------------------------------------------
Thanks in advance for your suggestions.
Kind regards,
MA
Comment