Windows: Add samba printer at each logon

1

All,

I currently have a samba printer shared at \\%ServerIP%\Printer1 which requires credentials to connect.

Users can easily add the printer with the printer wizard. However, the printer will stop working after a day or two on Windows machines.

To combat this problem, I would like to add the printer each time a user logs on with a script. I have tried this:

echo Adding Printer1 at %ServerIP%

rundll32 printui.dll PrintUIEntry /in /n\\%ServerIP%\Printer1

echo Restarting print spooler so that printer is accessible in dialogs

start /wait sc stop spooler
start /wait sc start spooler

echo Done. Exiting...

But this doesn't work if the printer isn't already installed. How can I make a more robust solution?

Thanks!

Jay

Posted 2012-01-19T01:14:30.280

Reputation: 151

No answers