Problem with code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TGlhbSBNYWM=?=

    #1

    Problem with code

    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.Collecti ons
    Imports System.Componen tModel
    Imports System.Windows. Forms
    Imports System.Data
    Imports System.Manageme nt

    Dim mc As ManagementClass = New ManagementClass ("Win32_Shar e")
    Dim mo As ManagementObjec t
    Dim inParams As ManagementBaseO bject
    Dim outParams As ManagementBaseO bject
    inParams = mc.GetMethodPar ameters("Create ")

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

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

Working...