Missing user profile picture after updating mysite host URL in SharePoint 2013

29. April 2015 02:55 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
Recently I had to change mysite host URL in one of our environment. After I update my site hots URL and ran full user profile sync. Everything was working fine until I noticed that user images are not appearing inside user profiles. I have started looking into the issue and done the following steps to figure out the problem I have checked the user profile “Picture” property to make sure that It is mapped to “PhotoThumbnail” property of active directory Then I have checked that the Farm account have permissions on User profiles Using the farm account I have ran the photo import command again  Update-SPProfilePhotoStore –MySiteHostLocation http://mysiteHostUrl –CreateThumbnailsForImportedPhotos $true With help of miisclient.exe I have confirmend that the picture property is pull the binary information from active directory.  I then went to my profile and right click on the “PictureURL” and selected “Properties” option which open up the “Properties” popup window. Suddenly I realised that the URL of my user profile picture is still pointing to the old my site.    I have copied the above picture URL in the browser, updated the “mysite” host URL to new one and hit enter. I was managed to see my profile picture as below.   At last I managed to find the issue. Now it’s time to fix it. So I wrote below PowerShell command to update all user profile picture properties URL. $mySiteNewHostURL = "http://NewMySiteHostURL" $mySiteOldHostURL = "http://OldMySiteHostURL" $mySite = Get-SPSite $mySiteNewHostUrl $SPServiceContext = Get-SPServiceContext $mySite $userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($SPServiceContext) $userProfiles = $userProfileManager.GetEnumerator() foreach ($userProfile in $userProfiles) { #check if the picture property contain image URL, then replace it with new my site host URL if ($userProfile["PictureURL"] -ne '') { $oldImageUrl = $userProfile["PictureURL"].toString() $newImageUrl = $oldImageUrl -Replace $mySiteOldHostURL, $mySiteNewHostURL write-host "Old Image Link = " $oldImageUrl " --> New Image Link = " $newImageUrl $userProfile["PictureURL"].Value = $newImageUrl $userProfile.Commit() } } After I ran above PowerShell script, I was able to see  picture inside my user profile as below. Happy coding 

How to block sandbox solution on SharePoint 2010 farm

30. November 2011 10:57 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
In sharepoint 2010 we can upload and activate sandbox solutions. Although the sandbox solutions can slow down the page system pages execution of cause an error on page. The administrator has the ability to block the sandbox solution for a particular SharePoint 2010 farm. Once the solution is blocked it can’t be activated by any user and prompt will an error message. For testing I create a sandbox solution and called it “sandbox 1.wsp”. Now go to the PowerShell command line and type the following commands. $UserCodeSvc = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local $Signature = [Microsoft.SharePoint.Administration.SPUserCodeService]:: GetSolutionSignatureFromFile($SolutionName) $BlockedSolution = New-Object Microsoft.SharePoint.UserCode.SPBlockedSolution -ArgumentList ($SolutionName), ($Signature), ("Solution Blocked") $UserCodeSvc.BlockedSolutions.Add($BlockedSolution) $UserCodeSvc.Update() Now go to the central admin> System settings> manage user solutions, you will see that “sandbox1.wsp” is in the blocked solution list.

Recycle bin retention period setting using PowerShell

30. November 2011 10:53 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
In SharePoint 2010 there is a recycle bin property called “RecycleBinRetentionPeriod”. This property specifies the number of days files will be stored in recycle bin and then will be deleted after that period. I wrote a PowerShell script to set the SharePoint 2010 site retention period without much hassle. $siteUrl = "http://eblogin.com" Write-Host "Connecting to the site" $SPSite = Get-SPSite | Where-Object {$_.Url -eq $siteUrl} if($SPSite -ne $null) { $SPSite.WebApplication.RecycleBinEnabled = $true $SPSite.WebApplication.RecycleBinRetentionPeriod = 20 $SPSite.WebApplication.Update() } $SPSite.Dispose() Hope this will help.

Sharepoint 2010 web application maximum upload file size limit

30. November 2011 10:48 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
The maximum file size setting will determine the maximum size of files uploaded to document libraries on the site. You can set the sharepoint 2010 web application max file size limit in many ways, but   I have done this in PowerShell. I wrote a smart PowerShell script to do this job. $siteUrl = http://eblogin.com Write-Host "Connecting to the site" $SPSite = Get-SPSite | Where-Object {$_.Url -eq $siteUrl} if($SPSite -ne $null) { $SPSite.WebApplication.MaximumFileSize = 200 $SPSite.WebApplication.Update() } $SPSite.Dispose() Hope this will help you.

