
833 A.2d 304 (2003)
Patrick HOKE, a minor, by his Mother, Dolores REIDENBACH, and Stepfather, Randy Reidenbach,
v.
ELIZABETHTOWN AREA SCHOOL DISTRICT, Appellant.
Commonwealth Court of Pennsylvania.
Argued September 11, 2003.
Decided October 3, 2003.
*306 Jeffrey D. Litts, Lancaster, for appellant.
Kelly L. Darr, Philadelphia, for appellees.
Sean A. Fields, New Cumberland, for amicus curiae, PA School Boards Association.
BEFORE: FRIEDMAN, Judge, and LEAVITT, Judge, and MIRARCHI, JR., and Senior Judge.
*305 OPINION BY Judge FRIEDMAN.
The Elizabethtown Area School District (School District) appeals from the August 22, 2002, and December 30, 2002, orders of the Court of Common Pleas of Lancaster County (trial court). The trial court granted summary judgment in favor of Patrick Hoke (Patrick) and permanently enjoined the School District from preventing Patrick's enrollment in, and attendance at, a School District high school based on Patrick's conduct at a private school outside the School District.
The facts here are undisputed.[1] Patrick, who resides with his mother and stepfather within the School District, was enrolled in the ninth grade at Lancaster Catholic High School (Lancaster Catholic), a private parochial school, for the 2001-2002 school year. In April 2002, Patrick sold three 20 mg. tablets of the prescription medication Adderall to a twelfth-grade student. That same day, Patrick told other students about the drug sale, and they informed a Lancaster Catholic teacher. Lancaster Catholic began an investigation, during which school personnel searched Patrick's bookbag and found a pocketknife with a four-inch blade.
Lancaster Catholic operates under the auspices of the Diocese of Harrisburg and must comply with all Diocese school policies, including those relating to students possessing weapons and selling drugs at school. In addition, Lancaster Catholic has its own guidelines regarding student use and possession of drugs and weapons. Patrick's distribution and sale of Adderall constituted a violation of Diocese Policy No. 5137 and of Lancaster Catholic's drug and alcohol guidelines.[2] Patrick's possession *307 of a pocketknife in school constituted a violation of Diocese Policy No. 5137.5 and Lancaster Catholic's weapons policy.[3]
On April 9, 2002, Lancaster Catholic notified Patrick's parents about the incident. At a meeting the next day, the principal told Patrick's parents that it was Lancaster Catholic's policy to expel students who sold drugs at school and that no pre-expulsion hearing was provided. The principal then told Patrick's parents that, in lieu of expulsion, he would allow them to immediately withdraw Patrick as a student at Lancaster Catholic, but if they chose not to do so, Patrick would be permanently expelled from the school. Faced with this choice, Patrick's parents withdrew Patrick on April 10, 2002.
On April 11, 2002, Patrick and his mother went to enroll Patrick in the School District's public high school. After completing the enrollment forms and selecting courses, Patrick and his mother informed the guidance counselor about the incident at Lancaster Catholic. The guidance counselor then advised Patrick that the School District's high school principal would have to approve Patrick's enrollment.[4] Subsequently, Patrick's mother met with the School District's principal and Superintendent, both of whom informed Patrick's mother that, under the School District's Policy No. 233, Patrick could not enroll in the high school without a school board expulsion hearing concerning the incident at Lancaster Catholic.
School District Policy No. 233, entitled "Suspension and Expulsion,"[5] provides in pertinent part:
It is the policy of the District to give full faith and credit to the decision of another school entity suspending or expelling a student for disciplinary reasons. The District will honor unfinished suspensions or expulsions that were imposed by other school entities, and will not admit a student who moves into this District or seeks transfer from another school entity and who is subject to an unfinished suspension or expulsion. In *308 the case of a student who withdraws from another school entity in the face of an expulsion hearing where the school entity does not conclude the expulsion hearing, it is the policy of the District to give the student the opportunity for a hearing to determine whether an expulsion should be implemented.


* * *
In the case of a student who withdraws from another school entity in the face of an expulsion hearing where the school entity does not conclude the expulsion hearing, the purpose of the hearing will be to determine guilt or innocence of the charges, whether an expulsion should be implemented, the terms of any expulsion, and any questions concerning the student's residence.

