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
Solved

PowerShell Script Help to Setup Domain Users Home Drives

Posted on 2014-10-27
2
219 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 29

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Set OWA language and time zone in Exchange for individuals, all users or per database.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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