Creating Folders and Security

V

Vayse

Hi
On the company server, there is a folder for each client. This folder should
be named after the Clients 6 digiit ID.
At the moment, the folders are created manually by users. Of course, this
leads to errors.
So I'd like to write a program that creates the folder. Just use
My.Computer.FileSystem.CreateDirectory will work fine, except for one issue.
I want to change the permissions on the server so that users can't create
folders manually. This also means the program won't work.
Is there something in VB that I have the program use admin permissions, so
that it will create the folder irrespective of the users rights?

Thanks
Vayse
 
G

Guest

You can't override the security mechanisms of Windows, but, you can use
impersonation with an account with sufficient permissions to create the
directories.

Look into the System.Security.Principal.WindowsImpersonationContext class.
There are a ton of example online.

Jared
 
G

Guest

Is there something in VB that I have the program use admin
permissions, so that it will create the folder irrespective of the
users rights?

Use impersonation to impersonate an admin account to set the folder
security.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top