I
I
Ivan Mironov2012-09-27 03:23:19
PowerShell
Ivan Mironov, 2012-09-27 03:23:19

Script to create home folders for domain users?

Hello everyone!
There is CD on win 2008 r2. I just started getting acquainted with PowerShell. I started more than a thousand users from csv, but it doesn’t work with creating folders ...
Maybe someone has some experience? You need something like the following:
The name of the folder is taken from csv, the folder is connected as home to the profile of the same name (or also from csv), it is assigned a drive letter “Y:” (for example), read and write rights are given for the Admin, This user and a specific group . Something like this ... And plus a hard quota of 200mb, for example ...
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Smirnov, 2012-09-28
@jbols

way 1. select the necessary users in AD, on the profile\home folder tab, write \\server\folder\%username% - N folders with the name of each user will be automatically created, rights will be inherited from folder and fullcontrol will be automatically added for %username% for the final folders.
path 2. powershell
Add-PSSnapin Quest.ActiveRoles.ADManagement
Connect-QADService
$users=get-content "c:\users.txt"
foreach ($user in $users) {
$homedir = "\\server\users\" + $user
new-item -path $homedir -type directory
icacls $homedir /grant "$($user):(OI)(CI)f"
set-qaduser $user -homedrive "Y:" -homedirectory $homedir
}
Like and without comments it should be clear.

A
Anton Smirnov, 2012-09-27
@xSomeonEx

Do you just need to complete the task or do it in powershell?
“The folder is connected as home to the profile of the same name” - how is it?
you can use gpo Folder Redirection and send user folders (the same desktop) somewhere in \\srv\profiles (the issue with rights is immediately resolved), connect this folder with a startup script, and specify quota settings for subfolders in FSRM.
few moves and no powershell.

A
Anton Smirnov, 2012-10-01
@xSomeonEx

you need to install FSRM - quotas are configured there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question