Solved

Use the Delete method of the win32_share

Posted on 2011-02-16
5
1,148 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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

837 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