In command prompt you can get the error code like this:
 Code:
net helpmsg 1722

The answer would be: "The RPC server is unavailable."
The reason you get a 0 in front with your code is because 0 is what is returned by AddPrinterConnection.
As Allen pointed out, you have to catch that with a variable, in his example $RC.
In Kix @ERROR returns the error code and @SERROR returns the error description.

The likely problem seems to be that the $printserver variable doesn't contain the right name.