Windows 7 / Windows Server 2008 R2: Location-Aware Printing

Windows 7 / Windows Server 2008 R2: Location-Aware Printing

  • Comments 4
  • Likes

Vista Pearl Good Morning AskPerf Readers!  Welcome to Day Ten of our Launch Series.  Our theme this week has been Printing, and today we’ll be continuing in that vein.  Our topic today is Location-Aware Printing.  Mobile users and network-connected devices are a rapidly increasing component in the enterprise environment.  Mobile users are not only sales and customer facing users that travel, but also remote users that work outside the office or users that work from home outside of business hours. 

Given this increasing trend towards mobility coupled with the predicted increase in shared / networked printers in a home environment due to products such as Windows Home Server, the HomeGroup feature in Windows 7 and the numerous print server appliances currently available and I’m sure you can see why it is so important to have default printers “just work” in a logical and intuitive fashion – regardless of the user’s location.  Windows 7 provides a new tool, Location-Aware Printing (also known as “Smart Default Printer”) that allows mobile users to configure per-network default printers so that as they connect to different networks, their default printer is updated.  In addition, there are some enhancements to the consistency with which the default printer is determined that have been incorporated into the spooler on Windows 7 and Windows Server 2008 R2.  One quick note – even though the spooler changes affect both operating systems, the new Location-Aware Printing feature only applies to Windows 7 mobile devices.

Location-Aware Printing depends on the Network Location Awareness services and the Network List Services to determine which network (or networks), to which the laptop is connected.  Using the Network List Manager API’s, you can enumerate either networks or network connections.  For this feature, networks are enumerated.  So, if a user is connected to a managed corporate network, either via wired or wireless connection, the same corporate domain network is detected regardless of the specific network connection used.  However, if a user is connected to a different wired and wireless network, there is an order of preference used to resolve the conflict:

  1. A Wired connection to a managed network (Wired networks are always saved by default)
  2. All WLAN networks that the users has saved or unsaved (Wireless networks are not saved by default.  Saved networks show up in Control Panel\Network and Internet\Manage Wireless Networks)
  3. A wired network connection to any unmanaged network
  4. No network

When walking through the logic, the registry key to keep an eye on is HKCU\Printers\Defaults.  The print spooler service determines and sets the default printer for users in similar ways at different times.  Let’s take a look at the logic for the user logon scenario.

  • The spooler checks the value of HKCU\Printers\Defaults\Disabled to verify if Location Aware Printing is enabled.  If this value is set to 1, then the option “Always use the same printer as my default printer” has been set (see the screenshot below – the first radio button disables Location-Aware Printing).  The current default printer that has been selected is the default printer.  If the value is set to 0, then Location Aware Printing is enabled and the spooler moves to the next step in the process to determine if there is a default printer selected for the network to which the user is connected.

image

  • The spooler checks the HKCU\Printers\Defaults\<GUID of Network> key next to determine if a default printer has been specified for this network.  If this is a new network or the GUID for this network does not exist in the registry, then the current default printer is set as the new default.  If the subkey does exist, then the printer name in the (Default) value is chosen as the default printer.
  • Whichever printer has been selected as the default is then validated against the list of devices listed in HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices.  If the chosen printer is valid (i.e. still in the list) it will remain as the default printer for the user.  However, if the printer is not in the list then a new default is chosen from the devices that are listed in the Devices key.  The final validation prioritizes standard printers over virtual printers and local printers over remote connections.
  • After the chosen default printer is validated, the value of HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device is updated to reflect the new default printer, even if this is key is where it obtained the value.  The registry key value UserSelectedDefault is set to 1 if the default printer was determined as a result of per-network settings and the value HKCU\Printers\Defaults\NetID is updated with the GUID of the current network if the default printer was determined as a result of per-network settings.

The image below shows the process flow:

image

When the Print Spooler Service starts, such as during a Windows startup or restart, it is not aware of what user (if any) is logged on.  It performs the user logon steps above for every user whose profile ahs been loaded from HKEY_USERS.  If there are no interactive users logged (such as during boot), then the steps will typically be performed for services accounts such as Local Service and Network Service.  For these accounts, the Disabled registry value and the GUID-named subkeys typically will not exist.  Therefore, no changes will be made to the default printer value in Device for each account.

That brings us to the end of this post.  Just to recap the most important points:

  1. Location-Aware Printing is only available on Windows 7 Home Premium and above and only on mobile devices (such as laptops).
  2. Location-Aware Printing is dependent upon the Network List Service and the Network Location Awareness service.  If either one of these services are stopped or malfunctioning, then Windows will not be able to detect network changes and may not switch default printers as expected

Enjoy the rest of your Saturday.  I’ll be back tomorrow with an overview of Distributed Scan Management.  Until next time …

- CC Hameed

Share this post :


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Often, we have users traveling to various offices within the same Domain network. Can Location-Aware Printing be made aware of different locations within the same domain? For example, can it use different octets of the laptop’s IP address to determine location?

  • How about default printer preferences? The default on the server is not promulgated to the clients.

  • Like Doug, I am regularly switching between home, hotel, and two or more corporate offices that are in the same domain. Windows 7 is only enumerating the one corporate network and so I don't get the right default default when I go into the "other" office. Is there any way to associate a sub-net to the network that is being identified to fix this?  

  • The networks are typically defined by the domain name, or in the case of unmanaged networks - by the name of the Access Point. There's no way to associate them with a specific subnet in the current implementation.

    Excellent feedback though!