Home » PowerShell » Set Ad User Home Directory in PowerShell

Set Ad User Home Directory in PowerShell

Active Directory user has Home Directory, Local Path, Profile path properties in his profile. The Set-AdUser cmdlet in PowerShell is used to set ad user home directory and other properties.

Using the Active Directory Users and Computers console snap-in, you can set aduser home directory. You can use the Set-AdUser cmdlet in PowerShell to set ad user home folder local path.

In this article, we will discuss how to set aduser home directory using the ADUC and Set-Aduser cmdlet in PowerShell.

Using ADUC to Set Ad User Home Directory

We can use Active Directory Users and Computers (ADUC) console snap-in GUI interface to set home directory folder path to ad user.

To set ad user home directory path, follow below steps

  • Open the ADUC console snap-in ( use the command dsa.msc in Run)
  • Select Organizational Unit and active directory user to set a home directory
  • Right-click on user and click properties.
  • Select the Profile tab.
  • Enter the Home Directory path under Local Path and click Apply and ok.
ADUC - Set Ad User Home Directory
ADUC – Set Ad User Home Directory

PowerShell Tip: How to Get AD Computer Description using PowerShell!

Set AdUser Home Directory in PowerShell

Using the Set-AdUser cmdlet in PowerShell to set the home directory folder path.

Set-ADUser -Identity Arons -HomeDirectory 'D:\Arons'

Get-Aduser -Identity Arons -Properties * | Select SamAccountName,HomeDirectory,HomeDrive,ProfilePath

In the above PowerShell script, Set-AdUser uses the Identity parameter to set aduser home directory as D:\Arons for the user.

In the following command, Get-AdUser cmdlet in PowerShell uses Identity parameter to get aduser home directory folder path and other additional properties using Properties * parameter.

The output of the above PowerShell script to set aduser home directory and local folder path is:

Set AdUser Home Directory in PowerShell
Set AdUser Home Directory in PowerShell

Conclusion

I hope the above article about how to set aduser home directory and local folder path using ADUC and Set-ADUser cmdlet in PowerShell is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.