(R.R. at 60a-61a) (emphasis added). Patrick refused to participate in the expulsion hearing specified in School District Policy No. 233, and, therefore, Patrick was not permitted to enroll in the School District.
On May 28, 2002, Patrick filed a complaint in equity seeking declaratory and injunctive relief against the School District, asking that the School District's "full faith and credit" policy (Policy No. 233) be declared unlawful as applied to him. On July 1, 2002, Patrick filed a motion for preliminary injunction to prevent the School District from proceeding with an expulsion hearing and preventing Patrick's enrollment in the School District based on events that occurred at Lancaster Catholic. The School District filed preliminary objections in response, asserting a failure to exhaust administrative remedies.
On August 21, 2002, a hearing was held before the trial court to address Patrick's request for an injunction as well as the School District's preliminary objections to Patrick's complaint. On August 22, 2002, the trial court entered an order enjoining the School District from conducting an expulsion hearing or preventing Patrick from enrolling in and attending regular classes in the School District.[6]
Patrick subsequently filed a motion for summary judgment on his claims for declaratory and injunctive relief, and the School District then filed its own motion for summary judgment. On December 30, 2002, the trial court entered an order granting Patrick's motion for summary judgment in full. The trial court declared the School District's Policy No. 233 unlawful and permanently enjoined the School District from proceeding to an expulsion hearing against Patrick, or preventing Patrick from enrolling in and attending school in the School District, based on events at Lancaster Catholic. The School District filed an appeal to this court from the trial court's August 22, 2002, and December 30, 2002, orders, and on March 13, 2003, the trial court filed a written opinion pursuant to Pa. R.A.P.1925(a) in support of the orders.
On appeal to this court,[7] the School District first argues that the trial court *309 erred in denying the School District's preliminary objections, based on Patrick's failure to exhaust administrative remedies. The School District reasserts its position that Patrick should not have been permitted to file a lawsuit challenging the School District's authority to enact and enforce Policy No. 233 until after Patrick had exhausted available administrative remedies before the School Board. The School District maintains that the School Board hearing would provide Patrick with an appropriate forum to raise his legal challenge to the underlying policy and give him a real opportunity to obtain the desired relief. The School District asserts that Patrick is no different than other students who face possible exclusion from school based on misconduct and warns that if the courts allow this type of collateral attack on a school's enforcement of its disciplinary policies, every student facing possible expulsion for misconduct could challenge the validity of the policy on which the expulsion is based, thereby frustrating operation of the adjudication system established by the School Code. We disagree.
The doctrine of exhaustion of administrative remedies is intended to prevent the premature interruption of the administrative process, which would restrict the agency's opportunity to develop an adequate factual record, limit the agency in the exercise of its expertise and impede the development of a cohesive body of law in that area. Shenango Valley Osteopathic Hospital v. Department of Health, 499 Pa. 39, 451 A.2d 434 (1982). It is appropriate to defer judicial review when the question presented is within the agency's specialization and when the administrative remedy is as likely as the judicial remedy to provide the desired result. Independent Oil and Gas Association of Pennsylvania v. Pennsylvania Public Utility Commission, 789 A.2d 851 (Pa.Cmwlth. 2002); Rouse & Associates Ship Road Land Limited Partnership v. Pennsylvania Environmental Quality Board, 164 Pa.Cmwlth. 326, 642 A.2d 642 (1994). However, the exhaustion doctrine is not so inflexible as to bar legal or equitable jurisdiction where, as here, the remedy afforded through the administrative process is inadequate. Independent Oil; Shenango.
In this case, the purpose of the expulsion hearing is explicitly set forth in Policy No. 233, and it does not include authority for the school board to rule on the legality of the disciplinary policy. Contrary to the School District's position, the opportunity for Patrick to go through the hearing process, with the likelihood of expulsion, and then raise the validity of Policy No. 233 on appeal, is not the remedy he seeks because it does not resolve Patrick's claim that the School District lacks authority to discipline him in the first place. See Independent Oil (holding that a "pay and appeal" remedy is not the equivalent of not having to pay at all).
Moreover, the issue here is the School District's statutory authority to act, a purely legal issue that does not require school board fact-finding or expertise. In fact, the school board is not established to handle this kind of claim or to grant the declaratory and injunctive relief sought by Patrick. See Arsenal Coal Company v. Department of Environmental Resources, 505 Pa. 198, 477 A.2d 1333 (1984) (holding that equitable relief is available to prevent enforcement of a regulation if the regulatory body has exceeded its authority; the court may enjoin an administrative agency from exercising powers not conferred on *310 it). Finally, the School District's concern about having a proliferation of lawsuits is unwarranted. Because Patrick was not enrolled in the School District at the time of the incident, Patrick is different from most other students who face possible expulsion.
The School District next challenges the trial court's finding that the School District exceeded its broad rulemaking authority under the Public School Code of 1949, Act of March 10, 1949, P.L. 30, as amended, 24 P.S. §§ 1-101-27-2702 (School Code) by developing and enforcing its "full faith and credit" Policy No. 233, which denies admission to regular classes for a transferring student facing expulsion from another school. The School District asserts that this case is all about student safety and the School District's right and duty to ensure a safe school environment, to which end, the General Assembly imbued school districts with "all necessary powers to enable them to carry out the provisions of [the School Code]." Section 211 of the School Code, 24 P.S. § 2-211. The School District asserts that the trial court's decision would improperly usurp its authority to develop effective admissions[8] and disciplinary policies, would make a mockery of school safety and would create an absurd and dangerous precedent. Although raising some interesting points, the School District's arguments ultimately fail to persuade.
Contrary to the School District's suggestion, school districts do not have inherent power to implement any policy they deem fit in the name of school safety. A school district's rulemaking authority is limited to that which is expressly or by necessary implication granted by the General Assembly, regardless of how worthy the purported goal. 22 Pa.Code § 12.3; Barth v. School District of Philadelphia, 393 Pa. 557, 143 A.2d 909 (1958); Giacomucci v. Southeast Delco School District, 742 A.2d 1165 (Pa.Cmwlth.1999). In this case, we agree with Patrick that the School District's Policy No. 233 is neither expressly nor impliedly permitted under the applicable provisions of the School Code.
In 1949, the legislature set forth in the School Code, the bounds of a school district's authority to regulate student conduct. Section 510 of the School Code provides:
The board of directors in any school district may adopt and enforce such reasonable rules and regulations as it may deem necessary and proper, regarding the management of its school affairs ... as well as regarding the conduct and deportment of all pupils attending the public schools in the district, during such time as they are under the supervision of the board of school directors and teachers, including the time necessarily spent in coming to and returning from school.
24 P.S. § 5-510 (emphasis added). In addition, section 1317 of the School Code provides:
Every teacher, vice principal and principal in the public schools shall have the right to exercise the same authority as to conduct and behavior over the pupils attending his school, during the time they are in attendance, including the time required in going to and from their *311 homes, as the parents, guardians or persons in parental relation to such pupils may exercise over them.
24 P.S. § 13-1317 (emphasis added).
Based on these general provisions, the trial court concluded that the School Code allowed school districts to discipline only those students who are enrolled in the district at the time of the incident, thereby rendering School District Policy No. 233 unlawful under the School Code. The School District, however, argues that the trial court interprets these provisions too narrowly and ignores other subsequently added School Code provisions, specifically, sections 1317.2 and 1318, that provide express and/or implied authority for Policy No. 233.

