Imagine a user travels a lot for different locations in a same location, what if every time his laptop log on the local branch office network, and SCCM can auto install the local network printer there for him?
Well, I finished this project last year to archive this idea. To make it work:
1. Create location collection for each branch office in your environment;
2. Create separate printer install package for each location;
3. Link each network printer to the specific location collection.
For example, we have SFPRINT01 in our SF office, and we want anyone in SF office to install this printer automatically. How we can do that?
First we can build a collection called SF office, if we have AD site called SF, we can link this AD site to the collection, so any machines in SF will be showed up in this collection and update automatically. If you don’t have an AD site like me, we can build a query to see all the machines in a specific IP range.
Here is the SCCM collection by IP Range Query:
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.IPSubnets in (“10.12.33.0”, “10.12.44.0”)
Once we finish ” SF Office ” collection, we change the collection membership update time to a relatively short interval, for example, 4h. Then any new machines logged into SF network will be showed up in this collection around 4h.
Second, we need to build a printer package, as my environment doesn’t have printer server in small offices, so I have to build a printer package to install the printer driver first.
And of course, just to be safe, we use different printer port to avoid destroy user’s existing printers. Since Microsoft already have a printer install script inside windows, we can elevate that to make our life simpler. Here is the total printer install script(batch file):
REM Printer Install Script
REM 08182014
REM __Rui Qiu__
set Model=Ricoh_xxx
set Name=SFPRINT01
set Driver=”Gestetner MP C2051 PCL 6″
set IP=10.11.22.33
set Script=%WINDIR%\System32\Printing_Admin_Scripts\en-US
echo Copy Drivers
md “C:\Windows\Printers\%Name%”
IF exist “C:\Windows\Printers\%Name%” xCopy /E /Y %cd% “C:\Windows\Printers\%Name%”
:: Delete old printer
CD %WINDIR%\system32
cscript %Script%\prnmngr.vbs -d -p “%Name%”
:: Deletes static port of previous printer, in case of mis-configuration
cscript %Script%\prnport.vbs -d -r IP_%IP%
:: Creates TCP/IP port with specified IP address
cscript %Script%\prnport.vbs -a -r IP_%IP% -h %IP% -o raw -n 9100
cscript %Script%\prnmngr.vbs -a -m %Driver% -h c:\windows\printers\%Name% -i c:\windows\printers\%Name%\%Model%\OEMSETUP.INF
cscript %Script%\prnmngr.vbs -a -p %Name% -m %Driver% -r “IP_%IP%”
:: Set as Default printer
cscript %Script%\prnmngr.vbs -t -p “%Name%”
echo Importing printer settings
rundll32 printui.dll,PrintUIEntry /Sr /n “%Name%” /a “C:\Windows\Printers\%Name%\PrinterSettings.dat”
You can my scripts from here:
https://github.com/ruiqiu/ip_printer_sccm_auto_installation