Stop sharing a directory

Hi,

I am using a ManagementClass to execute the Create method in the Win32_Share class, this works fine for sharing a directory. However I don't quite understand the Delete method. You'll notice from the documentation that it takes no arguments, does anyone know how it works Or does anyone know another way of removing a share from a directory

Thanks



Answer this question

Stop sharing a directory

  • Johnny Kauffman

    Hi David

    on the other hand, how can I create a Share on my computer

    Thanks

    MarkX


  • Jared Y

    Hello,

    I'm posting the answer to this question since I was having the same problem and found the answer somewhere on the web. All you have to do is something like this:

    ManagementObject share = new ManagementObject("Win32_Share.Name=\"something\"");
    share.Delete();

    where \"something\" is your shared folder

    Thanks,
    David Gorena Elizondo
    [MSFT] VSTS


  • Stop sharing a directory