Collaboration site default page setting in SharePoint 2010

28. November 2011 09:13 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
In the last post I have explained how you can change publishing site default page using PowerShell You can also achieve same for collaboration site. In this post I explain how SharePoint 2010 collaboration site default page is set up.  $site = get-spsite "http://site URL” $file = $site.RootWeb.GetFile("Pages/Default_Copy.aspx") $folder = $site.RootWeb.RootFolder $folder.WelcomePage = $file $folder.Update()

Setting up publishing site default page in sharepoint 2010

28. November 2011 09:09 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
In SharePoint 2010 publishing site you can choose the default page for that site. In the following example I will show you how you can change the default page of publishing site by using PowerShell. $site = get-spsite "http:// site URL” $pub = [Microsoft.SharePoint.Publishing.PublishingWeb] :: GetPublishingWeb($site.RootWeb) $file = $pub.Web.GetFile("Pages/New_DefaultPage.aspx") $pub.DefaultPage = $file $pub.Update()

Use PowerShell to set security timeout in SharePoint

A user logged off after a certain period of time from sharepoint 2010 site. You can reset this timeout according to your requirement.  If you need a user session to be open for more time you can always change the security time out by using PowerShell. Open PowerShell management console and copy past the following code. Note: change the session Time span according to your need. In this code it is setup as 1 hour and 20 minutes. $SPSite = Get-SPSite("[URL of site collection]") $webApp = $SPSite.WebApplication $webApp.FormDigestSettings.Enabled = $true $webApp.FormDigestSettings.Expires = $true $webApp.FormDigestSettings.Timeout = New-TimeSpan -Hours 1 -Minutes 20 $webApp.Update() Now it will enable the session expiry time to 1 hour and 20 minutes for this site collection.

Configure performance counter for SharePoint environment

23. November 2011 08:01 by Rashid Aziz in   //  Tags: , , ,   //   Comments
I have explained below how you can setup base line and incident performance count for your sharepoint server. This will allow producing a baseline of the source depletion over a period of time. When a problem is occur, these performance encounters can be used to analyze and compare with respect to the base line data to understand any strange behavior in the system. Baseline performance counter script logman create counter Perf_Baseline -s %COMPUTERNAME% -o C:\PerfLogs\Perf_Baseline_%COMPUTERNAME%.blg -f bin -v mmddhhmm -cf Counter_Server.txt -si 00:01:00 -cnf 12:00:00 -b 4/29/2009 5:00AM -u "domainName\theuserid" * Incident performance counter script logman create counter Perf_Incident -s %COMPUTERNAME% -o C:\PerfLogs\Perf_Incident_%COMPUTERNAME%.blg -f bin -v mmddhhmm -cf Counter_Server.txt -si 00:00:10 -max 400 -u "domainName\Theuserid" * The difference between two counters is the frequency of running. The .txt file name need to be updated purely based on server where the counter is created.

Backup/restore SharePoint site collection using PowerShell

15. March 2011 05:24 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
You can quickly perform site collection backup and restore using PowerShell commands. It is powerful and quick. Back up a site collection using PowerShell 1.      Make sure that the user has rights to perform backup. 2.      On the “Start” click “All Programs.” 3.      Now click on “Microsoft SharePoint 2010 products”. 4.      Click on “SharePoint 2010 Management Shell” 5.      The PowerShell command prompt will be appear , now type the following Backup-SPSite -Identity <Name on site collection> -Path <backup file path> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose] If you want to overwrite the previous backup, please use force.   Restore a site collection using PowerShell 1.      Make sure that the user has rights to perform backup. 2.      On the “Start” click “All Programs.” 3.      Now click on “Microsoft SharePoint 2010 products”. 4.      Click on “SharePoint 2010 Management Shell” 5.      The PowerShell command prompt will be appear , now type the following Restore-SPSite -Identity <The site collection URL> -Path <Backup file> [-DatabaseServer <Name of Database server>] [-DatabaseName <The content database name>] [-HostHeader <The Host header>] [-Force] [-GradualDelete] [-Verbose] If you want to overwrite the existing site collection, please use force.

Stay connected

SharePoint Links

Month List