Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Script to set share permissions on home directories

Reply
Thread Tools Display Modes

Re: Script to set share permissions on home directories

 
 
Al Dunbar
Guest
Posts: n/a

 
      02-23-2009

"Greenmynci" <> wrote in message
news:...
>
> I have a directory with ~1600 home folders in it that have incorrect
> share permissions - currently set to :
>
> Administrators - full control
> Everyone - Read
>
> whereas i need them all to be
>
> Administrators - full control
> Everyone - Change / Read
>
> NTFS permissions are fine, its just the share permissions that need
> changing. Does anyone know of a script or method to set these
> permission en masse ?


I might have something at work and will look it up tomorrow. In the
meantime, are the share names identical to the foldernames? If so, whatever
command (probably NET SHARE) will be used will be able to deduce the
sharename from the folder name as in:

for /d %%F in (\\server\users$\*) do (
NET SHARE %n$ etc...

Alternately, if all of your client O/S's are NT-based, you could modify the
home folder attribute from something like:

\\server\username$

to:

\\server\users$\username

Once that is done, you could delete the shares.


/Al


 
Reply With Quote
 
 
 
 
Al Dunbar
Guest
Posts: n/a

 
      02-25-2009

"Greenmynci" <> wrote in message
news:...
>
> The folders are named after user id's ie
>
> 10445634
> 16482826
> 18457358
> etc.
>
> the respective shares are
>
> 10445634$
> 16482826$
> 18457358$
>
> I can't change the parent folder structure (D:\users\<homefolder>) ,as
> the home folders are created using a import script which relies on a
> fixed path and is out of my control.
>
> Thanks for your help with this.


Sorry, but I could not find what I said I might have at work regarding
setting permissions on shares. I might have been thinking of folders when I
said that.

That said, if your import script creates the folders, and presumably shares
them and applies the permissions, does it also set the user's account to
reference that share?

Regardless, if you can modify the home folder attribute of the user accounts
from \\server\usernameshare$ to give a UNC path to the folder, then the
permissions on the share will have no effect.

For example, my home folder is contained in folder "E:\Users\", which is
shared as \\servername\users$. My home folder was originally shared out
separatley as something like \\servername\Al$, which is the value that was
originally used for my home folder attribute.

Without changing anything on the fileserver, I was able to change the home
folder attribute from \\servername\Al$ to \\servername\Users$\Al. Of course,
we did this, not just for me, but for all users. We then deleted all the
individual shares as they were no longer required.

The benefits:

- fewer shares need to be defined on the server;
- we do not need to remember to modify the share as required when a home
folder is delete, renamed, or relocated;
- we never have orphaned shares to delete.

the only problem I am aware of:

- not well supported on w98 clients.


/Al


 
Reply With Quote
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      03-08-2009
Al Dunbar <> wrote:
> "Greenmynci" <> wrote in message
> news:...
>>
>> The folders are named after user id's ie
>>
>> 10445634
>> 16482826
>> 18457358
>> etc.
>>
>> the respective shares are
>>
>> 10445634$
>> 16482826$
>> 18457358$
>>
>> I can't change the parent folder structure (D:\users\<homefolder>)
>> ,as the home folders are created using a import script which relies
>> on a fixed path and is out of my control.
>>
>> Thanks for your help with this.

>
> Sorry, but I could not find what I said I might have at work regarding
> setting permissions on shares. I might have been thinking of folders
> when I said that.
>
> That said, if your import script creates the folders, and presumably
> shares them and applies the permissions, does it also set the user's
> account to reference that share?
>
> Regardless, if you can modify the home folder attribute of the user
> accounts from \\server\usernameshare$ to give a UNC path to the
> folder, then the permissions on the share will have no effect.
>
> For example, my home folder is contained in folder "E:\Users\", which
> is shared as \\servername\users$. My home folder was originally
> shared out separatley as something like \\servername\Al$, which is
> the value that was originally used for my home folder attribute.
>
> Without changing anything on the fileserver, I was able to change the
> home folder attribute from \\servername\Al$ to
> \\servername\Users$\Al. Of course, we did this, not just for me, but
> for all users. We then deleted all the individual shares as they were
> no longer required.
> The benefits:
>
> - fewer shares need to be defined on the server;
> - we do not need to remember to modify the share as required when a
> home folder is delete, renamed, or relocated;
> - we never have orphaned shares to delete.
>
> the only problem I am aware of:
>
> - not well supported on w98 clients.
>
>
> /Al


Hear, hear. I don't even use home directories anymore (folder redirection
via group policy works a lot more easily). But even so, no individual user
shares. They are an absolute nightmare to manage.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Home Folder server NTFS permissions and share permissions?! UselessUser Windows Server 1 03-10-2008 01:19 PM
RE: home directories mapping to root of share, not user directory Dragos CAMARA Active Directory 0 07-19-2007 12:30 PM
Need script to create Home directories. Byron Kendrick Scripting 1 09-03-2004 03:42 PM
Need help with a script to create home directories Chris Coates Scripting 0 02-03-2004 01:19 PM
Setting home directories via script davis Scripting 1 09-04-2003 12:36 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59