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!
- [The Query] This script 😇
- [The Automation] Kace Systems Management Appliance (AKA 'K1000')
- The vbs script executes a WMI query over the target device(s) and saves an output file named smartcard.txt (see below in the Setup section)
- The vbs script is scheduled and deployed to the target device(s) via K1000 Online KScript
- A K1000 Custom Inventory Rule reads the output file for every inventoried device and stores the information in the database
- A scheduled Report (choose your favorite format between HTML, CSV, PDF or Excel) returns only PCs with a smart card reader installed
- Done!
- Edit the script line 4 with the path where you want to save the output file. In our environment every PC has a “C:\Tools” directory for service purpose, so I decided to save the output there.
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:
- Type: Online KScript
- Enabled: Yes
- Deploy: one or some devices, all devices or to a Device Label, according to your needs in your environment
- Windows Run As: Local System
- Upload the smartcard.vbs as New Dependecy
We want the script to run once in every PC, so we'll use a “checkmark” (the smartcard.txt) to verify that...
- Verify: Verify a file exists...
- C:\Tools\smartcard.txt
- Remediation: Launch a program...
- Directory: $(KACE_SYS_DIR)
- File: cscript.exe $(KACE_DEPENDENCY_DIR)\smartcard.vbs
- Wait for completion: Yes
- On Remediation Success: Upload a file... (note: this step is not necessary and only for archiving purpose)
- Directory: C:\Tools
- File: smartcard.txt
...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:
- Publisher: IT Department (it's useful for further searches into the Software Inventory)
- Supported Operating Systems: All the Windows OSs in your Inventory
- Custom Inventory Rule:
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:
- Category: Inventory
- Topic: Device
- Device: System Name
- Operating System Info: Name
- User Information: User Name
- Manufacturer and BIOS: System Model
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.