Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Print Server - Re-Mapping Everyone's Printer Ports


  • Please log in to reply
18 replies to this topic

#1 JasonBourne2

JasonBourne2

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 28 June 2016 - 01:07 PM

I have successfully migrated all printers to a new server(VM).

The only other issue i have is, keeping everyone's default printers and the printers they currently have in their "Devices & Printers". The names of the printers are staying the same. 

I want to have these ports moved over to the new server and users never knew i migrated these printers.(Scenario: Migration is done, Old print server is shut down and new one is up, user's printers that have already been added before in  "Devices & Printers" stay the same and are able to print from the printer they already had in "Devices & Printers".)

I noticed that there is an option to export printer ports in Print Management GUI. Does this apply to also keeping the same printers in the users "Devices & Printers" or is this something else?

Also, Is there a way to transfer users printer in "Devices & Printers" that are NOT set to defaults? Basically transition existing printers in "Devices & Printers" to the same ones added but essentially in the "background", they are different. The ports are pointing to the server, but i now need to point users printers back to the new printer.

How can i make this happen? It is not ideal for us to have users re-add all the printers in "Devices & Printers".


I appreciate you help.

Thank you,
Jonathan


Edited by JasonBourne2, 28 June 2016 - 01:23 PM.


BC AdBot (Login to Remove)

 


#2 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 28 June 2016 - 07:44 PM

mate you can export the printer settings and configs using this command printmanagement.msc, right click the Server and click export, reverse that when importing.

When it coems to having the same printers in control panel/ devs and prints. Thats a GPO mapping that will keep them there and you would need to point to the new server name and edit them GPO's (Use the update parameter or create to edit their current printer conenction or create a batch file to delete the registry keys under HKEY_CURRENT_USER\Printers\Connections).

Their default printers are a local setting in registry on their own PC unless you define that in the GPO.


Edited by JohnnyJammer, 28 June 2016 - 07:47 PM.


#3 neuronic

neuronic

  • Members
  • 52 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:New Hampshire
  • Local time:05:47 AM

Posted 29 June 2016 - 11:45 AM

mate you can export the printer settings and configs using this command printmanagement.msc, right click the Server and click export, reverse that when importing.

When it coems to having the same printers in control panel/ devs and prints. Thats a GPO mapping that will keep them there and you would need to point to the new server name and edit them GPO's (Use the update parameter or create to edit their current printer conenction or create a batch file to delete the registry keys under HKEY_CURRENT_USER\Printers\Connections).

Their default printers are a local setting in registry on their own PC unless you define that in the GPO.

 

100% true.



#4 JasonBourne2

JasonBourne2
  • Topic Starter

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 30 June 2016 - 11:52 AM

mate you can export the printer settings and configs using this command printmanagement.msc, right click the Server and click export, reverse that when importing.

When it coems to having the same printers in control panel/ devs and prints. Thats a GPO mapping that will keep them there and you would need to point to the new server name and edit them GPO's (Use the update parameter or create to edit their current printer conenction or create a batch file to delete the registry keys under HKEY_CURRENT_USER\Printers\Connections).

Their default printers are a local setting in registry on their own PC unless you define that in the GPO.

I have already exported the old printer config and imported it to the new server. Problem is i want the printers to stay in their "Devices & Printers" as if nothing ever happened (We have roughly 200 employees in the office, i don't want to disrupt the business and have tickets flood in about printer not working and have the team end up re-adding printers). Do you have any links with detailed information on how i can get this done?

Thank you.


Edited by JasonBourne2, 30 June 2016 - 11:53 AM.


#5 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 30 June 2016 - 06:41 PM

Well unless you get rid of the main print server the printers will stay in the devices and printers control panel mate because that is a GPO setting and like a network mapped drive it is added when the user logs on again (You know when you manually map a drive and it asks to remember this setting when logging in? Reconnect at Login).

Its stored in the NTUSER.dat or NTUSER.pol from memory.

The only thing they will see when they open a print dialog is PRINTER01 on SERVER02 (Server01 being the main one that you want to move away from).

I always run 2 print servers and 2 GC servers in each branch, one is the main server for printing but if that ever goes down i can change the GPO (They can wait the default 90 minutes for the policy to apply or logg off and on again or you can create a small batch file to issue a command like so (wmic /node:@filelist.txt process call create "gpupdate /target:user") to Update the print settings and all that will do is change the NET USE command from \\SERVER01\PRINTER01 to \\SERVER02\PRINTER01.

The printer name stays the same but the host changes, i also target printers per OU group as well.

 

EDIT: Forgot to add also, because users should not have any admin rights on each node, enable the Point and Print Restrictions on the PC to Do Not Display Warning or Elevated  Prompt. Do this for both Computer and User config mate.

This then allows them to manually map and install print drivers and allows them and the login GPO to install the driver when they login.


Edited by JohnnyJammer, 30 June 2016 - 06:42 PM.


#6 JasonBourne2

JasonBourne2
  • Topic Starter

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 06 July 2016 - 08:50 AM

Hi,

The problem is, our old servers are not GPO enabled. They are not using GPO's that are pointing at OU's, hence why I'm doing this now to implement GPO's in our new print servers. Is there a way i can actually delete the old printers from devices and printers(The old one being not GPO enabled) and basically replace it with the new printers so there isn't two printers showing, the old one and the new one in devices and printers?

Also, since the print names are the same, is there any way that i can replace and keep printer defaults? (If i deploy a printer via GPO, is there a way to set which ever print someone had as a default to apply it automatically as their previous default printer?)

Note: I have tried using the replace policy but seem to have no luck. Is there a certain process? IE: Deployed printer is in devices and printers,  create a replace policy with the new printer in the IP field and the path to replace the old printer?

In all we want to figure out how to completely delete the old printers in devices and printer, adding them will be a lot easier.

Thank you for you help.


Edited by JasonBourne2, 06 July 2016 - 10:13 AM.


#7 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 06 July 2016 - 05:35 PM

I think you are over complicating the issue mate.

First of all with the new server you are deploying them using a GPO right?

if thats true then create a GPO lets call it MapPrinters and in there create a Remove policy to delete the old printers (\\OldServer\printer01) and then simply in the same section create one that creates the new destination \\NewServer\printer01 . This will then delete the printer with the same name but points to the odkl server and then create a new printer with the same name but it points to the new server. its really easy managing printers on a GPO.

Even a VBS script is easy as well but i disable all scripting languages so no scripts work but only batch files but none are allowed to rin %appdata% etc to prevent malware.

 

Its that easy mate. Or you can use a Batch file script at logon

::Add a printer like so
rundll32 printui.dll,PrintUIEntry /in /n \\Newserver\Priner01
::Option to set default printer using batch file
rundll32 printui.dll,PrintUIEntry /y /n \\Newserver\Priner01

Also to ensure they are deleted you can also write a batch file to delete the registry entries in HKEY_CURRENT_USER\Printers\Connections using reg delete.



#8 JasonBourne2

JasonBourne2
  • Topic Starter

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 07 July 2016 - 08:28 AM

I think you are over complicating the issue mate.

First of all with the new server you are deploying them using a GPO right?

if thats true then create a GPO lets call it MapPrinters and in there create a Remove policy to delete the old printers (\\OldServer\printer01) and then simply in the same section create one that creates the new destination \\NewServer\printer01 . This will then delete the printer with the same name but points to the odkl server and then create a new printer with the same name but it points to the new server. its really easy managing printers on a GPO.

Even a VBS script is easy as well but i disable all scripting languages so no scripts work but only batch files but none are allowed to rin %appdata% etc to prevent malware.

 

Its that easy mate. Or you can use a Batch file script at logon

::Add a printer like so
rundll32 printui.dll,PrintUIEntry /in /n \\Newserver\Priner01
::Option to set default printer using batch file
rundll32 printui.dll,PrintUIEntry /y /n \\Newserver\Priner01

Also to ensure they are deleted you can also write a batch file to delete the registry entries in HKEY_CURRENT_USER\Printers\Connections using reg delete.

 

Thanks for the info. I am implementing GPO with the new server but the old one does not have GPOs deployed. Sorry, what exactly do you mean by: "create a Remove policy to delete the old printers (\\OldServer\printer01) and then simply in the same section create one that creates the new destination \\NewServer\printer01 " Which exact option is this?

I did manage to get the delete all printers working using the GPM editor with option Delete TCP/IP Printer and Share Printer. My only other pain is, figuring out which printer everyone had as their default and change their current default printer to the new printer(which is the same name), as we don't want to be flooded with tickets regarding why no one can print due to their regular printer not being set as a default. Any idea how something like this can be done? I feel as if this would be the most troublesome.

  

Thank you for your help.


Edited by JasonBourne2, 07 July 2016 - 02:47 PM.


#9 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 07 July 2016 - 05:51 PM

Ok what i mean is in the GPO you have created under UserConfig / prefs / control panel settings / printers.

In there right click and create a new Shared printer but instead of the default Update prefix use Delete.

Then simply add the server name or FQDN \\Oldserver\printer01 and with delete you dont need to make any more changes unless you target an OU group.

While you are in the same GPO, right click and create a New Shared printer but this time use the Create prefix from the drop down and now you will use \\Newserver\printer01.

Now to find what their current printer is you need to query the registry so use the folloing command (reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "device").

You could then use a for loop to skip the full path and just get the values and then re-add that key back to registry.

I would be doign that last part with a login batch fiel mate and if you need a hand with that then just ask here.



#10 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 07 July 2016 - 06:23 PM

Ok because i felt nice this is how you get the default printer of the user and change it to the new server

This exports the registry key and then changes the words "Oldserver" to Newserver so you need to edit this part.

it then imports the same reg file. use this as a login batch file on the GPO and you may need to change the location of the reg file like %temp%\DFP.reg instead of C:\temp\DFP.reg.

@ECHO OFF
reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" DFP.reg /y
powershell -Command "(gc C:\Temp\DFP.reg) -replace 'Oldserver', 'Newserver' | Out-File DFP.reg
reg Import C:\Temp\DFP.reg
exit

Edited by JohnnyJammer, 07 July 2016 - 08:43 PM.


#11 JasonBourne2

JasonBourne2
  • Topic Starter

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 08 July 2016 - 10:28 AM

 

Ok because i felt nice this is how you get the default printer of the user and change it to the new server

This exports the registry key and then changes the words "Oldserver" to Newserver so you need to edit this part.

it then imports the same reg file. use this as a login batch file on the GPO and you may need to change the location of the reg file like %temp%\DFP.reg instead of C:\temp\DFP.reg.

@ECHO OFF
reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" DFP.reg /y
powershell -Command "(gc C:\Temp\DFP.reg) -replace 'Oldserver', 'Newserver' | Out-File DFP.reg
reg Import C:\Temp\DFP.reg
exit

 

So basically, instead of creating GPO's to delete users printers and then add new ones, does this script basically install the new printers and set the old printers default as the new one that the user previously had? The only issue i have at this point is to set the users old printer default, move it over to the new printers and then have that old printer set as default with the new printer.( do you mind explaining the contect of the batch file a little deeper?)

At this point, i created the batch file above, used it as a login and nothing has changed. I have little knowledge in creating scripts. I can read them decently though. I'm a little confused in how i can get all of this to work together. Do i need to delete all the printers first, install the new ones using GPO and then have the login script run once the users logs in and out? Please elaborate into details, and if you could, would you be able to list in steps the best practice to perform what i need?

Thank you for you help, i really appreciate it!


Edited by JasonBourne2, 08 July 2016 - 11:03 AM.


#12 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 08 July 2016 - 03:38 PM

mate its literally a 2 step process.

1. Create a GPO that both deletes the old printers and then creates the new printers. The only thing that will change is the name of the server and not the printer because you have already exported and imported the printers.

2. Under UserConfig / Windows Settings / Scripts logon and off, add that above script (By creating it as a batch file) but replace the words Oldserver (Your old server you are deleting printers from step 1) and Newserver.

3. Thats it, get the user or test account to run gpupdate /force and it should ask to log out.

 

Its really that simple.



#13 JasonBourne2

JasonBourne2
  • Topic Starter

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 11 July 2016 - 11:11 AM

Hi Johnny,

I have created the batch file and have been running this: 
 

@ECHO OFF
reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" DFP.reg /y
powershell -Command "(gc %temp%\DFP.reg) -replace 'oldprintserver', 'newprintserver' | Out-File DFP.reg
reg Import %temp%\DFP.reg
exit

I have gpo's created as such when the user logs on:

Delete all printer
add the new printers from the new server
Logon script is suppose to change the old printer default to the new printer from the new server.

The script does not carry over the old defaults to the new printers. A test was done and within gpom>user config>preferences>printer the first print installed is being set as the default but the batch file is not setting my previously set default printer as the one . Any idea why? The printers are the same name.

Is it important to add the full domain of the server as shown in regedit: -replace '\\oldprintserver.domain.domain.com?', '\\newprintserver.domain.domain.com? I noticed in the registry this is how they are shown.


Update: Even after adding '\\oldprintserver.domain.domain.com', '\\newprintserver.domain.domain.com the old default printer was not updated as the new one. (ive also tried using just -replace 'oldprintserver', 'newprintserver', still doesn't add the previous default as the new one, only create the first added printer as the default).


Also, if i open run and go to :  %temp%\ i cant find "DFP.reg" 

Thank you.

Edited by JasonBourne2, 11 July 2016 - 03:27 PM.


#14 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:07:47 PM

Posted 11 July 2016 - 07:06 PM

You missed this %temp%\DFP.reg at the end of the powershell command and reg export commands mate.

@ECHO OFF
reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" %temp%\DFP.reg /y
powershell -Command "(gc %temp%\DFP.reg) -replace 'oldprintserver', 'newprintserver' | Out-File %temp%\DFP.reg
reg Import %temp%\DFP.reg
exit

Is there any reason why you double up on the domain name oldprintserver.domain.domain.com, i only use NETBIOS names when mapping printers mate.


Edited by JohnnyJammer, 11 July 2016 - 07:08 PM.


#15 JasonBourne2

JasonBourne2
  • Topic Starter

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:04:47 AM

Posted 12 July 2016 - 09:10 AM

That is how long our domain is. Unfortunately this batch is not working:
 

@ECHO OFF
reg export "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows" %temp%\DFP.reg /y
powershell -Command "(gc %temp%\DFP.reg) -replace 'printserver', 'printserver' | Out-File %temp%\DFP.reg
reg Import %temp%\DFP.reg
exit

I have set it as a log on script. Printers are all being deleted, and 4 printers are being added(they are all set to update). When the printers are added, the first one in the GPO listed is automatically created as the default and the previous server printer default does not carry over to the "new"(same) default.

Is there anyway to disable this feature, to not auto set the first applied printer as default? I don't want the GPO to automatically set the first printer added as the default.

Edit: I see in event viewer on the "system" field it states: Windows failed to apply the Group Policy Registry settings. Group Policy Registry settings might have its own log file. Please click on the "More information" link.
                                                        Event: 1085
                                                        Level: Warning

                                                        Description: This operation returned because the timeout period expired.

but when i check the actual group policy section in event viewer , it states logon script applied in 1 second.

In case this helps, im running this on Windows Server 2012 R2.

Any idea why this isn't working?

Edited by JasonBourne2, 12 July 2016 - 02:56 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users