Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Easiest way to Create a bulk amount of home directorys in ad

Posted on 2014-02-03
5
Medium Priority
?
275 Views
Last Modified: 2014-02-03
Trying to setup home directories for entire workforce. I know how to do it manually but got to be a easier way of doing it.

I could create an script but not sure if that is the best way of doing it.
0
Comment
Question by:jyoung127
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 39830549
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 1000 total points
ID: 39830881
The suggestion that Jmoody suggested would be acceptable for any new Users that would be created. It is recommended for easy creation to create User Templates for specific needs. However, for what you need it is probably easiest to script this to get all of the users needed.

TXT - You will need to get a list of users "sAMAccountName" and add them to a txt file. Example below...
jsmith
wills
miked
etc....

If you want to get all of the users in your domain into a txt file you can use the below syntax...
get-aduser -filter * -properties * | select sAMAccountName | out-file "c:\users.txt"

Open in new window


Once you have your users in the txt file do the following...

import-module activedirectory
$userlist = get-content "c:\users.txt"
foreach ($item in $userlist) {$item; get-aduser -identity $item | set-aduser -HomeDrive "X:" -HomeDirectory "\\servername\Share\%username%\"

Open in new window


I have tested this in my lab and it worked correctly. I would test adding 1 user to the txt file and then running the script to ensure that it is doing what you need it to.

That should all you need to do.

Will.
0
 

Author Comment

by:jyoung127
ID: 39830909
Is there a step by step guide on doing this?
0
 

Author Comment

by:jyoung127
ID: 39830966
Will thanks for that information that is what I was looking for.

I tried the following but every time I run it in power shell it does not take hold:

import-module activedirectory
$userlist = get-content "c:\users.txt"
foreach ($item in $userlist) {$item; get-aduser -identity $item | set-aduser -HomeDrive "U:" -HomeDirectory "\\sos-fs1\homedir$\%username%\"

Anything I am missing?
0
 

Author Comment

by:jyoung127
ID: 39831102
Ok so I figured an even easier way of doing it. I highlighted all users in AD and went to Properties and then checked the home directory and used \\sos-fs1\homedir$\%username%
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Here's a look at newsworthy articles and community happenings during the last month.
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question