I don't get it
Every shared printer can only be added once. If it is added a second time, it overwrites the existing one.
I presume that
 Code:
SHELL "CMD.EXE /C rundll32 printui.dll,PrintUIEntry /in /n\\A01\X7665FIN /q"

does the same as
 Code:
$RC = AddPrinterConnection('\\A01\X7665FIN')

PriMapState helps to verify if the printer has been added before to prevent that the printer is added over and over again.