Skip to content

Commit

Permalink
Merge pull request #1412 from ahebx/master
Browse files Browse the repository at this point in the history
SPUserProfileServiceApp: Fix issue where Get-TargetResource throws an error when no MySiteHost is specified
  • Loading branch information
ykuijs committed Oct 31, 2022
2 parents a98dfeb + 36fb015 commit 9978e8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- SPUserProfileServiceApp
- Fixed issue where error 'You cannot call a method on a null-valued expression' was thrown when no MySiteHost was specified

## [5.2.0] - 2022-05-12

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ function Get-TargetResource
$upMySiteLocation = $null
$upMySiteManagedPath = $null
$upSiteConflictNaming = $null
$mysiteHostLocation = $null
try
{
$ca = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { $_.IsAdministrationWebApplication }
Expand All @@ -208,6 +209,10 @@ function Get-TargetResource
$upMySiteLocation = [System.Uri]$userProfileManager.MySiteHostUrl
$upMySiteManagedPath = $userProfileManager.PersonalSiteInclusion
$upSiteConflictNaming = $userProfileManager.PersonalSiteFormat
if (-not [string]::IsNullOrEmpty($upMySiteLocation.AbsoluteUri))
{
$mysiteHostLocation = $upMySiteLocation.AbsoluteUri.TrimEnd('/')
}
}
catch
{
Expand All @@ -223,7 +228,7 @@ function Get-TargetResource
Name = $serviceApp.DisplayName
ProxyName = $proxyName
ApplicationPool = $serviceApp.ApplicationPool.Name
MySiteHostLocation = $upMySiteLocation.AbsoluteUri.TrimEnd("/")
MySiteHostLocation = $mysiteHostLocation
MySiteManagedPath = $upMySiteManagedPath
ProfileDBName = $databases.ProfileDatabase.Name
ProfileDBServer = $databases.ProfileDatabase.NormalizedDataSource
Expand Down

0 comments on commit 9978e8c

Please sign in to comment.