Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shared folder permission!

Tags:

.net

vb.net

wmi

I use this code to share folder:

 Public Sub Share()
        Dim managementClass As New ManagementClass("Win32_Share")
        Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
        inParams("Description") = "My Description"
        inParams("Name") = "Share Name"
        inParams("Path") = "D:\Folder"
        inParams("Type") = &H0
        Dim outParams As ManagementBaseObject = managementClass.InvokeMethod("Create", inParams, Nothing)
        If Convert.ToUInt32(outParams.Properties("ReturnValue").Value) <> 0 Then MessageBox.Show("Unable to share directory.")
        MessageBox.Show("Shared folder successfully!")
    End 
Sub

Now what I want is to define user that can access to this folder through network? How I can do that?

Thanks!

like image 976
Comii Avatar asked Jan 12 '10 14:01

Comii


People also ask

What is the main function of share folder permission?

Shared folder permissions are used to restrict access to a folder or file that is shared over a network. Folder sharing is normally used to grant remote users access to files and folders over a network.

What are the two levels of permission for shared files and folders?

Windows provides two sets of permissions to restrict access to files and folders: NTFS permissions and share permissions.


1 Answers

This blog entry explains how to set up permissions for a share:

http://blogs.msdn.com/helloworld/archive/2008/06/06/programmatically-configuring-permissions-on-a-share-in-c.aspx

The code is in C#, so it not be a problem to port it to VB.

like image 182
Dave Cluderay Avatar answered Sep 27 '22 20:09

Dave Cluderay