I had a similar problem with a printer migration script a while back, except my error code was 1008 instead of 1801. I found that the first printer I tried to map on a particular print server would fail but subsequent attempts would be successful. My work-around was to detect the error and drop into a "retry" loop. I did include an escape hatch to avoid an endless loop in cases where the error was legit. Here is my code. Also note a couple of variable used need to be defined; not included here though.

 Code:
$errcode = addprinterconnection($pshare)
$errtext = @serror
" @time - INFO: Result code " + $errcode + ": " + $errtext ?
select
   case $errcode = 0
      " @time - INFO: Added printer connection: " + ucase($pshare) + "."?
   case $errcode = 1008
      " @time - INFO: Entering add printer retry loop."?
      $printer_loop = 0
      do
         $errcode = addprinterconnection($pshare)
         $errtext = @serror
         " @time - INFO: Result code " + $errcode + ": " + $errtext ?
         if $errcode = 0
            " @time - INFO: Added printer connection: " + ucase($pshare) + " on loop " + $printer_loop + "."?
         else
            " @time - INFO: Failed to add printer connection: " + ucase($pshare) + " on loop " + $printer_loop + "."?
         endif
         sleep 5
         $printer_loop = $printer_loop + 1
      until $errcode = 0 or $printer_loop > 6
   case 1
      " @time - ERROR: Failed to add printer " + $pshare + ". Error " + $errcode + ": " + $errtext ?
      $scripterr = "yes"
endselect