SharePointDsc icon indicating copy to clipboard operation
SharePointDsc copied to clipboard

SPSite: Microsoft.SharePoint.SPSite Constructur returns $null for site properties (Owner.Email, Rootweb.Template, etc.)

Open Maurikrm opened this issue 11 months ago • 1 comments

Problem description

After installing the latest version of SharePointDSC 5.6.1. (which includes fix #1443 ) it turns out that some site properties returns $null for HNSC.

Verbose logs

Output WITHOUT the fix:

ConfigurationName        : BGSharePoint_SP
DependsOn                : {[SPWebApplication]SharePoint Content Web Application}
ModuleName               : SharePointDSC
ModuleVersion            : 5.6.1
PsDscRunAsCredential     :
ResourceId               : [SPSite]Site_my.contoso.lab
SourceInfo               :
AdministrationSiteType   : None
CompatibilityLevel       : 15
ContentDatabase          : SP_Content_01
CreateDefaultGroups      : True
Description              :
HostHeaderWebApplication : https://portal.contoso.lab/
Language                 : 1043
Name                     :
OwnerAlias               : contoso\svc-farm
OwnerEmail               :
QuotaTemplate            :
SecondaryEmail           :
SecondaryOwnerAlias      :
Template                 : SPSMSITEHOST#0
Url                      : https://my.contoso.lab
PSComputerName           : WEU-SPSE-BE
CimClassName             : MSFT_SPSite



Output WITH the fix:

ConfigurationName        : BGSharePoint_SP
DependsOn                : {[SPWebApplication]SharePoint Content Web Application}
ModuleName               : SharePointDSC
ModuleVersion            : 5.6.1
PsDscRunAsCredential     :
ResourceId               : [SPSite]Site_my.contoso.lab
SourceInfo               :
AdministrationSiteType   : None
CompatibilityLevel       : 15
ContentDatabase          : SP_Content_01
CreateDefaultGroups      : False
Description              :
HostHeaderWebApplication : https://portal.contoso.lab/
Language                 : 1043
Name                     :
OwnerAlias               :
OwnerEmail               :
QuotaTemplate            :
SecondaryEmail           :
SecondaryOwnerAlias      :
Template                 : #
Url                      : https://my.contoso.lab
PSComputerName           : WEU-SPSE-BE
CimClassName             : MSFT_SPSite

DSC configuration

SPSite $site
{
 Url                      = 'https://my.contoso.lab'
 OwnerAlias               = 'contoso\svc-farm'
 ContentDatabase          = 'SP_Content_01'
 HostHeaderWebApplication = 'https://portal.contoso.lab'
 Name                     = 'MySite'
 Template                 = 'SPSMSITEHOST#0'
 Language                 = '1043'
 PsDscRunAsCredential     = $InstallAccount
 DependsOn                = $depends
}

Suggested solution

.

SharePoint version and build

SharePoint Server Subscription Edition 16.0.18526.20080 (25H1)

Operating system the target node is running

WindowsBuildLabEx                                       : 20348.2849.amd64fre.fe_release_svc_prod1.241101-1732
WindowsCurrentVersion                                   : 6.3
WindowsEditionId                                        : ServerDatacenter
WindowsInstallationType                                 : Server Core
WindowsProductName                                      : Windows Server 2022 Datacenter

PowerShell version and build the target node is running

PSVersion                      5.1.20348.2849
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.2849
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

SharePointDsc version

SharePointDSC 5.6.1

Maurikrm avatar Mar 21 '25 15:03 Maurikrm

@Maurikrm Do you have suggested code to resolve this issue?

luigilink avatar Oct 07 '25 19:10 luigilink