If you have a set of rules that no one follows due to lack of enforcement, but on rare occasions when a rule is broken, out of convenience for the rule maker, they enact discipline for breaking that rule?
Given that you're looking for a rule that's enforced for some people but not for others, the most appropriate description for this is a double standard:
a rule or standard of good behaviour that, unfairly, some people are expected to follow or achieve but other people are not
Cambridge Dictionaries Online
As Edwin Ashworth pointed out, the definition on Wikipedia is more general, and may suit your needs better:
A double standard is the application of different sets of principles for similar situations.
The general term is selective enforcement. This covers situations where there are different reasons (some morally better / more justifiable than others) behind what on the surface may appear inconsistent practice.
In law, selective enforcement occurs when government officials such as police officers, prosecutors, or regulators exercise enforcement discretion, which is the power to choose whether or how to punish a person who has violated the law. The biased use of enforcement discretion, such as that based on racial prejudice or corruption, is usually considered a legal abuse and a threat to the rule of law.
In some cases, selective enforcement may be desirable. For example, a verbal warning to a teenager may effectively alter his behavior without resorting to legal punishment and with the added benefit of reducing governmental legal costs. In other cases, selective enforcement may be inevitable. For example, it may be impractical for police officers to issue traffic tickets to every driver they observe exceeding the speed limit, so they may have no choice but to limit action to the most flagrant examples of reckless driving.
You could say that enforcement of the rules is wholly arbitrary
not fixed by rules, but left to one's judgment or choice; discretionary:
arbitrary decision, arbitrary judgment
based on one's preference, notion, whim, etc.; capricious:
young children and their arbitrary rules for games
Webster's New World College Dictionary Copyright © 2010 by Wiley Publishing, Inc., Cleveland, Ohio.
I've heard this described as capricious, even though it doesn't exactly fit the definition.
given to sudden and unaccountable changes of mood or behavior.
"a capricious and often brutal administration"
For example, "arbitrary and capricious grading".
This happened quite frequently in the military. Often, there was some obscure rule or regulation that nobody cared (or even knew) about, but was applied vigorously to the "slackers" or "goof-offs" or those thought to be disrespectful. We called it an "attitude adjustment". It was intended to correct other, often completely unrelated behavior that those in charge did not like but could otherwise do nothing about.
This definition from Urban Dictionary describes it, the last part "let them know their place" seeming to be the most frequent reason.
The act of correcting a person for their inappropriate actions, for stepping over the line, to show your dominance over them, or to let them know their place