I needed to change the profile path for a fair number of users in AD a go. Thought I’d give PowerShell a go. Talk about easy…. here it is.
Change the Profile Path for all users in an OU – the easy way
$users = Get-ADUser -filter * -SearchBase “ou=<yourOu>,dc=<yourDC>,dc=<yourDC>”
ForEach( $u in $users )
$ProfilePath = “\\<yourProfileServer>\<yourProfileShare>\” + $u.sAMAccountName
set-ADUser -Identity $uDistinguishedname -Profilepath $ProfilePath
Well – I lied – there are 4 lines of code. Talk about easy