For the class $T(M)$ of nilpotent Lie algebras which are isomorphic to upper triangular $M\times M$ matrices, the invariants are explicitly given (by working in the coadjoint representation). There are $[\frac M2]$ independent polynomial invariants.
In an earlier paper [J. Phys. A, Math. Gen. 31, 789-806 (1998; Zbl 1001.17011
)] the authors studied the class $L(M,f)$ of solvable Lie algebras which have $T(M)$ as their nilradical and $f$ $(1\leq f\leq M-1)$ additional linearly nilindependent elements. Here, all invariants for $L(4,f)$ are given. They cannot all be chosen to be polynomials. For arbitrary $M$ and $f=1$ and $f=M-1$, invariants are given (without a proof of their completeness).