Link to home
Start Free TrialLog in
Avatar of jdff
jdff

asked on

Printer Install at NETLOGON needed.

I was wondering if someone can help me add some commands to the netlogon file in order to remove 2 printers from the old file server and to install 2 new printers that are shared in the new file server. We are running a 2008 domain controller.

Thanks
-JD
Avatar of arnold
arnold
Flag of United States of America image

Not sure I understand what you are after.

You would use the print manager admin tools on the print server, unshare the printers you want removed, while adding the new printers and then deploying them.

Do you gave a user login script that using batch, vbscript, powershell to install/add printers to the workstations?
Avatar of jdff
jdff

ASKER

I need to use a command to remove 2 printers from the local workstation which are being shared by the server, if unsharing the printers from the server will automatically remove the printers from the workstation then, I'm ok and no need to bother with this. Now I need a command to connect to 2 new printers at another server, I intend to introduce these command into the logon script inside the NETLOGON folder which use batch format.
On the workstation there are vbscript and powershell or using wmic to remove the printers.
Using computer management, you can connect to the workstation and unshare those printers, not sure you can delete them remotely,

IMHO, presumably the other workstations rely on those printers, so the first step would be to deploy the new printers first using GPO and gpp. And only after that deal with removing the ones.

Are you looking to deploy the new printers on a per user or per computer basis?
You can achieve this using GPP (Group Policy Preferences). Here is an article i put together for these frequently asked questions  

 https://www.experts-exchange.com/articles/11321/Deploying-Printers-using-Group-Policy-Preferences.html
You can also remove printers using GPP as long as you can map to them.
I am uncertain I understand. Why do you not deploying the printers from the server to which they connect but rather seem to share the printers on serverA and then on serverB map the printers and share them from ....

Network printers can be loaded on multiple servers and deployed.  This way the transition when one server is decomissioned without it with minimal impact on the user through the changes of the source of the deployed printers ahead of time.
Avatar of jdff

ASKER

Arnold, the 2 printers are shared on 2 servers, old server and new server, old server is going away, so all the computers pointing to old server has to point to new server now, got it? I need to remove the printers pointing to the old server from the workstations and then install the printers shared at the new server. I'm sure there is a NET command somewhere to connect the new printers, I do not want to use any GPOs, I want to add the commands to the logon script for one day, have all the computer to boot and accept the commands and then remove the commands. Way better than dealing with broken GPOs.
Avatar of jdff

ASKER

Here it is, I've found how to connect it but I don't know how to tell to remove the old ones yet.


rundll32 printui.dll, PrintUIEntry /in /n \\newserver\printer1
rundll32 printui.dll, PrintUIEntry /in /n \\newserver\printer2
Wmic printer where "name in " delete

I believe I listed the possibilities, the application of the removal depend on how they are deployed.
If the printers are add when the user logs in, commenting out the logon script will mean that the printer will not be attached.
When he user logs do they get an error that the printer already exists?

If not mistaken, /delete is an option to the rundll32 printui .

I would suggest you get away from the way you currently manage the printers and use the print manager, GPO, gpp route to avoid such issues in the future.

Depending on the printers, are those incorporated into windows or you have to include driver install?

Which way do you want the printers deployed per user or per computer, per computer the drivers and the printers will be install with system level permission so no issues there, if you use per user, the users will likely not have rights to install drivers if not included with the OS.

I'll check what rundll32 ....printui delete directive is.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jdff

ASKER

Would you know what switch to use in order not to show an error message if it can't find the printer to delete?
You can trigger the removal of all using the * option

Rundll32.exe printui.dll,PrintUIEntry /dn *

This removed the connection only.
Test on one workstation begone hand since 2003R2 used GPO with print manager to deploy versus the logon script and the mechanism you use.

Once removed, the logon script need only run once.

wmic printer list status is one command line that will list printers. And this could be used to feed the next checking if it matches the pattern to feed the removal ......
Avatar of jdff

ASKER

I've already tested, it works, but if ran twice it returns an error message to the user, I was wondering is there is a switch to suppress such an error message????
What do you mean run twice?
You only need one line to remove all network printers.
Avatar of jdff

ASKER

Correct, but I intend to introduce these commands into the logon script, so if the user reboot the computer twice tomorrow, they will face with a error message trying to remove the printers which has been removed already during the first boot!
Avatar of jdff

ASKER

I'm trying to suppress the error message if case the command does not find the printer, also, not every computer in the network may have both printer installed, so the error message may happen that way too.
You could add the /q switch to suppress notification to user.
Avatar of jdff

ASKER

let me test it
Avatar of jdff

ASKER

beautiful it works!
Avatar of jdff

ASKER

It works perfectly.
There is a switch to remove the printers if they are deployed on the computer level /gd versus per user.

Take a look at the link to the rundll32 posted earlier it includes the various switches ......

If you are satisfied with the way it, glad I could help.
I know you accepted a solution, but did you look at leveraging GPP. If not I would recommend it. It takes a lot of the routine scripts that windows domain admins are trying to do on a daily basis.

GPP gives you granular control on how each option is supposed to deploy and set.
Avatar of jdff

ASKER

Thanks yo_bee, but I had intended not to use GPOs for this project.
ok.
GPO's are your friends when it come to managing Domains.
Using a gpo you can run the removal script as a logout script for the user or a shutdown script for the computer account.
On login/startup printers are deployed, on logout/shutdown printers are removed.