Hi -
This post is in response to Peter Huang's request for feedback on his
response to my question.
First, Peter, thank you for your response. But my issue remains unresolved.
The difficulty I'm having with your response may be that you perhaps
provided too much(!) information. I can't use some of it, but I'm having to
wade through all of it to find the useful bits. (My comments on the
specific links that you provided are below.)
I had thought that my initial question was straightforward: I need to
create a shared folder and set its permissions using VB.NET. It seems that,
to do so, I must learn a whole new technology (wmi). While I'm willing to
do that, it's taking some time. Wmi documentation is not all that
intuitive, and I've found a few tantalizingly-but-not-exactly relevant
examples that I haven't yet been able to get to work from VB.NET. I was
hoping for a more straightforward answer or example when I posted my
question.
My further research has alerted me to some additional issues that may be
relevant. So, in the interest of clarifying/focusing my question:
- I'm creating a commercial VB.NET application
- I need to synchronize two databases, one SQL2K database on a desktop or
network, and one SQLCE database on a pocket pc handheld
- To accomplish that synchronization, I need to use SQL's merge replication
- To implement that merge replication, I need to create a shared folder and
set its permissions
- I will not have access to users' computers, so all of this must be done by
my app
- I'm trying to hide as much complexity as possible from the user
- Users may be using a variety (I have no control over this) of Windows
versions
- Users can be single users trying to synchronize their desktop with their
PDA (I'll need to distribute and install MSDE for these users)
- Users also can be corporate users, synchronizing many PDAs with a
corporate SQL database.
Your response provided links to two web pages:
1.
http://groups.google.com/groups?hl=zh-CN&lr=&ie=UTF-8&[email protected]
2.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbcode/html _
/vbtskCodeFindingAmountOfDiskSpaceAvailableVisualBasic.asp
The second link is an MSDN Library page discussing how to use wmi to find
available disk space. While that code seems to work, it doesn't address my
search for a way to create a share and set permissions. Since there are
other MSDN Library articles that more closely approach those issues, I'm not
sure why you suggested I look at the finding disk space article instead of
more relevant articles.
The first link was to a forum post about setting file share permissions
using a script. That page didn't answer the question, but it provided links
to 14 other sites/pages:
a)
http://www.microsoft.com/technet/scriptcenter/filefolder/scrff33.asp
b)
http://msdn.microsoft.com/library/en-us/netdir/adsi/iadssecurityutility_getsecuritydescriptor.asp
c)
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&[email protected]
d)
http://msdn.microsoft.com/library/en-us/netdir/adsi/iadssecurityutility_setsecuritydescriptor.asp
e)
http://groups.google.com/[email protected]
f)
http://groups.google.com/[email protected]
g)
http://www.jsiinc.com/asp/reghacks.asp?tipnumb=6353
h)
http://www.microsoft.com/windows2000/downloads/servicepacks/sp4/supporttools.asp
i)
http://www.somarsoft.com/
j)
http://www.microsoft.com/technet/scriptcenter/filefolder/scrff13.asp
k)
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14459
l)
http://www.windows2000faq.com/Articles/Index.cfm?ArticleID=14842
m)
http://setacl.sourceforge.net/
n)
http://www.microsoft.com/technet/scriptcenter
While I may have misread or misunderstood some of these, my
experience/reaction to each of these links follows:
Link (a) was to a technet script center, which I'm working my way through.
Link (b) 404 Location Cannot Be Found
Link (c) was to a forum thread re Enumerating Share Permissions. While that
may be useful for other purposes, it doesn't tell me how to set those
permissions in the first place (or how to create the share).
Link (d) 404 Location Cannot Be Found
Link (e) was to a forum thread from 2001 re using wmi to add a user to a
share folder. While this might be useful to me (and answers a question that
perhaps I should have asked), it doesn't address how to implement the
approach in VB.NET.
Link (f) was to a forum post re Setting security on all shares. While
perhaps relevant, again it's not VB.NET.
Link (g) was to a page linking to a download of Microsoft's public domain
RMTShar.exe for remotely sharing a number of resources. I'm not sure I need
the remote part of this, and I need to set up the share and permissions from
within my VB.NET program.
Link (h) was to a page for Win2K Support Tools. I haven't tried these yet,
but my impression was that they don't address my need to do this from within
my VB.NET program.
Link (i) was to a product page for a free utility to dump security settings.
I don't currently need to do that. There also was a link on that page to a
product page for a (non-free) utility that may do what I need, but not from
within my VB.NET program.
Link (j) linked me to the same technet script center I found from link (a)
Link (k) was to a forum post suggesting how to use RMTShar.exe (see link
(g)) to do what I need, but from a command line. Is it really necessary (or
simpler) to shell out to a command line program to get this done??
Link (l) was to a forum post suggesting a way to create a share from the
command line, again not from a VB.NET program.
Link (m) was to a product page for SETACL, a tool to manage permissions.
While I can probably figure out how to use this from a VB.NET program, I
scanned their documentation and was unable to find a way to create a share.
(I might have missed something.)
Link (n) again linked me to the same technet script center I found from link
(a) and link (j)
- Jeff