Find and report all managed Windows PCs in K1000 Inventory with a smartcard reader installed.
The script does not depend on K1000, so if you don’t have KACE SMA in your environment don’t worry: the script is still useful!
strComputer = "." Dim log Set log = Wscript.CreateObject("Scripting.Filesystemobject") Set f = log.CreateTextFile("C:\Tools\smartcard.txt", 2) Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_PnPSignedDriver Where DeviceClass = 'SMARTCARDREADER'",,48) For Each objItem in colItems f.WriteLine "DeviceClass: " & objItem.DeviceClass Next f.Close
Set f = log.CreateTextFile("C:\Tools\smartcard.txt", 2)
Go to your K1000 Dashboard, then go to Scripting and create a New Script (Choose Action / New)
Name the script as your wish (for example: Check Smart Card Reader) and follow these steps:
We want the script to run once in every PC, so we’ll use a “checkmark” (the smartcard.txt) to verify that…
…and Save your brand new script.
The Task and its steps are summarized in the following image. When you’re ready, let’s jump to the Step 4!
In the K100 Dashboard, now go to Inventory section, then go to Software and create a new Software entry (Choose Action / New)
Name the rule as your wish (for example: IT Dep — Check Smart Card Reader) and follow these steps:
ShellCommandTextReturn(cmd /c type C:\Tools\smartcard.txt)
…and Save your new Custom Inventory Rule.
Here’s the summary image
Now we need all our devices complete their inventory. The new Custom Inventory Rule creates a new entry in every device record managed by the K1000.
If a smart card reader has been discovered we’ll have at least one “DeviceClass: SMARTCARDREADER” text iside the Custom Inventory Fields section into every device record in Inventory / Devices
Otherwise, if a smart card reader has not been discovered, we’ll have no text
When all your devices has been inventoried and you’re ready, jump to the next section
In the K100 Dashboard, now go to Reporting section, then in Reports and create a new Report (Choose Action / New)
Name the Report as your wish (for example: PCs with Smart Card Reader) and follow these steps:
Feel free to add and modify any other field, according to your needings.
Delete the default filter and create this:
Save your new report and try it.