No announcement yet.

Changin Print Servers on Domain

  • Filter
  • Time
  • Show
Clear All
new posts

  • Changin Print Servers on Domain

    I am running windows 2003 DC and Windows XP Por SP2 workstations. I need to change my print server from the primary domain controller to a member server. My user are printing alot of documents thus causing the domain controller/ Print Server/ File Server to lock up at certain times of the day. I have setup all of the printers on the member server with the exact same names and share name. I have followed the instructions from this thread on Petri web site. The problem i found with this script is tries to restart the local pirnt spooler and sometimes the spooler fails to sart up again. Also the printers do not connect to the member server immediatly. Sometimes the printer will be in opening status for quite some time and sometimes not all of the printers will connect to new server. Has anyone had experience using this script?

  • #2
    Re: Changin Print Servers on Domain

    Hi, I don't know about this script. But in my opinion since the Share Name already exisits on the network hosted by another server, how the DNS Name will be resovled by the Print Spooler?

    Try to delete on of the printer in the Primary Domain Controller and put it in the Member File /Print Server see does that solve the problem?

    HND: Higher National Diploma in
    Computer Science(IT)

    MCSA+Security 2003, VCP3, VCP4
    Done:VMware DSA


    • #3
      Re: Changin Print Servers on Domain

      Maybe, you can try this script instead?:

      ' ChgPrtServer.vbs
      ' created by Helge Wunderlich and Torgeir Bakken
      ' put in the server names here (keep the quotes!)
      MovePrinters "oldservername", "newservername"
      ' *********************************************
      ' Move printers to new server
      ' *********************************************
      Sub MovePrinters(OldServer, NewServer)
      ' Loops through all network printers and moves all printers
      ' on "OldServer" to the same printername on "NewServer".
      dim WshNetwork, oPrinters, i, PrinterPath, DefaultPrinter, PrinterList
      ' Check that WSH version is new enough:
      If CDbl(Replace(wscript.version,".",",")) < CDbl(5.6) Then
      MsgBox "Automatic printer migration is not available for" & _
      " this computer." & vbCrLf & _
      "Please migrate printers manually." & vbCrLf & _
      "The new printer server name is """ & NewServer & """", _
      vbOKOnly + vbCritical, "Windows Scripting Host is too old"
      wscript.quit 1
      End If
      Set WshNetwork = WScript.CreateObject("WScript.Network")
      Set PrinterList = CreateObject("Scripting.Dictionary")
      ' Get the default printer before we start deleting:
      DefaultPrinter = GetDefaultPrinter
      ' Get a list of printers to work with:
      ' (We cannot modify the collection while looping through it)
      Set oPrinters = WshNetwork.EnumPrinterConnections
      For i = 1 to oPrinters.Count Step 2
      PrinterList.Add oPrinters.Item(i), "x"
      Next ' i
      ' Loop through the printer list and migrate mathching ones:
      For Each PrinterPath In PrinterList.Keys
      If StrComp(ServerName(PrinterPath), OldServer, 1) = 0 Then
      WshNetwork.RemovePrinterConnection PrinterPath, True, True
      On Error Resume next
      WshNetwork.AddWindowsPrinterConnection "\\" & NewServer & "\" & _
      'If Err.Number = -2147023095 Then
      ' MsgBox "The printer """ & ShareName(PrinterPath) & _
      ' """ does not exist on server """ & NewServer & """." & vbCrLf & _
      ' "The printer has been removed.", vbOKonly + vbExclamation, _
      ' "Missing printer"
      'End If
      On Error goto 0
      End If
      'Set the default printer:
      If ServerName(DefaultPrinter) = OldServer Then
      On Error Resume Next
      WshNetwork.SetDefaultPrinter "\\" & NewServer & "\" & _
      'If Err.Number = -2147352567 Then
      'MsgBox "Your default printer did not exist, and has been deleted.", _
      ' vbOKonly + vbInformation, "Invalid default printer"
      'End If
      On Error goto 0
      End If
      End Sub ' MovePrinters
      Function GetDefaultPrinter()
      ' Returns the UNC path to the current default printer
      Dim oShell, sRegVal, sDefault
      Set oShell = CreateObject("WScript.Shell")
      sRegVal = _
      "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
      sDefault = ""
      On Error Resume Next
      sDefault = oShell.RegRead(sRegVal)
      sDefault = Left(sDefault ,InStr(sDefault, ",") - 1)
      On Error Goto 0
      GetDefaultPrinter = sDefault
      End Function
      Function ServerName(sPrinterPath)
      Dim aPrinterPath
      ServerName = ""
      If Left(sPrinterPath, 2) = "\\" Then
      aPrinterPath = Split(sPrinterPath, "\")
      ServerName = aPrinterPath(2)
      End If
      End Function
      Function ShareName(sPrinterPath)
      Dim aPrinterPath
      ShareName = ""
      If Left(sPrinterPath, 2) = "\\" Then
      aPrinterPath = Split(sPrinterPath, "\")
      ShareName = aPrinterPath(3)
      End If
      End Function
      The clients need 'Windows Scripting Host 5.6' for this script to run. This version is already installed automatically on WinXP computers with SP2.
      (else Install Wsh 5.6 Via Logon Script)

      And here is an other script by Randy Foster, that does the same thing:
      (note: The script does not run if you are Terminal serviced or SMS remote controling.)

      Last edited by Rems; 26th June 2007, 11:18. Reason: added a link to a second script

      This posting is provided "AS IS" with no warranties, and confers no rights.


      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts