Created
June 25, 2021 19:58
-
-
Save nehemiahj/c46c9faf93543f079b01a682a39530d1 to your computer and use it in GitHub Desktop.
This script creates Sitecore Package with all Users and Roles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: https://doc.sitecorepowershell.com/appendix/packaging/new-securitysource | |
$package = New-Package "Sitecore-UsersAndRoles"; | |
#Set package metadata | |
$package.Sources.Clear(); | |
$package.Metadata.Author = "Nehemiah"; | |
$package.Metadata.Publisher = "Company"; | |
$package.Metadata.Version = "1.0"; | |
$package.Metadata.Readme = 'This package has all the users and roles of the Sitecore Instance' | |
# Create security source with all roles and users | |
$source = New-SecuritySource -Filter * -Name AllUsersAndRoles | |
$package.Sources.Add($source); | |
# Save package | |
Export-Package -Project $package -Path "$($package.Name)-$($package.Metadata.Version).zip" -Zip | |
# Offer the user to download the package | |
Download-File "$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment