Solved

PowerShell Script Help to Setup Domain Users Home Drives

Posted on 2014-10-27
2
208 Views
Last Modified: 2014-10-27
I have a simple PowerShell Script that does work but it only works for individual user names, was hoping to get assistance on setting it up for all Domain Users.

Set-ADUser -identity "UserName" -homeDrive h: -homeDir "\\ServerName\User$"

We currently have all Home Drive's being mapped via Logon Scripts but we are migrating over to DFS instead. In turn I need to add the new share locations once it is ready for all users in the domain.

There will be multiple share locations but I was thinking the easiest way would be to use share name itself once completed.

Thanks again for your help.
0
Comment
Question by:robertarenson
2 Comments
 
LVL 28

Accepted Solution

by:
becraig earned 500 total points
ID: 40407101
You could just do a get-aduser and pipe it into your set-aduser

get-aduser -filter * | %  {$userdir = $_.samaccountname + "$"; Set-ADUser -identity $_.samaccountname -homeDrive h: -homeDir "\\ServerName\$userdir"}

Open in new window

0
 

Author Closing Comment

by:robertarenson
ID: 40407447
Thank you very much
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

14 Experts available now in Live!

Get 1:1 Help Now