Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Creating Home Drives Based on group Membership

$
0
0

Ok what I am trying to do is create a script that will allow our Help Desk to create Home Directories on the many file servers we have around our organization.  The problem is these file servers are a mix of mostly 2008R2 some 2012, some 2012R2 and even a couple of 2003R2 servers.

We have our users in AD groups and based on the AD Group membership that determines where their home drives are setup and they are mapped to.

So for example

UserA is a member of svr-1 in AD and has a share on \\server1\UserA$

UserB is a member of svr-2 in AD and has a share on \\server2\UserB$  

UserC is a member of svr-3 in AD and has a share on \\server3\UserC$ 

Depending on where the users are working is usually the determining factor on where they are setup.  

What I am trying to figure out is a way to script this out so that it will check AD for the membership and then compare that membership to the list of possible memberships available.

What I was thinking was something similar to this but if you have a user with a large group of memberships your going to have a lot of data plus the script would then have to parse the data in order to find the svr-1 for example as the output looks like CN=Svr-1,CN=Users,DC=domain,DC=local

$username=Read-Host 'What is the Login ID?'

([adsisearcher]"name=$username").FindAll().properties.memberof

Is there a simple way of doing this or canned script already out there that will make this job a lot easier??


Viewing all articles
Browse latest Browse all 8411

Trending Articles