Code:
if primapstate("\\server1\printer1")
  $RC=delprinterconnection("\\server1\printer1")
  if not primapstate("\\server1\printer2")
    $RC=addprinterconnection("\\server1\printer2")
  endif
endif


Primapstate does all the work, it checks if it exists and saves the time of reinstalling drivers that are already there. You should consider using it for all your addprinterconnections.