From 98f3daa2b71c1db63a04ad7eb0316c0c0a9ecbdf Mon Sep 17 00:00:00 2001 From: Andreas Hebert Date: Thu, 27 Oct 2022 16:20:42 +0200 Subject: [PATCH 1/2] Fixes https://github.com/dsccommunity/SharePointDsc/issues/1306 --- .../MSFT_SPUserProfileServiceApp.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 index 86df443c1..8f9b8ff70 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 @@ -199,6 +199,7 @@ function Get-TargetResource $upMySiteLocation = $null $upMySiteManagedPath = $null $upSiteConflictNaming = $null + $mysiteHostLocation = $null try { $ca = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { $_.IsAdministrationWebApplication } @@ -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 { @@ -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 From 36fb015f9a48dbb9be25394cb05674d393eb3e50 Mon Sep 17 00:00:00 2001 From: Andreas Hebert Date: Thu, 27 Oct 2022 16:41:46 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38f0442e4..6000b64b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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