• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

Keep Users Default Printers after a Print Server Migration

We are migrating all TCP/IP Printers from one server to a new Server 2008 box.  Is there a way that can change all printers from the old server to the new server AND keep the users current existing default printer set (Now located on the new server).

I hope that is making sense....
0
jharen
Asked:
jharen
  • 6
  • 4
1 Solution
 
Vishnu KiranCommented:

Hi,

Yes there is a procedure which involves running a script at logon to map users default printer from old to new.
Please visit the below link which talks about the sript:

http://windowsitpro.com/article/articleid/40882/print-server-migration.html

After the print server migration, a login script could be written to find printers installed on the client computer that have changed and replace the old printer connection with the new printer connection. With the correct logic, a login script could detect the users default printer, remove the old printer entry, replace it with the corresponding new printer entry, and finally set the new printer definition to be the default printer for the user.

Also you can download the following document "Migrating and Consolidating Print Servers" from Microsoft.

download.microsoft.com/download/e/7/7/e770d9f8-70e3-4850-9c1c-2dd1bb184957/PrintServerConsolidation.doc



Regards,
Vishnu.
0
 
jharenAuthor Commented:
You are on the right path - but the script as is - dosent seem to make it past line 1
0
 
jharenAuthor Commented:
This is what I have THUS far.  However it dosent quite work
'**** Insert this before removing printers ****
Set objShell = CreateObject("WScript.Shell")
strRegistryValue = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
strDefaultPrinter = ""
strDefaultPrinter = objShell.RegRead(strRegistryValue)
 
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
Set colInstalledPrinters = objWMIService.ExecQuery _
    ("Select * From Win32_Printer Where Network = True")
 
For Each objPrinter in colInstalledPrinters
    objPrinter.Delete_
Next
 
Dim net
Set net = CreateObject("WScript.Network") 
net.AddWindowsPrinterConnection "\\Server\printer"
net.AddWindowsPrinterConnection "\\\Server\printer"
net.AddWindowsPrinterConnection "\\Server\printer"

Open in new window

0
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

 
yehudahaCommented:
we used this script to run on the users machine and change server to the new one

change as need
old printer server:

oldPrinterServer = "\\servername"

new printer server:

newPrinterServer = "\\servername\"

script will create log file for each user getting the script with the old printer path

serverForLog = "\\server\share\"

notice the "\" at the end for values newPrinterServer and serverForLog it must be there

example :
serverForLog = "\\ws478\public\"

oldPrinterServer = "\\servername"
newPrinterServer = "\\servername\"
serverForLog = "\\server\share\"
 
Set objNetwork = CreateObject("wscript.network")
Set objFSO = CreateObject("scripting.filesystemobject")
strLog = serverForLog & objNetwork.UserName & ".txt"
If Not objFSO.FileExists(strLog) Then
Set objLog = objFSO.CreateTextFile(strLog,true)
Else
Set objLog = objFSO.OpenTextFile(strLog,ForAppend)
End If
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
Set colPrinters = objWMIService.ExecQuery _
    ("Select * From Win32_Printer Where Local = FALSE")
 
For Each objPrinter in colPrinters
    If objPrinter.ServerName = oldPrinterServer Then 
    strOldPrinter = objPrinter.ServerName & "\" & objPrinter.ShareName
    strNewPrinter = newPrinterServer & objPrinter.ShareName
    BackupPrinters
    objNetwork.AddWindowsPrinterConnection strNewPrinter
    objnetwork.RemovePrinterConnection strOldPrinter
    End if
Next
 
Sub BackupPrinters()
strMsg = Now & ":" & "Printer Information For " & objNetwork.UserName &_
" - " & strOldPrinter & vbcrlf
objlog.WriteLine strMsg
End Sub

Open in new window

0
 
yehudahaCommented:
add

ForAppend = 8

at the top of the script
0
 
jharenAuthor Commented:
At the very top?  or after the variables
0
 
jharenAuthor Commented:
Tried the above script did nothing....I like the idea of that but it didnt seem to work.
oldPrinterServer = "\\servername"
newPrinterServer = "\\servername\"
serverForLog = "\\server\share\"
 
ForAppend = 8  
Set objNetwork = CreateObject("wscript.network")
Set objFSO = CreateObject("scripting.filesystemobject")
strLog = serverForLog & objNetwork.UserName & ".txt"
If Not objFSO.FileExists(strLog) Then
Set objLog = objFSO.CreateTextFile(strLog,true)
Else
Set objLog = objFSO.OpenTextFile(strLog,ForAppend)
End If
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
Set colPrinters = objWMIService.ExecQuery _
    ("Select * From Win32_Printer Where Local = FALSE")
 
For Each objPrinter in colPrinters
    If objPrinter.ServerName = oldPrinterServer Then 
    strOldPrinter = objPrinter.ServerName & "\" & objPrinter.ShareName
    strNewPrinter = newPrinterServer & objPrinter.ShareName
    BackupPrinters
    objNetwork.AddWindowsPrinterConnection strNewPrinter
    objnetwork.RemovePrinterConnection strOldPrinter
    End if
Next
 
Sub BackupPrinters()
strMsg = Now & ":" & "Printer Information For " & objNetwork.UserName &_
" - " & strOldPrinter & vbcrlf
objlog.WriteLine strMsg
End Sub

Open in new window

0
 
yehudahaCommented:
odd i run it 5 minutes ago and works fine .

you run it on a client machine that have printers mapping to the old printer server

you changed this values an example

oldPrinterServer = "\\srv-printerold"
newPrinterServer = "\\srv-printernew\"
serverForLog = "\\ws-jharen\public\"

and nothing happen ?
did you leave the "\" at the end of the 2 and 3 values as i asked ?
old printer still there ?
0
 
jharenAuthor Commented:
It's not changing any printers nor is it writing the log file - I get no error on my vista machine or my XP machine.  I did change the variables - is the "ForAppend = 8 " in the right area?
0
 
jharenAuthor Commented:
I used a combo of my script and yours - so Thank you
0
 
yehudahaCommented:
ForAppend = 8 in the right place i hope the script helped with something

thanks for the points
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now