Sunday 9 May 2021

Active Directory: - How to get user Home Directory Path and home drive letter using PowerShell

 Active Directory: - How to get user Home Directory Path and home drive letter using PowerShell


Run as Administrator PowerShell window run the following-


Get-ADUser -Filter 'enabled -eq $true' -Properties ProfilePath, HomeDirectory, HomeDrive | Select Name, SamAccountName, ProfilePath, HomeDirectory, HomeDrive





To export the list such as CSV simply run the following-

 Get-ADUser -Filter 'enabled -eq $true' -Properties ProfilePath, HomeDirectory, HomeDrive | Select Name, SamAccountName, ProfilePath, HomeDirectory, HomeDrive | Export-Csv -path "c-\temp\users.csv" 

No comments:

Post a Comment