Solved

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

Posted on 2014-02-03
5
262 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

828 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