Thursday, January 23, 2014

Update ProfilePath in Active Directory – PowerShell Script

Here is a PowerShell V1.0 script which you can use to clear or update the Profile Path (ProfilePath) value in Active Directory user account.

The current script is going to clear (delete) the existing value from Profilepath attribute.  I am using the PutEx ADSI method (  <Object>.PutEx <controlcode>, <attribute name>, <value(s)> ) to clear the existing value. 

$user.PutEx(1, "ProfilePath", 0)
$user.setinfo()

You can see more information about this method on KB article -  http://support.microsoft.com/kb/260251.  

Script:

 

image

 

You can modify the above section to update Profile Path with a different value. here are the supported control codes:

Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4

Or you can use a method I mentioned in this script - Configure Terminal Server User Profile – PowerShell Script - http://portal.sivarajan.com/2011/03/configure-terminal-server-user-profile.html

The input file (Users.CSV) contains user samAccountName as shown in the following screenshot:

image

Output file – Log file (User_Output_MM-dd-yyyy_hh-mm-ss.csv) will have user and old profilepath value.

2 comments:

Suffocating in web-based coursework? We can help! pay someone to take my online class. Get top grades, recover your leisure time, and spotlight on the main thing. Master online course takers, dependable outcomes, reasonable costs. Inhale simple, we have this

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More