header image

Set user profile path

Posted by: | March 1, 2012 | No Comment |

If you store profiles on the network then the user needs to know how to find their profile when they login. Setting the user profile path is similar to the other attributes on the profile tab

$ou = "OU=BlogTests,DC=Manticore,DC=org"            
$name = "UserA"            
Get-ADUser -Identity $name |            
Set-ADUser -ProfilePath "\\pserver\allprofiles"            
"`nAD provider"            
$name = "UserB"            
$dn = "cn=$name,$ou"            
Set-ItemProperty -Path AD:\$dn  -Name profilePath -Value "\\pserver\allprofiles" -Force            
$name = "UserC"            
Get-QADUser -Identity $name |            
Set-QADUser -ProfilePath "\\pserver\allprofiles"            
$name = "UserD"            
$dn = "cn=$name,$ou"            
$user = [adsi]"LDAP://$dn"            
$user.profilepath = "\\pserver\allprofiles"            

The cmdlets use a parameter called –ProfilePath while the provider and script access an attribute called profilepath.  The UNC path is supplied as a string.

under: PowerShell and Active Directory