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
LVL 1
jdffAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
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?
jdffAuthor Commented:
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.
arnoldCommented:
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?
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

yo_beeDirector of Information TechnologyCommented:
You can achieve this using GPP (Group Policy Preferences). Here is an article i put together for these frequently asked questions  

 http://www.experts-exchange.com/articles/11321/Deploying-Printers-using-Group-Policy-Preferences.html
yo_beeDirector of Information TechnologyCommented:
You can also remove printers using GPP as long as you can map to them.
arnoldCommented:
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.
jdffAuthor Commented:
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.
jdffAuthor Commented:
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
arnoldCommented:
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.
arnoldCommented:
Using /dn will delete the printer,

Here is the info to rundll32 printui.dll use.

https://technet.microsoft.com/en-us/library/ee624057.aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jdffAuthor Commented:
Would you know what switch to use in order not to show an error message if it can't find the printer to delete?
arnoldCommented:
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 ......
jdffAuthor Commented:
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????
arnoldCommented:
What do you mean run twice?
You only need one line to remove all network printers.
jdffAuthor Commented:
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!
jdffAuthor Commented:
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.
arnoldCommented:
You could add the /q switch to suppress notification to user.
jdffAuthor Commented:
let me test it
jdffAuthor Commented:
beautiful it works!
jdffAuthor Commented:
It works perfectly.
arnoldCommented:
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.
yo_beeDirector of Information TechnologyCommented:
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.
jdffAuthor Commented:
Thanks yo_bee, but I had intended not to use GPOs for this project.
yo_beeDirector of Information TechnologyCommented:
ok.
GPO's are your friends when it come to managing Domains.
arnoldCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.