you would require some WMI to do this.
it can be done this way. You need to add a reference to System.Management and import the System.Management and System.Management.Instrumentation namespaces
| |
Try
Dim managementClass As New ManagementClass("Win32_Share") Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
inParams("Description") = "My Description"
inParams("Name") = "Share Name"
inParams("Path") = "C:\My 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.") else MessageBox.Show("Shared folder successfully!") End If
Catch ex As Exception MessageBox.Show(ex.Message) End Try
|
|