I have a startup policy that installs printers and runs a script that parses through all smb printers to run that command. I might have even found it here somewhere.
edit:
There we go: https://jamfnation.jamfsoftware.com/discussion.html?id=4075
lpstat -p is probably what you're looking for.
It lists all the mapped printers on a system, including the state, such as idle, enabled, disabled, etc.
A script to loop through everything from the command:
lpstat -p | awk '{print $2}'
may do what you want.
I would use the command posted by mm2270, something like this
#!/bin/sh
for printer in $(lpstat -p | awk '{print $2}')
do
lpadmin -p $printer -o auth-info-required=negotiate
done
I followed the link that barnesaw posted, made the launchagent and the script... but I can't seem to tell if it's running. I reset the print system and deleted the drivers. but the only way I was able to get a response was when I had the permissions messed up on the launchagent and it prompted with ...
4/25/13 8:54:36.400 AM launchctl[8934]: launchctl: Dubious ownership on file (skipping): /Library/LaunchAgents/com.318.cupswatcher.plist
Once I fixed the permissions of the file I don't get any more entries in the logs, and the printers still seem to prompt for credentials.
quick update -
The first time I try to pint after setting to negotiate it prints fine. Then I tried another printer (verified in the printers.conf that it also is set to negotiate), and it prompts right away.
So I tried the 1st printer again and it's now prompting.
So I did the klist and now it shows I don't have a tgt
ushofml313065:~ jwojda$ klist
klist: krb5_cc_get_principal: No credentials cache file found
So I printed a test page again… and did a klist
ushofml313065:~ jwojda$ klist
Credentials cache: API:528610587:6
Principal: jwojda@KIH.KMART.COM
Issued Expires Principal
Apr 25 11:55:35 2013 Apr 25 21:55:35 2013 krbtgt/KIH.KMART.COM@KIH.KMART.COM
Apr 25 11:55:36 2013 Apr 25 21:55:35 2013 cifs/USHOFSVMPRT01.kih.kmart.com@KIH.KMART.COM
Then I did a klist after the print job finished.
ushofml313065:~ jwojda$ klist
klist: krb5_cc_get_principal: No credentials cache file found
It looks like something is kdestroy-ing at the end of each print job. I'm not seeing this in our Lion lab environment, and I don't believe I've seen that in the few mountain lion systems we have out there.
edit:
And, of course, Apple's answer is to use OD for printing.