Section 1317.2
In 1995, the legislature added section 1317.2 to the School Code,[9] which provides in relevant part:
(a) Except as otherwise provided in this section, a school district ... shall expel, for a period of not less than one year, any student who is determined to have brought onto or is in possession of a weapon on any school property, any school-sponsored activity or any public conveyance providing transportation to a school or school-sponsored activity.
(b) Every school district ... shall develop a written policy regarding expulsions for possession of a weapon as required under this section....
(c) The superintendent of a school district ... may recommend modifications of such expulsion requirements for a student on a case-by-case basis.
24 P.S. § 13-1317.2(a)-(c) (emphasis added).
In 1997, the legislature enacted section 1317.2(e.1) of the School Code,[10] and made clear that a student expelled under sections 1317.2(a) and (c) could not avoid discipline by transferring to another school. That section of the School Code provides:
A school district receiving a student who transfers from a public or private school during a period of expulsion for an act or offense involving a weapon may assign that student to an alternative assignment or provide alternative education services, provided that the assignment may not exceed the period of expulsion.
24 P.S. § 13-1317.2(e.1) (emphasis added).[11]
According to the School District, a common sense reading of these provisions mandates that a student, such as Patrick, who withdraws from school to avoid expulsion should be treated no differently than a transfer student who commits the same offense but is officially expelled. The School District claims that the fact that Patrick was "constructively," rather than "formally," expelled should not foreclose the School District from exercising its authority under section 1317.2(e.1) because this would result in a substantial penalty *312 for some students guilty of serious offenses, and no penalty for others guilty of the same offense. The School District also points out that to permit such differential treatment would allow a student to engage in violent misconduct at one school, withdraw, and enroll in another school without question or consequence, jeopardizing student safety.[12]
The School District also contends that when section 1317.2(a) is read in pari materia with section 1317.2(e.1), it provides clear authority for Policy No. 233. The School District notes that section 1317.2(a) applies to a weapons offense by any student on any school property, whether or not located in the school district where the student wishes to enroll. The School District then reasons that, because section 1317.2(e.1) refers to a transfer from a private school, sections 1317.2(a) and (c) must be read to mandate a one-year expulsion, or some other disciplinary action, for students, such as Patrick, who bring weapons on private school property and subsequently seek enrollment in a public school district.
However, it is too large a leap to say that these provisions give the School District express authority to proceed with an expulsion hearing against Patrick for the incident at Lancaster Catholic. The authority of a school district to expel or otherwise discipline any student who brings a weapon on any school property must be read in the context of other School Code provisions, including sections 510 and 1317; there is no statutory or case law support for the School District's broader interpretation of section 1317.2(a). As for 1317.2(e.1), this provision cannot provide express support for Policy No. 233 because Patrick was not expelled from Lancaster Catholic. Section 1317.2(e.1) does not apply to allow the School District to independently bring expulsion proceedings against Patrick where Lancaster Catholic chose not to do so.
Moreover, these provisions do not necessarily imply School District authority for Policy No. 233. The legislature was not silent on the subject of discipline for transferring students; pursuant to section 1317(e.1), a school district that receives a student from another school during a period of expulsion under 1317(a) and (c) may assign the student to alternative placement during that period. This provision is far narrower than Policy No. 233 and underscores the lack of implied authority for the broader powers assumed by the School District in that Policy. To the extent that the School District is correct that the trial court's interpretation creates a loophole for students like Patrick who leave in the face of expulsion, that is a matter for the legislature to consider; we cannot rewrite the statute.

