protected override void ExecuteCmdlet() { if (Scope != CustomActionScope.All) { if (Scope == CustomActionScope.Web) { CurrentWeb.AddJsBlock(Name, Script, Sequence); } else { var site = ClientContext.Site; site.AddJsBlock(Name, Script, Sequence); } } else { ThrowTerminatingError(new ErrorRecord(new Exception("Scope parameter can only be set to Web or Site"), "INCORRECTVALUE", ErrorCategory.InvalidArgument, this)); } }