Shadowboxer, here's my working code to share a directory
Private Function ShareDir(ByVal Server As String, ByVal path As
String, ByVal sharename As String, ByVal description As String) As
String
Dim wmiScope As ManagementScope
Dim wmiShare As ManagementClass
Dim inParams As ManagementBaseObject
Dim outParams As ManagementBaseObject
wmiScope = New Management.ManagementScope("\\" & Server &
"\root\cimv2")
wmiScope.Connect()
wmiShare = New ManagementClass(wmiScope, New
ManagementPath("Win32_Share"), Nothing)
inParams = wmiShare.GetMethodParameters("Create")
inParams("Path") = path
inParams("Name") = sharename
inParams("Type") = 0
inParams("MaximumAllowed") = Nothing
inParams("Description") = description
outParams = wmiShare.InvokeMethod("Create", inParams, Nothing)
'Catch e As Exception
Return "Complete"
End Function
And my attempt at deleting a share...
Private Function DelShare(ByVal Server As String, ByVal path As
String, ByVal sharename As String, ByVal description As String) As
String
Dim wmiScope As ManagementScope
Dim wmiShare As ManagementClass
Dim inParams As ManagementBaseObject
Dim outParams As ManagementBaseObject
wmiScope = New Management.ManagementScope("\\" & Server &
"\root\cimv2")
wmiShare = New ManagementClass(wmiScope, New
ManagementPath("Win32_Share"), Nothing)
wmiShare.Delete()
End Function
Thanks in advance...