Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, April 21, 2010

how to publish samba printers in active directory

I'm running a cups print server on debian and sharing the printers for the windows client using samba! although printers are being added per machine at login time automatically, i still wanted to have the printers listed in the active directory, so what to do ? i googled this and quickly found this link! which suggests that doing:

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.

Thursday, May 7, 2009

Printers ... Printers ... Printers ... Windows & sharing

This is the me, from hell ... i'm now responsible of managing printers in a windows environment ... so one of the tasks is deleting a printer tcp port ... now i found this command line tool to do it ...:


cscript prnport.vbs -d -s [servername] -r [portname]


replacing the server name and the port name with appropriate values, usually the port name is IP_XX.XX.XX.XX, where XX.XX.XX.XX is the IP of the printer.

Tuesday, August 12, 2008

Windows for Linux Administrators I

I've never been a fan of M$ Windows, but lateley im forced to deal with Windows, So since im having a lot of trouble doing even simple things, i've decided to write a few notes i've learned that would help those who are familiar with linux to administrate windows machines, but you should also know that im not an expert in either systems, any any information provided here is my own interpretation of similarities between these two systems.

First, lets put a list of commands and their equivilent that i learned recently, i wont be talking about "dir" and "rem".

Starting with the ugly "cmd" of windows, we can see that we can use the command "set" to display environment variables, which is the same as what we have in Linux! nice! thats a good starting point. and and interesting example of how things might be a little diffrent, lets try to print the current directory, in linux we would simply type pwd, in windows, you'll do "echo %CD%", where %CD% is an environment variable that holds the "Current Directory".

Variables in windows are put between percentage signs , %VARNAME% and are not case sensetive.

Now the first thing i wanted to do was listing users i have and gather info about them, but in my case, the machine i have access to, via rdestop, is an Active Directory server, which i hope to be able to switch to SAMBA 4 when the later is ready ... so ... how do we do that in active directory?

the command to do so is called dsquery, it stands for "Directory Service Query" and is one tool from the "Directory Service" tools suite that comes with windows 2003, i dont know about older versions.

Now ill try to see how it works, so i look at :
dsquery /? | more


Looks unixish ... heh :), reading a little there i managed to list users (first 100) using the command:
dsquery user


and then i filtered out myself using the command find! an interesting tool that provides similar functionality to some unix tools. lets suppose my name was "Edward Saeed", i do :
dsquery user| find "Edward Saeed"


but note that you Have to use the quotes, and the string IS case sensitive ... inconsistency ... i belive ... but i could use /I to make it case insensitive!

So now we know that find "something" is similar to the "grep" command in unix!

reading find /? shows that find can also count lines! so find /C "something" is equivilent to "grep "something" | wc -l" . thats good to hear ... who can live without grep and wc :)

Thats it for today :), i'll be packing and hitting the road .

Maybe next time ill be trying to rewrite a few bash scripts in this windowish fashion.

;)