Solved

how to get full access permission in vb.net application

Posted on 2011-02-19
3
1,391 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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 canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
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…

729 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