Solved

Powershell Get-ADuser homedirectory

Posted on 2014-03-18
3
3,953 Views
Last Modified: 2014-03-18
I am new to powershell.  
I need a powershell script that exports the homedirectory of various AD users in different OUS.  I already have a list of users.  Is it possibly to call a txt  file that has the users' AD samaccountname and then outputs the findings to a csv file that displays their Fullname and homedirectory.
0
Comment
Question by:ITLady45
3 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 39938231
Try this

get-content c:\users.txt | get-aduser -properties * | select-object name, sn, givenname , homedirectory

Thanks

Mike
0
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 39938233
If you have at least one 2008 R2 DC, then you can use MS' AD cmdlets without anything further.  Since "Fullname" is not an AD attribute, you have to choose which you want to use (possibly "Name", "DisplayName", etc.).
Import-Module ActiveDirectory
Get-Content users.txt | ForEach {Get-ADUser $_ -properties DisplayName,HomeDirectory | Select DisplayName,HomeDirectory | Export-CSV userinfo.csv -notype

Open in new window

0
 

Author Closing Comment

by:ITLady45
ID: 39938643
The suggestion was missing closing bracket.  This was an easy fix for new PS user to figure out.  Thanks for the quick response!
0

Join & Write a Comment

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

747 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