I'd try something like this:
Get-aduser -filter * | select -exp samaccountname | % { mkdir d:\users\$_
-whatif }
If the results are what you’re expecting, then remove the -whatif parameter and
run it again. Hope it helps.
Rubens
Sent from my Windows 10 phone
From: Gavin Wilby
Sent: Monday, February 22, 2016 6:51 AM
To: '[email protected]'
Subject: [NTSysADM] Powershell help
Hi,
I have a new server that I want to populate a drive with folders for each user.
I can do a Get-ADUser -Filter * | fl UserPrincipalName which gives me the
names, but I’m unsure of how to pipe the next part to create the folders.
So ideally, I’d like the folder called the username, so for me rather that it
being [email protected], it’s just gavinw.
Permissions Ill worry about later. The drive/ partition for the directories
already exists.
Gavin Wilby
IT Support Engineer
SMP Partners Ltd
Clinch’s House, Lord Street,
Douglas, Isle of Man IM99 1RZ
Tel +44 1624 682214
Mob +44 7624 480575
[email protected] www.smppartners.com
A member of the SMP Partners Group of Companies
SMP Partners Limited, SMP Trustees Limited and SMP Fund Services Limited are
licensed by the Isle of Man Financial Services Authority. SMP Accounting & Tax
Limited is a member of the ICAEW Practice Assurance Scheme.
SMP Partners Limited registered in the Isle of Man, Company Registration No:
000908V
Directors: M.W. Denton, M.J. Derbyshire, S.E McGowan, O. Peck, J.J. Scott, S.J.
Turner
SMP Trustees Limited registered in the Isle of Man, Company Registration No:
068396C
Directors: A.C. Baggesen, J.M. Cubbon, M.W. Denton, K.M. Goldie, O Peck, J.
Watterson
SMP Fund Services Limited registered in the Isle of Man, Company Registration
No: 120288C
Directors: V. Campbell, R.K. Corkill, M.W. Denton, D.A. Manser, S.E McGowan,
J.J. Scott
SMP Accounting & Tax Limited registered in the Isle of Man, Company
Registration No: 001316V
Directors: I.F. Begley, A.J. Dowling, P. Duchars, J.J. Scott, S.J. Turner
SMP Capital Markets Limited registered in the Isle of Man, Company Registration
No: 002438V
Directors: M.W. Denton, M.J. Derbyshire, D.F Hudson, S.E McGowan, O. Peck, S.
J. Turner
SMP Partners Limited, SMP Trustees Limited, SMP Fund Services Limited, SMP
Accounting & Tax Limited and SMP Capital Markets Limited are members of the SMP
Partners Group of Companies.
This email is confidential and is subject to disclaimers. Details can be found
at: http://www.smppartners.com/disclaimer.html
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________