We can easily retrieve AD user’s home directory path by using the Active Director powershell cmdlet Get-ADUser. In this post, I am going to write powershell script get home directory path for an ad user, users from specific OU and set of users from text file.
Before proceed run the following command to import Active Directory module.
The following command return the home directory path for the user Morgan.
We can find and get a list of all users from a certain OU by setting target OU scope by using the parameter SearchBase. The following powershell command select home directory for all users from the Organization Unit ‘TestOU‘.