Solved

how to get full access permission in vb.net application

Posted on 2011-02-19
3
1,352 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
3 Comments
 
LVL 4

Expert Comment

by:HawyLem
Comment Utility
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
Comment Utility
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
Comment Utility
Incomplete
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now