Solved

how to get full access permission in vb.net application

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

837 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