Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Mar 2010
    Location
    pittsburgh, PA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    location-aware printing settings in Windows 10 missing?

    Windows 7 and 8/8.1 had what was known as location-aware printing settings. This was far superior to the Windows 10 "remember my last printer" setting. It apparently looks at the MAC address and set whatever default printer one had set when connected at that address as the default whenever connected to that address.

    This is driving my crazy with my SurfacePro4 when I move back and forth between the office and home. Is that a workaround to get this functionality back in Windows 10??

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    If you don't find another simpler solution here's a PowerShell script that will do the trick. Just setup a Scheduled task to run the script at startup and it will change the printer based on your IP address.

    Note: The IP address pattern should be for your home network and you may need to change it based on your DHCP setup.

    Code:
    Clear-Host
    
    <#
      To get the info on all printers for use in $MyPrinters below
      $Printers = Get-WmiObject -Class Win32_Printer
    #>
    
    # --------------    Home Printer Name  -----   Work Printer Name   ---
    $MyPrinters = @("Brother HL-5450DN series","Foxit Reader PDF Printer")
    
    $ErrorActionPreference = "SilentlyContinue"
    Remove-Variable ip
    
    $ip = get-netipaddress | 
     Where-object {$_.IPAddress.ToString() -Like '192.168.*'} 
    
    If ($ip -eq $Null) {
      "At Work"
      $PrinterName = $MyPrinters[1]
    }
    Else {
      "At Home"
      $PrinterName = $MyPrinters[0]
    }
    
    $Printers = Get-WmiObject -Class Win32_Printer
    
        Try
        {
            Write-Verbose "Get the specified printer info."
            $Printer = $Printers | Where{$_.Name -eq "$PrinterName"}
    
            If($Printer)
            {
                Write-Verbose "Setting the default printer."
                $Printer.SetDefaultPrinter() | Out-Null
    
                Write-Host -BackgroundColor Green `
                 "Successfully set the default printer to $PrinterName."
            }
            Else
            {
                Write-Warning -BackgroundColor Red `
                   "Cannot find a printer called $PrinterName."
            }
        }
        Catch
        {
            $ErrorMsg = $_.Exception.Message
            Write-Host $ErrorMsg -BackgroundColor Red
        }
    
        Read-Host -Prompt "Press Enter to continue..."
    Sample run when IP pattern is home pattern (192.168.)
    Code:
    At Home
    Successfully set the default printer to Brother HL-5450DN series.
    Press Enter to continue...:
    Error if Printer name not found at current location:
    Code:
    At Home
    WARNING: Cannot find a printer called OOOrother HL-5450DN series.
    Press Enter to continue...:
    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. The Following User Says Thank You to RetiredGeek For This Useful Post:

    PhilI (2016-05-06)

  4. #3
    Lounger
    Join Date
    May 2011
    Location
    Vancouver, WA
    Posts
    30
    Thanks
    6
    Thanked 4 Times in 3 Posts

    Fully Automated Version Posted...

    RG's post spurred me on to develop this idea into an automated solution. I missed the functionality in Win 10 and this gave me the seed to work with. I have posted my version "Set-DefaultPrinterfromSSID.ps1" here http://tinyurl.com/jx6ffy5 . It sets up the defaults by SSID and schedules a task to run when the network changes. Barely sufficient documentation for a moderately experienced PowerShell user. Designed for the SysAdmin to install and then let it work for the users. It turned out to be much more PowerShell learning. Thanks RG for your post!

    Edit 08/31/16: Updated version of script posted. Minor change to fix getting correct SSID even if access point gets updated or changed.
    Last edited by PhilI; 2016-08-31 at 14:42. Reason: Updated version posted

  5. #4
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,421
    Thanks
    33
    Thanked 195 Times in 175 Posts
    I haven't needed to use it recently, but the venerable CON2PRT.EXE (from the NT4 ZeroAdmin Kit of 1999) still worked beautifully on Windows 7.
    Code:
    CON2PRT: Lets the user disconnect all existing connections to Windows NT
    	 printers and connect to newly specified Windows NT printers.
    
    Usage: CON2PRT [ /? | /h | /f |
    		   [/c \\printserver\share | /cd \\printserver\share]+]
           where:
           /?  - displays usage.
           /h  - displays usage.
           /f  - deletes all existing printer connections.
           /c  - connects to \\printserver\share printer.
           /cd - connects to \\printserver\share printer and sets it as the default
      	     printer.
    
           NOTE: /?, /h can only be the first parameter and if specified further
    	     interpretation of the command line is stopped.  /f can also only
    	     be the first parameter, however it doesn't stop further
    	     interpretation of the command line.  Any number of /c and /cd
    	     parameters can be specified however only the first /cd sets the
    	     printer specified as the default.
    
    Hint: Use --Net View \\printserver-- to determine available print shares.
    Here is something more about it.
    BATcher

    Time prevents everything happening all at once...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •