Archive for March, 2007

Creating Windows Server Print Queues From the Cmd Line

I’d been given the task of setting up two Windows print servers with a touch over 300 print queues. The queues would be split between the two servers, with one holding all the even numbered queues (they’re named things like CityA094 or CityB031) and the other the odd names.

Well, it gets rather boring doing this via the GUI. The process of creating the TCP/IP ports, then the queues and entering the location information takes a fair number of clicks and typing. With only the queue name, location and description changing between each, it’s a good task for a script.

You need three VBS files that already exist on a Windows XP system, a target server and a logon to that server. The three VBS files are prncnfg.vbs, prnmngr.vbs and prnport.vbs which should be in your (windows root)\system32 folder.

Then use the following in a batch script to call them to do the work. It’ll create the port (using RAW mode), then the queue and then configure the queue.

WordPress really doesn’t like the script syntax and is getting a little confused so here it is in a text file: AddPrinter Script.

Note that I’m only using the Generic/Text driver for all queues, so the
usefulness may vary if you’ve got lots of different models.

Why Aren’t You Using FireBug?

I’ve been using the Firefox browser addon called FireBug for a while now and am amazed at how helpful it is. If you’re a web developer, and especially if you use JavaScript and AJAX methods, you should be using it.

For example, while developing I like to add in timers to PHP based pages to show how long things are taking. This way if a SQL statement needs some fine-tuning or a change slows things down I can see it happen. FireBug extends this to the entire page and the HTTP traffic. Here’s what happens when I load a page that has a few JavaScript calls, small images and a single CSS link in it,

Straight away it’s obvious what’s taking up the bulk of the time – those two library calls. Once I take those out of the equation the load time drops to under a second. And through all this the PHP timer function only shows me how long the server-side work is taking.

With FireBug I know who (in a geeky code way) is doing what and with who and I can act on it. Now that’s helpful.