I have great news! I was able to identify the issue, which can be triggered on site collections originally created in SharePoint 2007. According to my communication with Microsoft Support, a fix for this issue is scheduled to be released in the upcoming January 2025 update.
SharePoint 2019 - Import-SPWeb -IncludeUserSecurity - Updates to system roles is not allowed
I have a problem when moving a subsite to a new site collection with the same URL when using the Import-SPWeb command and its IncludeUserSecurity parameter.
Structure:
Manage Path: /a - Explicit
Site collection: https://webapp.com/a
Subsite: https://webapp.com/a/b/c
Manage Path: /a/b/c - Explicit
New Site collection: https://webapp.com/a/b/c
Export and import commands:
Export-SPWeb -Identity $subsiteURL -Path $backupLoc -IncludeUserSecurity -IncludeVersions All -NoLogFile -NoFileCompression -Force -Verbose
Import-SPWeb -Identity $url -Path $backupLoc -UpdateVersions Overwrite -NoLogFile -NoFileCompression -Force -IncludeUserSecurity -Verbose
When Import-SPWeb I get the error "Import-SPWeb: Updates to system roles is not allowed.". For example, I get this error for a file that has inheritance stopped but when requesting access to the site. Without the IncludeUserSecurity parameter it is successful. I have read that I am not the only one having the same problem, maybe this parameter is not working from the beginning.
Is there another way to move subsites to site collection with URL preservation? Am I making a mistake somewhere or is the command just not working correctly with the IncludeUserSecurity parameter?
2 answers
Sort by: Most helpful
-
-
AllenXu-MSFT 22,081 Reputation points Microsoft Vendor
2024-09-17T07:07:18.0766667+00:00 Hi @Adrián Ďurica,
I couldn't reproduce this issue in my environment.
My commands:
Export-SPWeb -Identity "http://sp19/sites/test/sub" -Path "C:\ExportFileName.cmp" -IncludeUserSecurity -IncludeVersions All -NoLogFile -NoFileCompression -Force -Verbose Import-SPWeb -Identity "http://sp19/newsub" -Path "C:\ExportFileName.cmp" -UpdateVersions Overwrite -NoLogFile -NoFileCompression -Force -IncludeUserSecurity -Verbose
My SharePoint build number is
16.0.10337.12109
. You can check yours with this PowerShell:$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local write-host $farm.BuildVersion
And did you run your commands in SharePoint 2019 management shell as administrator?
Also if you try moving a blank subsite or to a new target site, will it work? I want to confirm whether it is caused by the content of your source subsite or target site.
Thanks.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.