When you try to give share permission to folder on remote machine (i.e from your pc to //prakash-new/c$/test2) you can not do manually. Windows does not give you a Tab of Sharing in Folder properties.
You could achive that by below code.
// ManagementClass managementClass = new ManagementClass("Win32_Share"); // For local PC
// replace "ssc" to your remote server
ManagementClass managementClass = new ManagementClass("sscrootcimv2", "Win32_Share", null);
// Create ManagementBaseObjects for in and out parameters
ManagementBaseObject inParams = managementClass.GetMethodParameters("Create");
// Set the input parameters
inParams["Description"] = "Bhargav";
inParams["Name"] = "Bhargav share";
inParams["Path"] = @"c:Test2";//@"D:Test2Test3";
// in above path params "c:Test2" will take From SSC
inParams["Type"] = 0x0; // Disk Drive
// DISK_DRIVE = 0x0
// PRINT_QUEUE = 0x1
// DEVICE = 0x2
// IPC = 0x3
// DISK_DRIVE_ADMIN = 0x80000000
// PRINT_QUEUE_ADMIN = 0x80000001
// DEVICE_ADMIN = 0x80000002
// IPC_ADMIN = 0x8000003
//inParams["MaximumAllowed"] = int maxConnectionsNum;
// Invoke the method on the ManagementClass object
outParams = managementClass.InvokeMethod("Create", inParams, null);
// Check to see if the method invocation was successful
if ((uint)(outParams.Properties["ReturnValue"].Value) != 0)
throw new Exception("Unable to share directory.");
Hope this will be of some help to you in your project.
Prakash Software Solutions PVT LTD. Offer wide range of services to their clients all over the globe. We successfully delivered projects i.e. software development, cloud computing solutions, SharePoint development solutions, mobile app development and Microsoft technology solution to our Sweden, Denmark, Netherlands, France, Norway, Germany, Spain, Italy, Switzerland, Belgium, Luxembourg, Ireland, United Kingdom, United States, Canada, Brazil, Peru, UAE, Dubai, Saudi Arabia, Kuwait, Qatar, Bahrain, Singapore, New Zealand and Australia Clients.