PowerShell - Get-ADUser from text to discovery home directory remote
- Jon Boyette
- Jan 10, 2022
- 1 min read
Save as a .ps1 or copy and paste, this script gets the ADUsers home directory current location from c:\temp\servers.txt, outputs to C:\temp\UserHomeDirectory.csv
Get-Content "C:\temp\servers.txt" |
ForEach-Object {Get-ADUser $_ -properties sAMAccountName,HomeDirectory,HomeDrive |
Select sAMAccountName,HomeDirectory,HomeDrive } |
Export-CSV "C:\temp\UserHomeDirectory.csv" -NoTypeInformation -Encoding UTF8
Comments