Avatar of jagged_edge
Flag for United States of America

asked on 

Setting Shared Folder Permissions

I'm an Intern at a software development company. I needed to make a deployment (using VS 2008) that installs the files and directories required for our product. The deployment itself is done, I wrote a custom action to share the product's program directory (making it accessible to the networked terminals which are dependent on data files stored in the main server).

The problem is that the folder is shared and accessible to the local machine, and is visible to the networked terminals. But, whenever a networked terminal attempts to open the directory they receive an error:
\\server's name\Product Folder is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.
Access is denied.

I am attaching the code I have. I would really like to find a way to do this in VB.NET and with out Shell.
Imports System.Management
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Imports System.IO
Imports System.Reflection
Imports System.Security.Permissions
Imports IWshRuntimeLibrary
Imports System.Security.AccessControl
<event handlers are here>
Private Sub Shareit()
           Dim managementClass As New ManagementClass("Win32_Share")
           Dim inParams As ManagementBaseObject =  managementClass.GetMethodParameters("Create")
            inParams("Description") = " "
            inParams("Name") = "Product's Name"
            inParams("Path") = Installationpath
            inParams("Type") = &H0
            ' Sets the Program Files app folder to Share
            Dim outParams As ManagementBaseObject = managementClass.InvokeMethod("Create", inParams, Nothing)
            ' Sets the Shared Folder Permissions to All Access
            Dim fp As New FileIOPermission(FileIOPermissionAccess.AllAccess, Installationpath)
        Catch ex As Exception
        End Try
    End Sub
< additional functions continue on>

Open in new window

SoftwareVisual Basic.NETFile Sharing Software

Avatar of undefined
Last Comment

8/22/2022 - Mon