Shanahan, playing alongside Scott Gomez and Nigel Dawes, scored on a pair of snap shots from either side of the Islanders zone in the middle period.
The first came at even strength from the center of the right circle, off a cross-zone feed from Gomez, at 1:48 to give the Rangers a 2-1 lead. After Martin Straka pushed the advantage to two goals 2:04 later, Shanahan connected again with 5:13 left in the frame to make it 4-1.
Gomez had a goal and assist, and Dawes helped set up all but Martin Straka's tally during the Rangers' four-goal second period. Petr Prucha scored an empty-net goal with under a minute remaining in the game.
Trent Hunter, one of the few name players on the ice for the Islanders, scored a power-play goal with 4:53 remaining to make it 4-2.
The Islanders started a stretch of three preseason games in three nights without coach Ted Nolan, who missed the game due to a death in the family. New York will play New Jersey in Bridgeport, Conn., on Saturday before wrapping up its exhibition schedule at Boston on Sunday.
The Rangers were without forwards Jaromir Jagr (hip) and Sean Avery (groin), who are also expected to miss New York's preseason finale Saturday at Philadelphia.
Chris Simon, who was part of several skirmishes Monday night during the Islanders' fight-filled victory over the Rangers, also sat out. He still has five regular-season games left on a 25-game suspension he received last season for a two-handed, stick-swinging attack against the Rangers' Ryan Hollweg.
Once the rematch got out of hand, the gloves did come off a few times as is often the norm in preseason games.