To keep specific Model or Layout pages from being exported you can define filters by Name, to do this you can use Operators such as -like, -eq -notlike. You can also use Wildcards with *, when using wildcards there could be written anything before or after the word you search for, depends on where you put the *. You can also put it before and after the word. In the attached sample script i'm using "House*" to exclude the word "House" but also words like "Housekeeper" are excluded because of the wildcard after the word.
Changing the $ExcludeName variable will result in every Layout with the same name being excluded. In the Line
$sheetsToRemove = $sheets | Where { $_.Layout -like "$ExcludeName" }
Examples
Excludes every Layout that has the word "PartialExcludeName" in it. This will also work if there are other characters before or after the $ExcludeName
$ExcludeName = "*PartialExcludeName*"
$ExcludeName = "*PartialExcludeName"
$sheetsToRemove = $sheets | Where { $_.Layout -eq "$ExcludeName" }
$sheetsToRemove = $sheets | Where { $_.Layout -notlike "$ExcludeName" }
See Also
- PowerShell Operators (Microsoft)
- Wildcard Characters (MSDN)