Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SPUserProfileServiceApp: Error with Test or Get after successfull Set with no MySiteHostLocation

See original GitHub issue

Details of the scenario you tried and the problem that is occurring

When creating user profile service app without Mysitehostlocation and with enabled CredSSP it is working but after trying to validate the config the TEST and GET functions are not working anymore

Verbose logs showing the problem

No verbose logging just this:


Suggested solution to the issue:

Fix issue with nonmandatory mysitehostlocation?

The DSC configuration that is used to reproduce the issue (as detailed as possible)

function new-pscredential{
  param (
    [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
    [parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)]

  $secpasswd   = ConvertTo-SecureString $password -AsPlainText -Force
  $credentials = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
  return $credentials

$response = @{
  indesiredstate = $false
  rebootrequired = $false
  errormessage   = ''

$invokeParams = @{
Name       = 'SPUserProfileServiceApp'
ModuleName = 'SharePointDsc'
Method     = 'test'
Property   = @{
'name' = 'SP Hosting User Profile Service';
'proxyName' = 'XXXXX Profile Service Proxy';
'applicationPool' = 'SharePoint Web Services Default';
'profileDBName' = 'XXXXXUserProfile_Profile';
'profileDBServer' = 'XXXX';
'socialDBName' = 'XXXXXXUserProfile_Social';
'socialDBServer' = 'XXXX';
'syncDBName' = 'SP_Hosting_UserProfile_Sync';
'syncDBServer' = 'XXXX';
'enableNetBIOS' = $false;
'psDscRunAsCredential' = ([PSCustomObject]@{
'user' = XXXXX';
'password' = 'XXXXX'
} | new-pscredential)

  $result = Invoke-DscResource @invokeParams
  $response.errormessage = $_.Exception.Message
  return ($response | ConvertTo-Json -Compress)

    $response.indesiredstate = $result.InDesiredState
    return ($response | ConvertTo-Json -Compress)
    $response.indesiredstate = $true
    $response.rebootrequired = $result.RebootRequired
    return ($response | ConvertTo-Json -Compress)

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.17763.1490
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1490
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3

Version of the DSC module that was used

Get-Module -Name ‘SharePointDsc’ -ListAvailable | ft Name,Version,Path

Name          Version Path
----          ------- ----
SharePointDSC 4.6.0   C:\Program Files\WindowsPowerShell\Modules\SharePointDSC\SharePointDSC.psd1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

ykuijscommented, Oct 31, 2022

Hi @ahebx, thanks for the fix/PR. I have just merged the PR. It will be included in the next version!

hebbeacommented, Oct 27, 2022

I have the same issue.

It seems the problem is when creating the User Profile Service Application without a MySiteHost.

Then Get-TargetResource in SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 throws this error.

Line 208 $upMySiteLocation gets an empty [system.uri], and then on line 226 we try to run the TrimEnd method on a null value: $upMySiteLocation.AbsoluteUri.TrimEnd(“/”)

I’m new to contributing but i can try to fix this. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

User Profile service application doesn't work - SharePoint
Provides a workaround for an issue in which the User Profile service application doesn't work. This issue occurs after a SharePoint farm is ......
Read more >
My sites not creating site collections
Having your Personal site host in /my/personal is not a functional design. It should be the root site collection of your web application....
Read more >
Create User Profile Service Application using PowerShell ...
This PowerShell script creates User Profile Service Application in SharePoint 2016. Prerequisite: Create my site host prior creating user ...
Read more >
Deploying SharePoint 2016
Hybrid Cloud Search. Setting Up the Cloud Search Service Application. On-Boarding Process. Crawling and Testing. Searching from SharePoint On-Premises.
Read more >
InfoPath calls WebService 401 Unauthorized
Hi,I am trying access UserProfileService Web service on InfoPath 2010 ... available to solve the 5566 error but could not get any success....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found