Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with code

=?Utf-8?B?TGlhbSBNYWM=?=
Guest
 
Posts: n/a
#1: Aug 24 '07
Folks,

I had this piece of code working last week for creating shared folders, and
when someone in another newsgroup directed me on how to create remote shares
and I found that my below code no-longer works. The new instance of the
below management class returns error: "unable to obtain value". anyone idea
what I'm doing wrong. I though it maybe machine related so I change machine
but same problem with management class.

Cheers,
Liam

Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Management

Dim mc As ManagementClass = New ManagementClass("Win32_Share")
Dim mo As ManagementObject
Dim inParams As ManagementBaseObject
Dim outParams As ManagementBaseObject
inParams = mc.GetMethodParameters("Create")

inParams("Name") = "access"
inParams("Description") = "access"
inParams("Path") = "c:\\access"
inParams("Type") = 0

outParams = mc.InvokeMethod("Create", inParams, Nothing)


Closed Thread