• Disclaimer

    The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of Microsoft. These posts are just the ramblings of few nerds. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This means don't run the scripts blindly without testing. Be sure to take the appropriate backup/backout precautions before making ANY change to production systems.  You have been warned!

  • Hyper-V : Link madness

    Need some light reading for the weekend?  Have a look at the links below.  All part of the growing body of knowledge around Hyper-V.

    Websites

    Microsoft Virtualization Home Page

    http://www.microsoft.com/virtualization/default.mspx

    Virtualization Case Studies

    http://www.microsoft.com/virtualization/case-studies.mspx

    Virtualization Solution Accelerators

    http://technet.microsoft.com/en-us/solutionaccelerators/cc197910.aspx

    Windows Server 2008 Virtualization & Consolidation: http://www.microsoft.com/windowsserver2008/en/us/virtualization-consolidation.aspx

    Hyper-V FAQ

    http://www.microsoft.com/windowsserver2008/en/us/hyperv-faq.aspx

    Optimized Desktop Infrastructure (VDI and much more): http://www.microsoft.com/windows/products/windowsvista/enterprise/default.mspx

    Virtualization TechCenter:

    http://technet.microsoft.com/en-us/virtualization/default.aspx

    How to Install Windows Server 2008 Hyper-V RC

    http://www.microsoft.com/windowsserver2008/en/us/hyperv-install.aspx

    Windows Server 2008 Hyper-V Performance Tuning Guide

    http://www.microsoft.com/whdc/system/sysperf/Perf_tun_srv.mspx

    MSDN & TechNet Powered by Hyper-V

    http://blogs.technet.com/virtualization/archive/2008/05/20/msdn-and-technet-powered-by-hyper-v.aspx

    MSDN & TechNet Powered by Hyper-V Whitepaper

    http://download.microsoft.com/download/6/C/5/6C559B56-8556-4097-8C81-2D4E762CD48E/MSCOM_Virtualizes_MSDN_TechNet_on_Hyper-V.docx

    Blogs:

    http://blogs.technet.com/virtualization/default.aspx

    http://blogs.msdn.com/virtual_pc_guy/

    http://blogs.technet.com/jhoward/

    http://blogs.technet.com/roblarson/

    http://blogs.technet.com/virtualworld/

    http://blogs.technet.com/windowsserver/

    http://blogs.technet.com/mapblog/

    http://blogs.technet.com/stbnewsbytes/

    Webcasts:

    http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032368894&CountryCode=US

    http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032372420&CountryCode=US

  • Windows 2003 Print Cluster Troubleshooting – When the spooler bites back

     

    The print spooler is a temperamental beast at the best of times.  Print servers end up with a whole myriad of drivers, print monitors and print processors.  The more queues and printers there are the greater the potential for problems. Clustering your print server makes sense but it does add another layer of complexity for you to manage.  I recently tackled a problematic print cluster and thought Id blog about it.  In this post I have pulled together information on how to “clean up” a clustered print spooler.  I’ve drawn information from a few sources for this post.  Big thanks to Paul Cook (Premier Field Engineer in the UK) for his advice … the man knows his print clusters :)

    clip_image001

    Before we begin, have a read of the following posts:

    http://blogs.technet.com/askperf/archive/2007/07/20/windows-2003-print-clusters-part-one.aspx
    http://blogs.technet.com/askperf/archive/2007/07/27/windows-2003-print-clusters-part-two-recommendations.aspx
    http://blogs.technet.com/askperf/archive/2007/08/07/windows-2003-print-clusters-part-three-troubleshooting-missing-print-queues.aspx

    Right, so now you know how it all ties together.  Let’s tackle a few problems that I encountered:

      1. Unsupported Print Monitors were installed
      2. Print Queues were using third party Print Processors
      3. Third party printer drivers

    Unsupported Print Monitors are a common explanation for the spooler biting back. 

    Warning signWARNING Warning sign

    Use the Printing tool to take a backup of your current configuration BEFORE continuing.  I would also advise that you take a system state backup to ensure that the cluster configuration is safe and sound.  Let me re-iterate again, TAKE A BACKUP.  Oh, and don’t forget to test everything before tackling your production systems! 

    Unsupported Print Monitors

    When a printer is installed into a cluster using a driver that ships with Windows Server 2003, the cluster service only uses the standard TCP/IP or LPR monitors. No third-party monitors are supported on server clusters.

    The following monitors are considered supported:

    • BJ Language Monitor
    • Local Port
    • LPR Port
    • Microsoft Document Imaging Writer Monitor
    • Microsoft Shared Fax Monitor
    • PJL Language Monitor
    • Standard TCP/IP Port
    • USB Monitor
    • Windows NT Fax Monitor

    Make sure that each queue is using the Standard TCP/IP port monitor.  You can see the monitors installed on the cluster by viewing:

    HKLM\Clusters\Resources\<resource id>\Parameters\Monitors

    You should remove any unsupported print monitors from the above registry key once all queues are configured to use supported monitors.

    Print Queues using third party Print Processors

    The official line is that third party print processors ARE supported but NOT recommended (Microsoft recommend using the WinPrint processor).  Print processors are user-mode dynamic-link libraries that are responsible for converting the spooled data of a print job to a format that can be sent to a print monitor. Print processors are also responsible for handling program requests to pause, to resume, and to cancel print jobs.

    You wont know what processor a particular driver will use unless you edit the INF before installing.  Realistically editing the INF is not an enticing option. I prefer changing the queue to WinPrint after you have set it up.  So the the first challenge is to identify what Print Queues are not using the WinPrint processor.  You could manually go through each subkey in 

    HKLM\Cluster\Resources\<resource id>\Parameters\Printers

    Or, you could script your way out of the problem like this:

    Const HKEY_LOCAL_MACHINE = &H80000002

    strLogfile = "C:\results.txt"
    strComputer = "target server"
    intCounter = 0

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile(strLogFile)

    Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
    strKeyPath = "Cluster\Resources\<resouce id>\Parameters\Printers\"

    objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

    For Each strSubkey in arrSubKeys
        objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & strSubkey,"Print Processor", strPrintProcessor
        objFile.WriteLine "Print: " & strSubkey & vbTab & "Print Processor: " & strPrintProcessor
        intCounter= intCounter + 1
    Next

    WScript.Echo "Finished processing " & intCounter & " printer queues"
    objFile.WriteLine "Eunumerated " & intCounter & " printer queues"

    WScript.Quit

     

    This script creates a log file called results.txt listing the print processors for each print queue.  Now you know what queues are not using WinPrint, how do you go about changing them?  You have three options:

      1. Change it manually by going into the advance properties the queue, click Print Procesor and select WinPrint.

        image

        image

      2. Change it manually in the registry HKLM\Cluster\Resources\<resource id>\Parameters\Printers\<queue>\Print Processorimage
      3. Write a script to change all print processors to WinPrint.

        Const HKEY_LOCAL_MACHINE = &H80000002

        strLogfile = "C:\results.txt"
        strComputer = "target server"
        intCounter = 0

        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFile = objFSO.CreateTextFile(strLogFile)

        Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
        strKeyPath = "Cluster\Resources\<resource id>\Parameters\Printers\"

        objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

        For Each strSubkey in arrSubKeys
            objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & strSubkey,"Print Processor", strPrintProcessor
            If LCase(strPrintProcessor) <> "winprint" Then
                objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath & strSubkey,"Print Processor", "WinPrint"
                objFile.WriteLine "Printer: " & strSubkey & vbTab & "Print Processor was: " & strPrintProcessor & " but has now been changed to WINPRINT"
                intCounter= intCounter + 1
            End if
        Next

        WScript.Echo "Finished.  Modified " & intCounter & " printer processors"
        objFile.WriteLine "Modified" & intCounter & " printer processors"

        WScript.Quit

      Once you have changed all queues to WinPrint you could now remove the third party print processors from the cluster.  However, think about the consequences before decide to delete them. 

      If a print queue is configured to use a print processor that no longer exists it will not appear when the print spooler is restarted.  To get the queue back you have to edit the registry to change the print processor to WinPrint and restart the spooler.

      Should you still wish to delete the print processors you will find them, depending on the environment in:

      HKLM\Cluster\Resources\<resource id>\Parameters\Environments\Windows NT x86\Print Processors

      Regardless of whether you delete the third party print processors every time you create a new queue or install a new driver, make sure you change the print processor to WinPrint. 

      In some instances using the WinPrint Processor can reduce functionality on a printer e.g. twisty text or watermarks and the likes.  So, there may be instances where you have to use third party print processors.  You could consider creating a new Print Spooler resource on the cluster for third party processors and leave all of the WinPrint queues on another spooler.  Each spooler resource on a Windows 2003 cluster can have its own set of drivers, processors and monitors located in HKLM\Cluster\Resources\<resource id>\Parameters

      Third party printer drivers

      Third party drivers can impact the stability of your print cluster.    As a general rule, see if you can use the drivers that ship with Windows Server 2003 before considering the installation of third party ones. Another thing that really kills print servers is running the setup program that comes with printer drivers.  Not only is this not the supported method for adding a driver to a print cluster it also installs a whole lot of unwanted “stuff” (like system tray icons).  Check out the Cluster Server Resource Centre for more details.  Check out How to set up a clustered print server for details on how to setup the spooler and create print queues.

      Conclusion

      If you tackle the Print Monitors, Print Processors and Drivers you have gone a long way to ensuring that your print server is stable.  However, there is one thing that very quickly undoes all of your hard work and that’s Terminal Services Printer Redirection.  Imagine you’ve cleaned up your drivers, removed unsupported port monitors and set everything to use the WinPrint processor… all of a sudden different drivers start appearing on your cluster!  I recommend disabling client printer redirection on ALL print servers, not just the clusters (in fact, I have in the past disabled it completely on all servers to stop printer drivers being installed).  You can find the option to disable client printer redirection under:

      Computer Configuration\Policies\Administrative Templates\Windows Components\Terminal Services\Terminal Server\Printer Redirection

      Enable the Do not allow client printer redirection setting.

      One last word

      Windows Server 2008 Fail-over clusters are well worth looking into.  There have been improvements across the board.  Print Clusters are now easier to install, configure and manage.  Click on the image below to learn more about Windows Server 2008.

      The Server Unleashed

    1. Scripting: Check if a W2K3 box is running Terminal Server in Application Mode

      I was recently asked (two hours ago) how to tell if a server was running Terminal Services in Application Mode.  The customer wanted to run a different script if users were logged into a Terminal Server.

      They had looked through the registry and came across the TSEnabled value in :

      HKLM\Software\System\CurrentControlSet\Control\Terminal Server

      While this key does indicate whether or not TS is enabled, it does not tell you if the server is in Application Mode.  To compound the issue this key is also set to 1 by default on Windows XP.  So, surely there was a more appropriate way to check?  Indeed there is … the Win32_TerminalServiceSetting WMI class will allow you to check.  See the code below:

      Dim strComputer, objWMIService, colClass, objClass, strTSMode

      strComputer = "."

      Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

      Set colClass = objWMIService.ExecQuery("Select * from Win32_TerminalServiceSetting")

      For Each objClass in colClass

          strTSMode = objClass.TerminalServerMode

          If strTSMode = 1 Then

              Wscript.Echo "Terminal Server is in Application Server mode."

          Else

              Wscript.Echo "Terminal Server is in Remote Administration mode."

          End If

      Next

      Note: This will not work under Windows 2000 as the WMI class does not exist.  I have not checked it in Windows 2008.