Solved

Powershell Get-ADuser homedirectory

Posted on 2014-03-18
3
4,504 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
[X]
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
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 40

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

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
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 to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

734 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