Question:
How can I add a Share in Visual Basic to a Local or Remote Machine with permission only for a special User group?
Answer:
That is a rather difficult question. You can use the code I’ve already posted to add a share, but you will need to use Level = 502 (SHARE_INFO_502) instead of Level = 2. That’s the easy part. The hard part is that you must construct a Security Descriptor (SD) as part of the information you pass, and that is hard. For more information on how to deal with SDs from Visual Basic, see the Microsoft Knowledge Base article, “HowTo: Add an Access-Allowed ACE to a File Through Visual Basic” (Q194757).