Solved

Use the Delete method of the win32_share

Posted on 2011-02-16
5
1,132 Views
Last Modified: 2012-05-11
Can anyone tell me how to use delete method of win32_share to stop a shared folder .Im using visual studion& using ManagementClass .It doesnt accept any parameters and i dont know how to use it .

Im using the code below to share the folder :

Dim mc As ManagementClass = New ManagementClass("win32_share")
        Dim inParams As ManagementBaseObject = mc.GetMethodParameters("Create")
        inParams("Description") = "Test"
        inParams("Name") = "Test"
        inParams("Path") = "C:\Test"
        inParams("Type") = &H0
        inParams("MaximumAllowed") = Nothing ' Set unlimited number of users connected, or specify a positive integer.
        inParams("Password") = Nothing
        inParams("Access") = Nothing ' Make Everyone has full control access.
        Dim outParams As ManagementBaseObject = mc.InvokeMethod("Create", inParams, Nothing)
0
Comment
Question by:AJDeveloper
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34908151
May be

mc.InvokeMethod("Create", Nothing)
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34908158
Oops

mc.InvokeMethod("Delete", Nothing)
0
 

Author Comment

by:AJDeveloper
ID: 34909768
Nope ,im getting error .The Delete Win32_Share doesnt accept any parameters ,Can you post the code where it can delete the share folder which was created by the mentioned code ?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
ID: 34914532
>The Delete Win32_Share doesnt accept any parameters
That is why we are passing it "Nothing". Did you get any errors when running above?


Try code from here

http://www.codeproject.com/KB/vb/RemoteShare.aspx?display=Print
0
 

Author Closing Comment

by:AJDeveloper
ID: 34914767
It is not using the managementclass but is working perfectly.
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# bracket error 3 32
Regular expression help 2 25
VB.net and sql server 4 36
Formula for calculating ROI on training 6 30
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question