The two most widely used user profile property types in SharePoint 2010 are “string (Single Value)” and “string (Multi Value)”. Single value property types work in a similar way to “Single line of text” columns in lists and libraries – examples being Name, Department, Job Type, etc. Multi value property types use the Managed Metadata service to allow the multiple input of new or previously used values from the Keywords term set – examples being Skills, Schools, Responsibilities, etc.
The PowerShell script below provides an example of how to add or modify a single value user profile property for an individual user. Admittedly, this can be done quite easily by using the Central Administration UI (although it does take a few clicks), but it’s real power is when you combine the script with a CSV or XML file to bulk change hundreds of user profile properties in a matter of seconds – you can find examples of using CSV and XML files for bulk operations here and here, although I plan to publish more articles on these techniques in future posts.
Note: The user running the script (which I assume is some sort of SharePoint Administrator) must have been granted the Manage Profiles right in the Administrators section and Full Control rights in the Permissions section of the User Profile Service Application (pictured below).
The script below changes the value of the Web Site attribute for a user with the account name DOMAIN\Phil.Childs. You will need to specify the My Site host site collection URL for the $mySiteUrl variable:
#Set up default variables
$mySiteUrl = "http://mysite"
$adAccount = "DOMAIN\phil.childs"
$upAttribute = "WebSite"
$upAttributeValue = “http://get-spscripts.com”#Get site objects and connect to User Profile Manager service
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)#Check to see if user profile exists
if ($profileManager.UserExists($adAccount))
{
#Get user profile and change the value
$up = $profileManager.GetUserProfile($adAccount)
$up[$upAttribute].Value = $upAttributeValue
$up.Commit()
}
else
{
write-host "Profile for user"$adAccount "cannot be found"
}#Dispose of site object
$site.Dispose()
In a future post I will run through how to use a similar approach to change a multi value user profile property…
Thank you. I combined two of your script examples into one. This one reads from a CSV file of two columns (NTName and PropertyVal) to load the PictureURL of each profile. I needed to use this to merge two profile databases into one.
ReplyDelete#Set up default variables
$csvfile="PictureURL.csv"
$mySiteUrl = "http://sitename"
$upAttribute = "PictureURL"
#Get site objects and connect to User Profile Manager service
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
#Create Lists from each item in CSV file
$csvData = Import-Csv $csvfile
foreach ($line in $csvData)
{
#Check to see if user profile exists
if ($profileManager.UserExists($line.NTName))
{
#Get user profile and change the value
$up = $profileManager.GetUserProfile($line.NTName)
$up[$upAttribute].Value = $line.PropertyVal
$up.Commit()
}
else
{
write-host "Profile for user"$line.NTName "cannot be found"
}
}
#Dispose of site object
$site.Dispose()
Nice...
ReplyDeleteI tried your script on the Title Field. it worked a treat. But thought I would mention, I ran a full profile sync and it went back to the old Title?
ReplyDelete@The Baretta - yes, it will do because the title property is managed from Active Directory by default. Any changes you make to these sorts of properties will be overwritten at the next scheduled User Profile import job
ReplyDelete2015-12-7 xiaozhengm
ReplyDeletefitflops clearance
michael kors uk
tory burch outlet
oakley sunglasses
nike outlet
louis vuitton outlet
louis vuitton pas cher
kate spade outlet
gucci outlet
coach outlet
michael kors outlet
canada goose uk
coach factory outlet
christian louboutin shoes
nike blazer
jordan 8s
michael kors handbags
jordan 3 infrared
caoch outlet
true religion outlet
air jordan uk
michael kors
longchamp outlet
adidas shoes uk
coach factory outlet
coach factory outlet
nike blazers
ugg australia
nike uk
coach factory outlet
tiffany and co
basketball shoes
michael kors outlet uk
louboutin
air jordans
chaussure louboutin
air jordan 13
ugg outlet
louis vuitton outlet
Great Article..
ReplyDeleteOnline DotNet Training
.Net Online Training
Dot Net Training in Chennai
IT Training in Chennai
jianbin0309
ReplyDeletetrue religion jeans outlet
celine outlet
louis vuitton handbags outlet
air jordan shoes for sale
asics,asics israel,asics shoes,asics running shoes,asics israel,asics gel,asics running,asics gel nimbus,asics gel kayano
tiffany outlet
swarovski crystal
michael kors outlet store
michael kors clearance
hermes bags
ray ban sunglasses
marc jacobs
valentino outlet
swarovski crystal
mac cosmetics
cheap nba jerseys
ray ban sunglasses
louis vuitton handbags outlet
ray-ban sunglasses
michael kors outlet store
michael kors outlet online
swarovski outlet
chicago blackhawks
true religion canada
michael kors outlet
ed hardy clothing
longchamp handbags outlet
prada outlet
ralph lauren shirts
michael kors factory store
cheap nfl jersey
rolex watches for sale
cheap nike shoes
mbt shoes outlet
christian louboutin sale
ReplyDeletecoach factory outlet
michael kors outlet
louis vuitton bags
louis vuitton outlet
toms
coach outlet store online
adidas shoes
ray ban sunglasses uk
oakley sunglasses
coach outlet
louis vuitton handbags
abercrombie kids
michael kors purses
coach outlet
coach outlet
louis vuitton outlet
michael kors purses
coach factory outlet
adidas uk
lebron james shoes 12
coach factory outlet
coach outlet online
louis vuitton handbags
ray ban sunglasses
celine
polo ralph lauren
kate spade outlet
michael kors handbags
michael kors
lebron james shoes
louis vuitton handbags
louis vuitton bags
christian louboutin outlet
cheap oakley sunglasses
mont blanc pens
adidas outlet store
nike nfl jerseys
ralph lauren outlet
beats headphones
20168.8wengdongdong
cheap oakley sunglasses
ReplyDeletenhl jerseys
vans store
ralph lauren outlet
ed hardy shirts
michael kors handbags
true religion outlet
air jordan shoes
ray ban eyeglasses
air jordan shoes
2017.5.15chenlixiang
تور تایلند
ReplyDeleteدانلود آهنگ جدید
اخبار هنرمندان
آموزش موسیقی
معرفی ساز ها
تور تایلند
ملودی نما
Thanks for sharing the information
ReplyDeleteKhasiat QnC Jelly Gamat
Obat Eksim Atopik
Pengobatan Herbal Penyakit Liver
Cara Mengobati Alergi Dingin
Obat Paling Mujarab untuk Diabetes
Obat Batu Empedu Alami
PENGOBATAN PENYAKIT AMANDEL
Our digital marketing course in Chennai is targeted at those who are desirous of taking advantage of career opportunities in digital marketing. Join the very best Digital Marketing Course in Chennai. Get trained by an expert who will enrich you with the latest digital trends.
ReplyDeleteDigital Marketing Course in Chennai
Digital Marketing Training in Chennai
Online Digital Marketing Training
SEO Training in Chennai
Digital Marketing Course
Digital Marketing Training
Digital Marketing Courses
alat bantu sex pria vagina manual
ReplyDeletealat bantu sex wanita penis pretty love
tongue viberator lidah
alat bantu sex wanita penis mutiara
alat bantu sex wanita penis maju mundur
alat bantu sex wanita penis getar
alat bantu sex wanita penis manual
alat bantu sex wanita penis kelabang
alat bantu sex wanita penis ikat pinggang
alat bantu sex wanita penis tempel jumbo
This article is interesting and useful. Thank you for sharing. And let me share an article about health that God willing will be very useful. Thank you :)
ReplyDeleteCara Menghilangkan Bruntusan
Obat Penyakit Susah Kencing
Khasiat dan manfaat QnC Jelly Gamat
شركة بتبوك
ReplyDeleteشركة مكافحة حشرات بتبوك
شركة مكافحة النمل الابيض بتبوك
شركة رش مبيدات بتبوك
No matter what type of Michael Kors Bags Outlet each individual got, they all had one thing in common. We all know that getting something on sale is like winning a mini lottery, but to find a name brand handbag like Michael Kors Black Friday Sale for instance, discounted is like a slice of heaven on earth. I have personally attacked my husband with hugs and kisses when finding Official Coach Outlet Online at discounted prices.
ReplyDeleteMichael Kors Factory Outlet stores can be found in malls all over. MK Outlet and other Coach merchandise can also be found in some boutiques. Inspired by the same material baseball gloves are made from, these Coach Bags On Sale Online are versatile and stylish. Since it's conception, the Michael Kors Handbags Outlet has been produced into a variety of designs, colors, shapes, and styles that have won top pick of millions of women the world over.
New Michael Kors Bags are the most sought after handbag. Since Coach Outlet Online is one of the most recognized name brands in the world of fashion, you will find A-list celebrities down to small girls wearing them.
tags:Coach Outlet|Coach Bags Factory Outlet|Coach Purses Outlet