net ads printer publish -Uadministrator%secret
would do the job!
well, it did not for me :S , it fails silently with return value of 255 ! arg ... why does it fail silently ?? WHY! why cant it scream out some error message !! , anyway, adding -d with an appropriate value ( i used 3 ) made it more meaningful and i got some useful message:
Unable to open printer \\localservername\printername, error is WERR_INVALID_PARAM.
after fiddling around for a while, it seems that this error is caused because there is no driver published for this printer, so i used the following command to fix this:
cupsaddsmb -U dom\user printername
now retrying the net ads command mentioned earlier got me a diffrent error !
Unable to do enumdataex on \\cupsserver\printername, error is WERR_INVALID_PARAM.
apparenly it was not really useful, i could not find any solution looking this up in google, any body knows ? anybody knows? please let me know !
anyway, after few hours of looking this up and finding nothing useful, i found a diffrent syntax (apparently older one) to try things out, its:
net rpc printer publish publish printername -U dom\\user
this was also useless ! tried various combination of options fro net rpc and net ads, got me anothe bunch of various errors/messages such as:
ads_publish_printer: Object class violation
all lead me to nowhere ... sadly :(
then, this post caught my attention! although not directly relevant! i though i might try to things from the windows server !
So i went to the windows machine, logged in a privileged user, start -> run -> \\cupsservername -> printers and faxes -> printer name -> right click -> properties -> sharing -> checked list in directory check box -> apply -> tadaaaa .
Now its published ! i found it awful that i could not do it using samba tools :( and i will lookup a way to do it in batch now with windows command line/script.