I had looked at that thread before and that's where I got the hint to use primapstate. Now for the result: if I bypass the primapstate check the printer gets deleted. So I guess primapstate doesn't like the fact that the printer have a different share name than the printer name. I did some further test with the printer name changed to match the share name and the exact same code works when the printer name is exactly the same as the share name. So I guess I will have to forget the primapstate to delete the old printer unless anyone have an idea how to fix the primapstate function \:\)