SharePoint Pages - Break inheritance and remove groups using PowerShell

%3CLINGO-SUB%20id%3D%22lingo-sub-2892981%22%20slang%3D%22en-US%22%3ESharePoint%20Pages%20-%20Break%20inheritance%20and%20remove%20groups%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2892981%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20trying%20to%20figure%20out%20this%20problem%20for%20a%20while%20now.%26nbsp%3B%26nbsp%3BI%20have%20a%20SharePoint%20site%20template%20that%20I've%20applied.%26nbsp%3B%20The%20template%20creates%20all%20the%20pages%20and%20lists%20that%20we%20need.%26nbsp%3B%20For%20each%20new%20site%20using%20that%20template%2C%20I'd%20like%20to%20be%20able%20to%20run%20a%20script%20against%20to%20create%20custom%20groups%20and%20give%20them%20the%20correct%20roles%20for%20the%20lists%20and%20pages.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20able%20to%20use%20PnPOnline%20to%20create%20all%20the%20groups%2C%20and%20assign%20the%20right%20permissions.%26nbsp%3B%20Since%20by%20default%20they%20get%20applied%20everywhere%2C%20the%202nd%20part%20of%20my%20script%20goes%20and%20removes%20the%20groups%20from%20the%20lists%20that%20they%20are%20not%20supposed%20to%20access.%26nbsp%3B%20This%20part%20works%20great.%26nbsp%3B%20What%20I%20am%20stuck%20on%20is%20doing%20the%20same%20thing%20with%20pages.%26nbsp%3B%20Some%20pages%20we%20don't%20want%20certain%20groups%20to%20get%20into%20but%20I'm%20have%20a%20hard%20time%20figuring%20this%20piece%20out%20through%20PowerShell.%26nbsp%3B%20Seems%20like%20it's%20possible%20with%20lists%20and%20document%20libraries%20but%20I%20can't%20find%20any%20similar%20commands%20for%20the%20pages%20themselves.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20suggestions%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2892981%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Established Member

Hi all,

 

I've been trying to figure out this problem for a while now.  I have a SharePoint site template that I've applied.  The template creates all the pages and lists that we need.  For each new site using that template, I'd like to be able to run a script against to create custom groups and give them the correct roles for the lists and pages. 

 

I've been able to use PnPOnline to create all the groups, and assign the right permissions.  Since by default they get applied everywhere, the 2nd part of my script goes and removes the groups from the lists that they are not supposed to access.  This part works great.  What I am stuck on is doing the same thing with pages.  Some pages we don't want certain groups to get into but I'm have a hard time figuring this piece out through PowerShell.  Seems like it's possible with lists and document libraries but I can't find any similar commands for the pages themselves.

 

Any suggestions?

 

Thanks.

 

0 Replies