Solved

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

Posted on 2014-02-03
5
261 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
  • 3
5 Comments
 
LVL 22

Expert Comment

by:Joseph Moody
ID: 39830549
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 250 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Synchronize a new Active Directory domain with an existing Office 365 tenant
OfficeMate Freezes on login or does not load after login credentials are input.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
In this Micro Tutorial viewers will learn how to use Windows Server Backup to create full image of their system. Tutorial shows how to install Windows Server Backup Feature on Windows 2012R2 and how to configure scheduled Bare Metal Recovery backup.…

815 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now