-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPSite: Microsoft.SharePoint.SPSite Constructur returns $null when run as Ressource #1442
Comments
@ykuijs do you know if there was a special use case to get the Site Collection with
and not Also if you run the current code inside a PowerShell with the DSCRunAsAccount it works, it just breaks when run by them LCM 😆 |
I think it was changed with #875 but i do not understand why🤔 |
I found the PR #904 which explains the reason. Since its from 2018 - did a patch change that behaviour? |
SharePoint 2016 and 2019 works fine. |
Has been a while, so had to think hard what the reasoning was. Fortunately I documented this in PR 904 😉 Just to get things clear: The current code works on 2016 and 2019, but doesn't work properly on SPSE. Is that correct? If so, we can add a check to see if SPSE is used and in that case use Get-SPSite. But when 2016 or 2019 is used, use the current code. |
Indeed :)
Yes, it works on 2016 and 2019, but not on SPSE - at least my environments.
Good Idea, i'll use the following if statement, from the SPDistributedCacheService Resource. Lines 152 to 155 in 13408f4
|
That is exactly what you need indeed. We have used this logic on several occasions in SPDsc to make sure we can do specific actions for a specific version. The SPInstallPrereqs resource for example, where we have to install the prereqs for each specific version of SharePoint. |
Problem description
When the
Get-TargetResource
Function tries to load an existing site collection it always returns $null when run by the LCM:SharePointDsc/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1
Lines 76 to 85 in 13408f4
Verbose logs
DSC configuration
Suggested solution
Switch to
$site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue
SharePoint version and build
Operating system the target node is running
PowerShell version and build the target node is running
SharePointDsc version
The text was updated successfully, but these errors were encountered: