Print server failover with Windows 2003 standard?

Discussion in 'Windows Server Systems' started by Electronic Punk, Oct 2, 2007.

  1. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    We are looking at a huge upgrade that will see all of our Windows 2000 regional servers replaced with two Windows 2003 R2 servers.

    Any share that existed will be converted to a DFS share -> users, groups, profiles (although they are being retired), remote installs, application installs, source, wsus (from parent hq), sophos (from parent hq)

    Other software like APC Powerchute will be installed on all the servers regardless and I will have Backupexec installed on one with the source available on the other.



    Basically I am looking at total redundancy, the one thing I may have overlooked is printers. I did a little research and basically I would seem to have two solutions:

    - Print clustering. ( http://support.microsoft.com/?id=278455 ) But basically that would require a much more costly version of Windows so I don't really like that idea.
    - Installing each network printer on each server and making them available twice.

    The second is obviously pretty easy to do for me, but not for the users, especially with the onset of DFS I was hoping for a better option.

    Any ideas?
     
    Last edited: Oct 2, 2007
  2. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    Have you ever configured/managed a cluster? I only have experience with setting up and managing an Exchange cluster. With that said it does not make the resources available twice.

    Furthermore, you need Enterprise to use clustering.
     
  3. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    Well thats the thing, no way I can justify 40-50 copies of Enterprise server just to allow printer sharing redundancy.
     
  4. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    Couldn't you do print pooling or whatever it's called?
     
  5. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    Not sure how that works so will google it tomorrow.

    Reading up on how to modify .msc files on a domain level now.

    Really want services.msc to be standard rather extended by default, but don't want to modify it on every single server.
     
  6. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
  7. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    That sounds more like print device failover where print jobs will go to either of several printers.

    I am looking for someone to send a job out to a printer on DOMAIN\HP Laserjet 5000 and it will be sent to either available server and deal with it intelligently.

    It really depends how the pooling works, if it works like DOMAIN\Printerpool1 and that pool contains the same print device with two different print drivers on each servers and it can intelligently tell if one of those is unavailable then it might work, but that sounds like clustering.

    I will check it out anyway and see if it can do it.

    Worst comes to worst then I will have to either not have a server randomly die (which never really happens anyway) and having both servers offer all print devices but that could be confusing for the users.
     
  8. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    Do you have a problem that has you looking into doing this? Is the server unavailable for some reason or another? Is printing slow?

    If you're looking into a print server cluster then I would assume all it would be doing it handling print jobs. Granted, I don't know how many users you support but I find it odd that printing wouldn't work with one server in place, especially if that's all this server is doing.

    So yeah, what's the problem?
     
  9. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    No basically in each region at the moment we are have a DC and an exchange server.
    Later this year and I suspect a good chunk of next year we will be upgrading those to R2 and using DFS to replicate the user data.

    I am basically trying to minimise the disruption if we want to take one of those servers offline for any period of time.

    RecentlyI had to do two days work on a file server backup because I wanted to reboot the other one (WMI was fubarred and the file system was churning itself up about it).

    Basically its all about redundancy and minimising what we have to do when a server is offline so I can focus on fixing it rather than creating workarounds for existing services.

    We are taking all we can into consideration, both servers will be DCs, they will have a DHCP superscope, DNS, DFS shares and everything else possible considered. Enterprise server however is just not a feasible option.

    If a server goes down a key service is unavailable then I get two hours and then the fines start.
     
  10. kcnychief

    kcnychief █▄█ ▀█▄ █ Political User Folding Team

    Messages:
    16,948
    Location:
    Massachusetts
    Somewhat related to the fact you have a DC and Exchange server - You should go Exchange 2007 and clustering. Heard something how MS is down to like less than 10 around the globe, from like 200 or something before :eek:
     
  11. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    Exactly, those regional exchange servers are being retired.
    But we sadly won't be going to exchange 2007 at this time.
     
  12. jbaddock

    jbaddock OSNN One Post Wonder

    Messages:
    1
    I think I have a solution to your problem.

    Not wanting to spend money on Clustered servers, or wanting duplicate printers of course.

    Windows xp creates a registry entry for each printer.
    HKCU/Printers/Connections

    You will see the server name in the key, as well as a Reg_SZ in the key called server.

    Change both of these from the old server name to the new. although, in my tests, you need to only change the key, not the reg_sz. not sure how this will work if a server is down...so probably just change both. You don't even need to restart the print spool, or reboot. As soon as the registry entry is changed, the clients printer points to the new server.

    Basically, (i haven't developed a script for this yet).
    You need a script that a client could just run that would

    Dim sOldPrintServer
    Dim sNewPrintServer
    sOldPrintServer = "PS1"
    sNewPrintServer = "PS2"

    For each item in Printers where the string equals sOldPrintServer Change to sNewPrintServer
    lalala....

    done.

    That's it. Then, when you are back up and running properly, you can just push this out via login script, so the users don't have to be bothered running another one.

    Hope that helps for what you are looking for.
     
  13. isaacg

    isaacg OSNN One Post Wonder

    Messages:
    3
    jbaddock this is excellent advice except my users don't have admin rights(and so cannot edit registry)...i think we can just have run the script under the user logged in and it will work, but it may not, I'll test it out and see....
     
  14. ZeroHour

    ZeroHour ho3 ho3 ho3

    Messages:
    1,118
    Location:
    Scotland
    How are you deploying the printers to the users?
    Put a ping test into the vbs and if ping fails the script changes the servername variable.
     
  15. Electronic Punk

    Electronic Punk Administrator Staff Member Political User Folding Team

    Messages:
    18,590
    Location:
    Copenhagen, Denmark
    They just search the directory and add the one they want at the moment (highly complicated :p)
     
  16. isaacg

    isaacg OSNN One Post Wonder

    Messages:
    3
    guess i can't attach a file to this post, but i'll include the script that i managed to get working that accomplishes this.
    It will ping your primary print server, and if no response, it will change the required reg keys for that logged in user to change existing printer connections for non working print server to alternate print server. It will also grab the current default printer, and set the changed print server's printer to be the new default printer(you lose your default printer when you change the server connection). I tested this and its working for even nonadmin users. A good tool to use to copy print drivers from one server to another is the windows print migrate utility.

    please post feedback.

    -Isaac

    Code:
    '--------------------------------------------
    ' Author: Isaac G
    ' Date: 4/29/2008
    ' Script to update users installed printers to
    ' use secondary print server
    '
    
    Option Explicit
    
    Dim PF, StrHostPrintsrv1
    Set PF = New PrinterFailover
    
    	StrHostPrintsrv1 = "YOURPRIMARYPRINTSERVERNAME"
    	If Ping(StrHostPrintsrv1) = False Then
    	PF.PS_PROD = "YOURPRIMARYPRINTSERVERNAME"
    	PF.PS_BACKUP = "YOURSECONDARYPRINTSERVERNAME"
    	Else
    	PF.PS_PROD = "YOURSECONDARYPRINTSERVERNAME"
    	PF.PS_BACKUP = "YOURPRIMARYPRINTSERVERNAME"
    	End If	
    Public Function Ping(strHost)
    
        		Dim objPing, objRetStatus
    
        		set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
          		("select * from Win32_PingStatus where address = '" & strHost & "'")
    
        		for each objRetStatus in objPing
            		if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
        			Ping = False
                		'WScript.Echo "Status code is " & objRetStatus.StatusCode
            		else
                		Ping = True
                		'Wscript.Echo "Bytes = " & vbTab & objRetStatus.BufferSize
                		'Wscript.Echo "Time (ms) = " & vbTab & objRetStatus.ResponseTime
               	 	'Wscript.Echo "TTL (s) = " & vbTab & objRetStatus.ResponseTimeToLive
            		end if
        		next
    End Function 	
    
    PF.UpdatePrinters
    
    WScript.Quit
    
    
    Class PrinterFailover
    
    	
    	'Public
    	
    	Public PS_PROD
    	Public PS_BACKUP
    	
    	' Private
    	
    	Private oShell
    	Private HKEY_CURRENT_USER
    	Private HKCU_DEFAULT_PRINTER
    	
    	Private Sub Class_Terminate()
    		Set oShell = Nothing
    	End Sub
    
    	Private Sub Class_Initialize()
    		Set oShell = WScript.CreateObject("WScript.Shell")
    		HKEY_CURRENT_USER = &H80000001	
    	
    		' Rev2
    		HKCU_DEFAULT_PRINTER = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
    		' end rev2
    
    	End Sub
    
    	Public Function UpdatePrinters()
    	
    		Dim v, ar, i, j
    
    		ar = arPrinters()
    
    		Dim retValueNames
    		Dim retValueTypes
    		
    		Dim sKeyPath: sKeyPath = "Printers\Connections\"
    		
    		Dim RegFullKeyPath
    		
    		Dim arRegVal()
    		
    		Dim nName : nName = 0
    		Dim nType : nType = 1
    		Dim nVal  : nVal  = 2
    		
    		' rev2
    		Dim PrintersUpdated: PrintersUpdated = False	
    		Dim DefPrinter: DefPrinter = DefaultPrinter()
    		' End rev 2
    
    		For i = 0 to UBound(ar, 1)
    
    			If InStr(ar(i), PS_PROD) > 0 Then
    			
    				'WScript.Echo "Updating printer key: " &  ar(i)
    				
    				' rev2
    				PrintersUpdated = True
    				' end rev2
    
    				RegFullKeyPath = sKeyPath & ar(i)
    				
    				Call EnumRegVals(RegFullKeyPath, _ 
    				                 retValueNames, _
    				                 retValueTypes)
    				
    				ReDim arRegVal(3, UBound(retValueNames))
    				
    				For j = 0 To UBound(retValueNames) 
    				  '  WScript.Echo "Value Name: " & retValueNames(j)  & " : " & oShell.RegRead("HKCU\" & RegFullKeyPath & "\" & retValueNames(j) )
    				    
    				    arRegVal(nName, j) = retValueNames(j)
    				    
    				    arRegVal(nType, j) = RegTypeNameFromVal(retValueTypes(j))
    				    
    				    arRegVal(nVal,  j) = oShell.RegRead("HKCU\" & RegFullKeyPath & "\" & retValueNames(j))
    				    
    				Next
    				
    				oShell.RegDelete "HKCU\" & RegFullKeyPath & "\"
    				
    				For j = 0 to UBound(arRegVal, 2)
    					oShell.RegWrite Replace("HKCU\" & RegFullKeyPath & "\" & arRegVal(nName, j), PS_PROD, PS_BACKUP), _
    					Replace(arRegVal(nVal, j),PS_PROD, PS_BACKUP), _
    					arRegVal(nType, j)
    				Next
    			
    			End If
    		Next
    		
    		' rev2
    		' Only update the default printer if we failed over something
    		If PrintersUpdated Then
    			UpdateDefaultPrinter(DefPrinter)
    		End If
    		'end rev2
    		
    	End Function
    
    
    	Public Sub EnumRegVals(ByVal sKeyPath, _
    			       ByRef retValueNames, _
    			       ByRef retValueTypes)
    	
    	' WMI reference
    	
    	' http://msdn.microsoft.com/en-us/library/aa390387(VS.85).aspx
    
    		Dim sComp: sComp = "."
    		Dim i, oReg
    		
    		Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
    		   sComp & "\root\default:StdRegProv")
    
    
    		oReg.EnumValues HKEY_CURRENT_USER, sKeyPath,_
    		   retValueNames, retValueTypes
    			
    	End Sub
    	
    	
    	Private Function RegTypeNameFromVal(RegType)
    		const REG_SZ = 1
    		const REG_EXPAND_SZ = 2
    		const REG_BINARY = 3
    		const REG_DWORD = 4
    		const REG_MULTI_SZ = 7
    		
    		Dim s
    		
    		Select Case RegType
    		Case REG_SZ
    		   s =  "REG_SZ"
    		Case REG_EXPAND_SZ
    		   s = "REG_EXPAND_SZ"
    		Case REG_BINARY
    		   s = "REG_BINARY"
    		Case REG_DWORD
    		   s = "REG_DWORD"
    		Case REG_MULTI_SZ
    		   s = "REG_MULTI_SZ" ' Even though RegWrite won't suppor this type
    		End Select
    		
    		RegTypeNameFromVal = s
    		
    	End Function
    	
    	Private Function arPrinters()
    	
    		Dim sComp: sComp = "."
    		Dim sKeyPath : sKeyPath = "Printers\Connections"
    		Dim ar, subkey, oReg
    
    		Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
    		sComp & "\root\default:StdRegProv")
    	
    		oReg.EnumKey HKEY_CURRENT_USER, sKeyPath, ar
    		
    		arPrinters = ar	
    	End Function
    	
    	' rev2
    	Private Function DefaultPrinter()
    		Dim s
    		s = oShell.RegRead(HKCU_DEFAULT_PRINTER)
    		DefaultPrinter = s
    	End Function
    	
    	Private Sub UpdateDefaultPrinter(DefPrinter)
    		oShell.RegWrite HKCU_DEFAULT_PRINTER, Replace(DefPrinter, PS_PROD, PS_BACKUP)
    	End Sub
    
    	' end rev2
    
    End Class
     
  17. isaacg

    isaacg OSNN One Post Wonder

    Messages:
    3
    bump...anyone?....