The consequences for the employee depend upon the nature of the offense.
The general rule is that anyone who participates in carrying out a tort or crime is liable, even if it was done on behalf of an employer and at their direction, but that an employee working on behalf of a disclosed employer is not liable for any breach of contract that results.
The employer has liability in all of those cases that is called vicarious liability for everyone acting as its agent or employee within the scope of their employment or agency.
But being an employee who is part of the chain of command doesn't necessarily give rise to liability.
For example, suppose that the top management of an entity employer directs a middle manager to get something done, and the middle manager tells the direct manager to get that thing done, and then the direct manager directs the employee to get it done by breaking the law in a tortious manner, rather than lawfully. The entity employer has vicarious liability for the actions of the employee who broke the law, the employee who broke the law probably has liability, and the direct manager might as well for personally directing an employee to break the law. But the middle manager and top managers probably do not have personal liability for the wrongdoing of the rank and file employee and the direct manager that directed the rank and file employee to break the law.
In the case of statutory violations, it turns on the language of the statute (although, if a statute creates a private cause of action it is often possible to sue an employee for civil conspiracy to commit a statutory tort that an employer has primary liability under).
There are some exceptions to the general rule, that usually pertain to "business torts" and "white collar crimes".
For example, a notable U.S. Supreme Court case held that if a company makes a false statement of fact in a disclosure submitted to the Securities and Exchange Commission (for the purpose of reliance upon it by all investors dealing in the company's stock) in the name of the company only, that the attorneys and company officials and employees who drafted the disclosure statement do not have any legal responsibility for the misstatement made on behalf of the company in its authorized statement in its own name (contrary to the usual common law rule that someone who participates in carrying out a fraud on behalf of an employer has joint and several liability with the employer for damages caused by the fraud).
On the other hand, knowingly putting a false dollar amount on an expense report resulting in an intended overpayment of the employer would probably give rise to common law fraud liability on the part of the employee.
There can also be exceptions based upon the elements of the crime involved.
For example, one of the elements of defamation liability is publication of the defamatory material, and merely taking dictation of and mailing a letter signed by the employer containing a defamatory statement prepared at an employer's direction would not normally sufficient to establish publication for purposes of defamation law by the employee typing it up and mailing it. Similarly, the postal employee delivering the letter wouldn't have engaged in a defamatory publication despite delivering the letter to the person to whom the defamatory statement was published.
Similarly, some environmental crimes and regulatory violations are defined in such a way that only an entity employer can be guilty of them, particularly crimes of omission (e.g. the failure of a licensed point source emitter to file a report of an emission in excess of the amount allowed by an environmental regulation, or the failure of a mining permit company to restore property mined to its original condition).
One question the OP appears to single out in particular are copyright infringements (and presumably patent infringements and trademark infringements) by an employee on behalf of an employer. And, in this area, I don't know the law well enough to provide an answer in that particular case without substantial additional research.