Configure User Roaming Profile Path with PowerShell

Sign up to access this lesson

Click here to sign up and get access to this lesson!

Saving Progress...

In this lecture, I am going to be showing you how you can use Windows PowerShell to configure or to set the Active Directory profile Path.

Open Windows PowerShell ISE and Active Directory Users and Computers.

Here we can see under Domain Users we have two user accounts. We have our Paul Hill user account which is using a Roaming Profile and is part of the Roaming Profiles Users group. We will be testing with this account.


  1. A couple of ways of doing this, we need to first import the AD module: Import-Module ActiveDirectory
Graphical user interfaceDescription automatically generated
  1. Type the command: Set-ADUser -Identity ‘paul.hill’ -ProfilePath “\\ipdc01\profiles$\paul.hill”
  1. We can open our user account and see under Profile in AD it has now worked.
Graphical user interface, text, application, emailDescription automatically generated
  1. What if we have 5000 user accounts that we just have added to the Roaming Profiles Users group? 

Doing this via a Script:

  1. Let's script this out(Importing the AD module)

NOTE: Do as many comments as possible using the # So that we remember what our script does.

We can do this on group membership, as they are part of the Roaming Profile Users Security Group.

So we will get the list of users, and then push our configuration from there.

Add Robert Hill user account manually to the Roaming Profile Users group and let's run it :

Graphical user interface, text, applicationDescription automatically generated
  1. As we can see both users are now added, perfect! Let’s go ahead and complete an action on our users now.
  2. Let's pipe our results from the group member command, we will loop through each user, and for each object, we will Set-ADUser Profile Path property.

NOTE: PowerShell does not take % , therefore we can use the SAMAccountName as a variable

$_. (References the Current Object)

  1. Lastly, we need to specify the identity, and that will be our $_.SamAccountName
Graphical user interface, text, application, WordDescription automatically generated
  1. As we can see, no errors. Let's check our Users :
Graphical user interface, text, application, emailDescription automatically generated

How about Robert’s properties:

Graphical user interface, text, application, emailDescription automatically generated
  1. Now we save our script as SetProfilePath.ps1.

With the script, we can set it to run as a scheduled task or we can just right click and run it whenever we want.

Sign up to access the rest of this lesson

You must either log in or sign up to access this lesson.

Saving Progress...

0 0 votes
Lesson Rating
Notify of
Inline Feedbacks
View all comments

Group Policy & Security with Windows Server


0/1 Lessons

Course Introduction

• 2min

0 / 1 lessons complete

Introduction to Group Policy Management

• 1hr 24min

0 / 6 lessons complete

Manage Your Workstations

• 1hr 46min

0 / 7 lessons complete

Securing Your Domain

• 1hr 1min

0 / 5 lessons complete

Group Policy Troubleshooting

• 53min

0 / 5 lessons complete

Course Conclusion

• 1min

0 / 1 lessons complete