?
Solved

how to get full access permission in vb.net application

Posted on 2011-02-19
3
Medium Priority
?
1,404 Views
Last Modified: 2012-05-11
Dim Target As DirectorySecurity = Directory.GetAccessControl("c:\test", AccessControlSections.All)
        'Dim NewRule As FileSystemAccessRule
        Dim NewRule As FileSystemAccessRule
        'NewRule = New FileSystemAccessRule(New NTAccount("MachineName\Account"), FileSystemRights.FullControl, AccessControlType.Allow)
        NewRule = New FileSystemAccessRule(New NTAccount("MachineName\Account"), FileSystemRights.FullControl, AccessControlType.Allow)
        Target.AddAccessRule(NewRule)

        Directory.SetAccessControl("c:\test", Target)
        MsgBox("successfully")

i am execute this code for full access permission then display the exception

[The process does not possess the 'SeSecurityPrivilege' privilege which is required for this operation.]

how to solve this error.
0
Comment
Question by:nickladdha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:HawyLem
ID: 34931965
You need to adjust your security privileges, using this api:
http://msdn.microsoft.com/en-us/library/aa375202(v=vs.85).aspx

Open in new window

0
 
LVL 11

Accepted Solution

by:
rowansmith earned 1500 total points
ID: 34931992
On a default windows installation only a member of the administrators group has this privilege.  On Windows 7 (and probably later) only the administrator has this privilege.  You need to run your code from an account that has this privilege.

That may mean running Visual Studio as an administrator so that you have your full debug environment available to you.  Once your program is written and working then you can look at adjusting your processes privileges at runtime to obtain the appropriate privilege.
0
 

Author Closing Comment

by:nickladdha
ID: 35189276
Incomplete
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question