Section 1318
The School District also claims that Policy No. 233 is expressly or impliedly authorized by the grant of authority in School Code section 1318, 24 P.S. § 13-1318, which provides in relevant part:
Every principal or teacher in charge of a public school may temporarily suspend any pupil on account of disobedience or misconduct.... The board may, after a proper hearing, suspend such child for such time as it may determine, or may permanently expel him.
24 P.S. § 1318.[13]
The School District points out that this section does not restrict a school district's authority to offenses committed by a student during attendance in the school district. *313 While admitting that the courts have not yet addressed the precise situation here, the School District notes that the courts consistently have interpreted section 1318 to grant school districts broad authority beyond that expressly authorized in sections 510 and 1317 of the School Code. As examples, the School District cites numerous cases in which courts upheld school policies which resulted in the discipline of students for purely out-of-school conduct, where the court determined that the policy was reasonably related to the school's mission to foster an atmosphere conducive to learning. The School District contends that this deference to school district disciplinary authority is even more relevant as applied to Policy No. 233, because to allow students, such as Patrick, who sold drugs and brought a weapon to school, immediate access to regular public school classes without any administrative assessment of the facts and danger, would both undercut fair and consistent enforcement of disciplinary rules and jeopardize school safety.
Finally, the School District reminds us that this case is not about denying Patrick admission to regular classes, which, under Policy No. 233 would be a decision made by the School Board after a proper hearing. According to the School District, Policy No. 233 falls squarely within its statutory authority under section 1318 to ensure safe schools, and by invalidating that Policy, the trial court has improperly usurped the school district's role to make decisions concerning students and school safety.
Despite their strong rhetoric, neither the School District nor the Amicus Curiae can point to a statutory provision or case that gives the School District the authority it claims under Policy No. 233. The legislature has set out specific statutory provisions that give school districts broad authority to develop and enforce rules to regulate student conduct, including possession of drugs and weapons, and ensure school safety.[14] The express limitation on this authority, however, is that the school districts can discipline only those students who are enrolled in the district and under the district's supervision at the time of the incident. 24 P.S. §§ 5-501 and 13-1317. The School District has not provided one case where a court construed the School Code to permit a school district to discipline a student who was not enrolled in the district at the time of the incident.
It is true that a court is not supposed to be a "super" school board and substitute its own judgment for that of the school district; therefore, in the absence of a gross abuse of discretion, courts will not second-guess school policies. Flynn-Scarcella v. Pocono Mountain School District, 745 A.2d 117 (Pa.Cmwlth.2000). However, courts can intervene if schools act outside their statutory authority. Giacomucci. A mandatory preliminary injunction interfering with a school board's discretion is proper where the action is based on a misconception of the law. Save Our School v. Colonial School District, 156 Pa. Cmwlth. 671, 628 A.2d 1210 (1993). Because that is this case, we affirm.

ORDER
AND NOW, this 3rd day of October, 2003, the order of the Court of Common *314 Pleas of Lancaster County, dated December 30, 2002, is hereby affirmed.
NOTES
[1]  The parties filed a Joint Stipulation of Undisputed Facts, with accompanying Exhibits A-H (R.R. at 23a-69a.)
[2]  Diocese Policy No. 5137, entitled "Drugs and Alcohol," provides, in relevant part:

