protected override void ExecuteCmdlet() { if (ParameterSetName == "FILE") { if (!System.IO.Path.IsPathRooted(Path)) { Path = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, Path); } if (File.Exists(Path)) { var fileStream = new StreamReader(Path); var contentString = fileStream.ReadToEnd(); fileStream.Close(); CurrentWeb.AddHtmlToWikiPage(ServerRelativePageUrl, contentString); } else { throw new Exception($"File {Path} does not exist"); } } else { CurrentWeb.AddHtmlToWikiPage(ServerRelativePageUrl, Content); } }