Porygon has been making splashes ever since Gen VII started. Porygon 2, as always has been a bulky Trick Room setter, while Porygon Z brings Z Conversion to the table, becoming a terrifying Sweeper in just one move. This virtual pokémon is versatile in roles and both forms can be slotted on a lot of teams.
Porygon Antivirus
Porygon-2
Item: Eviolite
Ability: Trace
-Trick Room
-Recover
-Ice Beam/Toxic
-Thunderbolt/Foul Play
Nature: Relaxed (+DEF, -SPE)
EVs: 252 HP/88 DEF/16 SATK/152 SDEF
Best suited for doubles, Porygon 2's Trick Room set hits all the right notes, being bulky enough to ensure Trick Room get's thrown up while having the coverage and versatility to deal with whatever may come in. Trick Room is the obvious crux of the set and turns the normal speed wars on its head. Recover is reliable recovery. Last moves are up to preference. Bolt Beam provides fantastic coverage and threatens many foes with its decent SATK, while Toxic and Foul Play turn Porygon-2 into a more traditional tank, wearing everything down while it recovers off and Foul Play threatening any Physical Sweeper that comes in with their own ATK stat. Toxic is more suited for singles play, FYI.
Item is Eviolite, which is mandatory for Porygon-2 to wall and Trace can copy all sorts of delicious abilities, like Volt Absorb, Water Absorb, Intimidate, Levitate, Magic Bounce, etc. EV spread mixes bulk to handle most threats.
Other Options
Porygon-2
Magic Coat -As noted with Carbink, Magic Coat is fantastic for tanks, reflecting Taunt, Entry Hazards, Toxic and so forth.
Telekinesis -Pair up with something that has inaccurate attacks and watch as they hit every time (Inferno Chandelure, Zap Cannon Magnezone, Dynamic Punch Buzzwole, etc.)
Gravity -Less accurate Telekinesis while making everything vulnerable to ground moves and entry hazards.
Porygon-Z
Shadow Ball -Option for a Z-Conversion set and Shadow Ball makes Porygon-Z immune to Fighting type moves, which is good for luring stuff in... But makes Porygon-Z vulnerable to Sucker Punch and Pursuit trapping.
Trick -Can run a Scarf or Specs set, but the overall bulk provided Z-Conversion is usually better.
Nasty Plot/Agility -Again outclassed by Z-Conversion because Porygon Z needs both, not one or the other and with its frailty, it is hard getting the time to setup both moves.