The Act prohibits "execution" of the law, which to me implies use of police powers. I find it highly unlikely that merely investigating a crime would be considered a violation.
The Act doesn't so much make military enforcement of laws illegal, so much as makes its illegality the default, requiring a statutory basis to make it legal.A primary candidate for such basis is the Insurrection Act.. One portion of this reads:
§253. Interference with State and Federal law
The President, by using the militia or the armed forces, or both, or by any other means, shall take such measures as he considers necessary to suppress, in a State, any insurrection, domestic violence, unlawful combination, or conspiracy, if it—
(1) so hinders the execution of the laws of that State, and of the United States within the State, that any part or class of its people is deprived of a right, privilege, immunity, or protection named in the Constitution and secured by law, and the constituted authorities of that State are unable, fail, or refuse to protect that right, privilege, or immunity, or to give that protection; or
(2) opposes or obstructs the execution of the laws of the United States or impedes the course of justice under those laws.
While a strong argument can be made that the legislative intent was not to allow siccing the Army on a lone gunman, a literal reading does seem to allow using the military. Presumably, "domestic violence" doesn't mean the current usage of violence within an intimate relationship, but rather is in contrast to conflicts involving foreign powers, so a mass shooting would qualify (although one could argue that once the shooting ceases, there is no longer any current domestic violence). And someone refusing to surrender to the authorities could be considered to be opposing the execution of the law.
Courts generally give broad deference to the determinations of other branches of government, as shown in the case of Martin v. Mott, 25 U.S. 19 (1827), which found
The authority to decide whether the exigencies contemplated in the Constitution of the United States and the Act of Congress of 1795, ch. 101, in which the President has authority to call forth the militia, "to execute the laws of the union, suppress insurrections, and repel invasions" have arisen is exclusively vested in the President, and his decision is conclusive upon all other persons.
So it's hard to imagine the courts second-guessing the President's decision to invoke the Insurrection Act, even in cases where the President's arguments strain credulity. On the other hand, this deference to other branches of government also means that it's hard to imagine, were the Congress to impeach the President over an abuse of the Insurrection Act, that the courts would entertain an argument by the President that their actions were in accordance with the Insurrection Act and therefore not a valid basis for impeachment.
Of course, this still leaves the issue of members of the military enforcing laws not at the direction of the President, but using violence against American civilians without orders from higher up the chain of command would generally put one in a precarious condition regardless of the Posse Comitatus Act.
Note: much of this answer draws from the following article: https://www.brennancenter.org/our-work/research-reports/insurrection-act-explained .