Try this, First drain the source tank, make sure it is EMPTY, ... Many tanks have a bottom drain,, Mine is about 1-1.5 inch up the side so several gallons remain in the tank (Stupid design) I finally sucked it out with a shop vac (WET-DRY)
Now refill, add a half to a full cup of BAKING SODA.. Yes BAKING SODA
Purge the lines. Disconnect the water INLET line from the solenoid and run, as you put it, several gallons through, also drain and flush the water heater and all the other lines (Run gallons through)
Re-connect the solenoid supply line and cycle the ice maker manually.. Cycle it again Then disconnect the solenoid outlet line and blow air through it, Be prepared to mop up some spill in the freezer, Turn freezer on and let it freeze.
Drain main tank (no need to vacuum it out) and refill with fresh water, Re-purge solenoid inlet line as before, purge sink lines, Don't worry about toiilet lines on this trip.
Home is where I park it!