The selling ... or supplying of illegal drugs... [or] mood altering substances ... is an extremely serious situation which is to be reported to the parents/guardians of a student and ordinarily to law enforcement officials as well. If, in the judgment of the Principal, there are no extenuating circumstances, a student committing such an offense will be expelled from the school.
(R.R. at 39a.)
The "Lancaster Catholic High School Drug and Alcohol Guidelines" provide, in relevant part:
In compliance with the policy of the Diocese of Harrisburg, any student who unlawfully attempts to distribute or sell drugs ... or any mood altering substances ... will be expelled....
Expulsion may be permanent. If the expulsion allows for a parent appeal, a formal hearing by the Judicial Committee of the Board of Directors may be convened at the request of the parent(s) or guardian(s) of the student in question.
(R.R. at 46a, 48a.)
[3]  Diocese Policy No. 5137.5, entitled "Weapons or Threats of Violence," provides, in relevant part:

Any student in possession of a weapon will be immediately suspended from the school. If, in the judgment of the Principal, there are no extenuating circumstances, the student shall be expelled from the school.
(R.R. at 37a.)
Lancaster Catholic's written policy prohibiting students from possessing weapons in school, including any knife, states, in relevant part, that "possession of a weapon, no intent to use" is a violation of the policy that results in (1) report to police, (2) confiscation of the weapon, and (3) in-school suspension. (R.R. at 54a.)
[4]  By letter dated April 12, 2002, Lancaster Catholic wrote to the School District's principal confirming that Patrick "was asked to leave" Lancaster Catholic because of the drug and weapons incident. (R.R. at 56a.)
[5]  The School District also had its own "Weapons" and "Drug Awareness" policies. The Weapons policy provides that "If a School District receives a student who transfers from a public or private school during an expulsion period for an offense involving a weapon, the District may assign that student to an alternative assignment or may provide alternative education, provided the assignment may not exceed the expulsion period." (R.R. at 63a) (emphasis added). The School District and Patrick's family tried to reach an agreement regarding the possibility of Patrick waiving an expulsion hearing and receiving alternative educational services; however, they were unsuccessful.
[6]  On August 23, 2002, Dayspring Christian Academy notified Patrick that it had an opening in its tenth-grade class and was willing to enroll Patrick. Patrick started attending Dayspring on August 28, 2002. After learning of Patrick's enrollment at Dayspring, the School District wrote the trial court and requested that it vacate the preliminary injunction. Patrick agreed to vacate the preliminary injunction but took the position that the claim for declaratory and permanent injunctive relief was not moot and should be decided by the trial court.
[7]  Our scope of review of a trial court order granting summary judgment is limited to determining whether the trial court committed an error of law or abused its discretion. Downingtown Area School District v. International Fidelity Insurance Co., 671 A.2d 782 (Pa.Cmwlth.1996). Summary judgment may be granted only when the moving party demonstrates that there are no genuine issues of material fact and the moving party is entitled to favorable judgment as a matter of law. Id.
[8]  State Board of Education Regulation 11.41(a), 22 Pa.Code § 11.41(a), provides that "Each school board shall adopt policies concerning district child ... admission ... as necessary to implement this chapter." According to the School District, its "full faith and credit" policy, promulgated under this regulation, is a lawful and appropriate admission policy designed to ensure the safety of a school by providing a means to exclude dangerous students.
[9]  Added by section 4 of the Act of June 30, 1995, P.L. 220, as amended, 24 P.S. § 13-1317.2.
[10]  Added by section 6 of the Act of June 25, 1997, P.L. 297, 24 P.S. § 13-1317.2(e.1).
[11]  School districts are required to maintain student disciplinary records and transfer a student's disciplinary records to a student's new school. Sections 1304 A(a) and 1305 A of the School Code, 24 P.S. §§ 13-1304 A(a) and 13-1305 A. The School District maintains that these provisions reflect the legislature's acknowledgment that school districts have a right to know a student's disciplinary history to ensure safe schools, including the possibility of excluding students who committed serious offenses in other schools. However, we disagree that these sections can be read to authorize Policy No. 233.
[12]  However, as Patrick points out, there is nothing to preclude a school from proceeding with expulsion proceedings even after a student has withdrawn from that school.
[13]  22 Pa.Code § 12.6(a) requires the board of school directors to define and publish the types of offenses that would lead to exclusion from school.
[14]  In this regard, we note that, once enrolled in the School District, Patrick would be subject to all the applicable disciplinary rules; therefore, as Patrick points out, there is no reason to assume that his admission would create the grave danger of which the School District warns.
