168 Undead
You will need:

A level 20 sorcerer able to cast Animate Dead.
A Ring of Spell Storing.
Someone other than you who can cast Animate Dead.
Animate Dead raises 2×(spell level)-5 or maintains control over 2×(spell level)-2 undead. We would have problem where we are forced to use a whole spell slot to maintain control over a single zombie because if we create another one instead, we lose control over the old one. By using Ring of Spell Storing with our helper we won't have a problem of growing our horde, so we can concentrate on controlling it.

Using all available spell slots per day we will be able to control:

3rd level: 3×4 = 12 undead
4th level: 3×6 = 18 undead
5th level: 3×8 = 24 undead
6th level: 2×10 = 20 undead
7th level: 2×12 = 24 undead
8th level: 1×14 = 14 undead
9th level: 1×16 = 16 undead
For total of 128 zombies or skeletons.

After that we use class features to improve our army.

A Sorcerer can turn all his 1st and 2nd level spell into 10 more spell points and create 4 more 5th level spell slots per day with Flexible Casting for 4×8 = 32 more undead.
If we would have to stick to a single short rest, we would have to ditch creating a single 5th level spell slot and create two 4th level slots instead for total of 3×8 + 2×6 = 36 undead.
If we would be able to take at least 2 short rests per day, we would accumulate enough sorcery points with Sorcerous Restoration to create another 5th level spell slot for total of 40 undead.

A necromancer wizard can use Arcane Recovery to restore 2 5th level slots per day, make Animate Dead one of his Arcane Mastery spells and use it daily and use Command Undead feature to bind one more undead to his will for total of 2*8+4+1 = 21 more controlled undead.


[Linked Image]