Implementing SSL with PowerShell for existing SharePoint 2013 farm – Part 6

We’re almost there. In this 6th part of the series I focus on re-configuring SharePoint services to use the new HTTPS addresses. Think of Search and User Profiles.

User Profiles

Let’s start with the User Profile service. The location of the MySite Host has changed. It’s https://spmysites.company.com now. This is configured in one place luckily, so you can have it changed using Central Administration, Manage Service Applications, your User Profile Service Application and then under MySite Settings, click Setup My Sites:

image

To do this by PowerShell:

$newURL = "https://mysites.company.com"

$context = Get-SPServiceContext("https://hostingwebapp.company.com")
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)

Write-Host
Write-Host -f Yellow Current location My Site Host:
Write-Host `t $upm.MySiteHostUrl

$upm.MySiteHostUrl = $newURL

#Get a refreshed UserProfileManager object to retrieve the new value
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)

Write-Host
Write-Host -f Green New location My Site Host:
Write-Host `t $upm.MySiteHostUrl
Write-Host


image

Note: in order to run this script successfully, the account running the script needs to have Full Control permissions on the User Profile Service Application.

Search

Now I have changed all URLs to any content for search, I can update the Search index. This still contains all old HTTP URLs.

$ssa = Get-SPEnterpriseSearchServiceApplication

$sources = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $ssa

$sources | % {

    $source = $_
    
    $startAddresses = ""
    $source.StartAddresses | % { $startAddresses += $_.ToString() + "," }
    
    $startAddresses = $startAddresses.SubString(0, $startAddresses.Length-1).Replace("http://", "https://").Replace("sps3://", "sps3s://")
    
    Write-Host
    Write-Host -f White $source.Name
    Write-Host $source.StartAddresses
    Write-Host -f yellow "changing to: "$startAddresses
    
    Set-SPEnterpriseSearchCrawlContentSource $source -StartAddresses $startAddresses
    
}

image

Doing a full crawl of all content sources should do the trick. Start with the content source Local People Search.

$ssa = Get-SPEnterpriseSearchServiceApplication
$source = Get-SPEnterpriseSearchCrawlContentSource "Local People Search" -SearchApplication $ssa
$source.StartFullCrawl()

Other services

Besides User Profile and Search service, there could be more services for you to check and modify. For example, Excel services. There is a configuration for Trusted File Locations.

image

By default, there is an address for http://, meaning the complete SharePoint environment is trusted. You should change this to https://

$sa = Get-SPExcelServiceApplication

$locations = Get-SPExcelFileLocation -ExcelServiceApplication $sa

$locations | % {

    $location = $_
    
    $address = $location.Address.Replace("http://", "https://")
    
    Write-Host
    Write-Host -f White Trusted location : $location.Identity
    Write-Host $location.Address
    Write-Host -f yellow "Changing to: "$address
    
    Set-SPExcelFileLocation $location -ExcelServiceApplication $sa -Address $address
    
}

image

Summary

A lot can be achieved using PowerShell, even for services. After changing the webapplications and site collections to use HTTPS, this post described what and how to change services that were configured to use HTTP.

Don’t forget to download your scripts…

3 thoughts on “Implementing SSL with PowerShell for existing SharePoint 2013 farm – Part 6

  1. Constantinos

    I’m very impressed with the series Octavie. I would like to thank you for the time and effort you put in creating it. Any idea when the last 2 parts will be published?

    Keep up the great work

    Constantinos

    1. Octavie van Haaften Post author

      Hi Constantinos,
      Thank you for the compliment. I have been very low under the radar lately, haven’t I? Guess it’s time to wake up and finish this series indeed. And then start blogging about current experiences. Stay tuned! 🙂

      grtz,
      Octavie

  2. Pingback: Implementing SSL with PowerShell for existing SharePoint 2013 farm – Part 1 – SharePoint: Working on it…

Leave a Reply

Your email address will not be published. Required fields are marked *