I recently put together a powershell script that can be used to update a profile property of all of the users stored in the SharePoint SSP. At NewsGator we use a boolean property field to indicate if a particular part of our product has been activated or not. There are some cases where this boolean flag needs to be reset for all users. To do this I put together a simple powershell script to reset this value for all users.
This could easily be adapted for other users so I thought I would post share it.
########################### # "Configure Settings" $SSPName = "SSPAdmin" $MySiteUrl = "http://mysite/" $propName = "newsgator-x-onboarded" $propValue = "true" ########################### #Load the SharePoint assemblies [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles") $ServerContext = [Microsoft.Office.Server.ServerContext]::GetContext($SSPName); $UPManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServerContext); $enumProfiles = $UPManager.GetEnumerator(); "Total User Profiles available:" + $UPManager.Count $count=0; #Loop through the SSP entries and update the property foreach ($oUser in $enumProfiles) { $count = $count + 1; $u = $oUser.Item("Accountname"); Write-Output "($count): Setting '$propName' to '$propValue' for $u"; $oUser[$propName].Value = $propValue; $oUser.Commit(); }






No comments yet.
Leave a comment