protected override void ExecuteCmdlet() { Folder pageFolder = null; if (!string.IsNullOrEmpty(FolderPath)) { pageFolder = CurrentWeb.EnsureFolderPath(FolderPath); } switch (ParameterSetName) { case "WithTitle": { CurrentWeb.AddPublishingPage(PageName, PageTemplateName, Title, publish: Publish, folder: pageFolder); break; } default: { CurrentWeb.AddPublishingPage(PageName, PageTemplateName, publish: Publish, folder: pageFolder); break; } } }