#19803 - 2002-04-11 06:32 PM
Share a folder
|
AnalogKid2112
Fresh Scripter
Registered: 2002-04-09
Posts: 11
Loc: Hamilton Ontario, Canada
|
I have # users and I'm lazy. I wrote a piece of code in my .scr file that checks to see if the current user has a folder (which will eventually be his/her HomeDir) on the server and if the folder doesn't yet exist the script will create the folder - that works! But in order to properly set that folder as the users HomeDir the folder must be shared and I don't want to have to manually share everything. Is there a way of programatically sharing a folder? KIX, DOS, whatever.
_________________________
Is that going to be on the test?
|
|
Top
|
|
|
|
#19804 - 2002-04-11 06:47 PM
Re: Share a folder
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
LAZY... Les, someone's trying to take your old monikor
Okay, take a look here on doing some BATCH file stuff for this.
Moving Users and Permissons
Don't forget to look at the other links by Kent at the bottom for more information on another thread.
UPDATE - Well, never mind. sealeopard went ahead and wrote the script for you... As long as your users have rights there. Scary if they do. [ 11 April 2002, 19:17: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
#19806 - 2002-04-11 06:55 PM
Re: Share a folder
|
Anonymous
Anonymous
Unregistered
|
Hmmm ... don't you have a problem with user rights here? I mean - the users wouldn't have permissions to share the folder anyway?
Why not make a script that you run as Administrator ... testing if the user have a homedir or not.
Try this on the command prompt ...
net help share
|
|
Top
|
|
|
|
#19810 - 2002-04-11 08:33 PM
Re: Share a folder
|
Anonymous
Anonymous
Unregistered
|
Might want to check out a product called AutoShare.
It is GUI configurable and runs as a service on the NT server where your user home directories are. It automatically applies the correct NTFS permissions and then shares each user home directory (when it detects new ones).
Set it and forget it.
You can download a copy from http://www.scriptlogic.com/autoshare
-Brian
|
|
Top
|
|
|
|
#19811 - 2002-04-11 11:43 PM
Re: Share a folder
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
AnalogKid2112, Brian, and others...
You should also be able to do that with this little tid bit as well. Using this freebie and some of your own code, you should be able to mangage the same functionality. Being that I don't have that much of a need for something like that, I won't spend the time to even try coding it up, but hey... if you need it and your Finanace dept. won't spring for it, you can now write your own.
ASCI's File System Event Provider for WMI [ 11 April 2002, 23:44: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
#19814 - 2002-04-12 01:11 PM
Re: Share a folder
|
AnalogKid2112
Fresh Scripter
Registered: 2002-04-09
Posts: 11
Loc: Hamilton Ontario, Canada
|
The code it copied exactly as is on his post. I checked it 9 or 10 times over and tried moving the quotes around to.
The error I'm letting is BAD COMMAND OR FILE NAME. It's only a guess but I think it's refering to %COMSPEC%, but that's only my guess.
_________________________
Is that going to be on the test?
|
|
Top
|
|
|
|
#19817 - 2002-04-12 05:21 PM
Re: Share a folder
|
Anonymous
Anonymous
Unregistered
|
Here's a batch file to create a list of users folders and share them
net use n: /d /yes net use n: \\servername\f$ n: cd users for /f %%x in (n:\users.txt) do md %%x >>n:\dir.log for /f %%x in (n:\users.txt) do cacls %%x /e /g domain\%%x:c >>n:\perms.log for /f %%x in (n:\users.txt) do rmtshare \\servername\%%x$=f:\users\%%x /grant domain\%%x:change /grant system:"full control" /grant administrators:"full control" >>n:\share.log c: net use n: /d
syntax for user.txt
user1 user2 user3 etc
the batch file will just loop until in reaches the end of the text file
P.S if you have the folder above assigned with the correct permissions i.e administrator full control, the batch file adds the user's permission
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 756 anonymous users online.
|
|
|