/build/static/layout/Breadcrumb_cap_w.png

K1000 - Custom Inventory Rule To Inventory Local + Network Printers

Hello fellow Ninjas!

DISCLAIMER: I did not create this entire solution myself. I used bits and pieces from around the net and with a high level of determination and significant testing I have found a viable solution. The reason for this blog is I couldn't find a complete step-by-step solution.

The K1000 currently only inventories in Device Inventory local (non network) printers. The reason why the K1000 doesn't inventory network printers are because of the following reason. 

Reason: Network printers are installed, traditionally, per user. Meaning if someone else logged on they wouldn't see said network printer. The K1000 Agent, which is responsible for inventory (plus much more) executes as: SYSTEM, not the logged-in-user. 

Due to this fact to be able to inventory network printers we'll have to leverage KACE's other assets in order to accomplish our goal. Fear not ninjas, if there is a will there is a way! 

Step 1: Create an Online KScript with the following settings
X7SKIU.jpeg
Not sure if you can see everything, but here is the important information.
Windows Run As MUST be set to Logged-in User. 
The only step should be to run a batch script with the following code:

del C:\ProgramData\Dell\KACE\user\PrintersList.txt
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs -l > C:\ProgramData\Dell\KACE\user\FPL.txt
findstr /v "Script Copyright Default Server Location Comment Parameters Attributes Priority Average status Extended error Share processor type" C:\ProgramData\Dell\KACE\user\FPL.txt > C:\ProgramData\Dell\KACE\user\PrintersList.txt
del C:\ProgramData\Dell\KACE\user\FPL.txt
ECHO. >>"C:\ProgramData\Dell\KACE\user\PrintersList.txt"
ECHO Last Sync:>>"C:\ProgramData\Dell\KACE\user\PrintersList.txt"
ECHO %date% >>"C:\ProgramData\Dell\KACE\user\PrintersList.txt"

The high level approach is this:
First delete the file PrintersList.txt at a given location
Then execute a built-in (into Windows) VBS script that outputs all your logged-in users printers (local + network) to a txt file named: FPL.txt to a given location
Then parse the FPL.txt file and capture the useful information (Printer, Drive, and Port Name) and then write that to another txt file named: PrintersList.txt to a given location
Then delete the FPL.txt file (since we got what we needed from it)
Then append a newline to the PrintersList.txt file
Then append: Last Sync: to the PrintersList.txt file
Then append a timestamp to the PrintersList. txt file

What the end result is something that looks like this:
9hzEkM.png
I wanted to include a timestamp in the .txt file so that when this gets inventoried in our CIR rule (discussed below) we know the last time this was executed. 

Now that we have a script that creates a .txt file with all of our printers we need to create a Custom Inventory Rule to read that file and included it in Device Inventory. 

Now head over to Inventory -> Software in your K1000 and create a new entry with the following information:
sObnqb.png

The Custom Inventory Rule code should be: 

ShellCommandTextReturn(cmd /c type C:\ProgramData\Dell\KACE\user\printerslist.txt)


So now that we have everything setup here are some things I wanted to discuss with you. I suggest scheduling the script to run either weekly or monthly as users' printers usually don't change and we don't need to bog down the K1000 running it at a shorter interval. Now there is one caveat to all of this. Caveat is that this only captures the list of available printers for the current logged-in user when the script is executed. If only a single user logs onto computer then this wont be an issue. However, if you have multiple users sharing a computer who have different printers then you will need to alter my solution to have the script execute against all users who have logged onto the computer (not sure how nor if it would be possible). 

I wish all you ninjas luck out there and let me know if you have any questions! 



Comments

  • I taught this at dell world 2014 and blogged this. http://www.itninja.com/blog/view/create-cirs-to-show-current-users-mapped-drives-and-networled-printers-presented-at-dell-world-user-forum-2014-lessions-from-the-field - SMal.tmcc 7 years ago
  • SMal.tmcc,

    In my scouring I missed your post. Indeed, you certainly were first. Sorry for the double post. - MAXintosh 7 years ago
  • I broke mine into 3 cir's and still use a script to create the files. I have one for network, one for local minus the fluff printers, and one for all minus the fluff printers

    wmic printer where 'network="true"' get name, default, network > C:\ProgramData\Dell\KACE\user\NetworkPrinters.txt

    wmic printer where "network=false and NOT DriverName LIKE '%%WebEx%%' and NOT DriverName LIKE '%%Amyuni%%' and NOT DriverName LIKE '%%Microsoft%%' and NOT DriverName LIKE '%%PDF%%' and NOT DriverName LIKE '%%Adobe%%' and NOT DriverName LIKE '%%Hyland%%' and NOT DriverName LIKE '%%snagit%%'" get name,drivername,printerstatus > C:\ProgramData\Dell\KACE\user\LocalPrinters.txt

    wmic printer where "NOT DriverName LIKE '%%WebEx%%' and NOT DriverName LIKE '%%Amyuni%%' and NOT DriverName LIKE '%%Microsoft%%' and NOT DriverName LIKE '%%PDF%%' and NOT DriverName LIKE '%%Adobe%%' and NOT DriverName LIKE '%%Hyland%%' and NOT DriverName LIKE '%%snagit%%'" get name,drivername,portname > C:\ProgramData\Dell\KACE\user\AllPrinters.txt - SMal.tmcc 7 years ago
  • How do you create a report on this now to show installed printers by computer name? - joseph.belanger@nichols.edu 7 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