How To Detect and Report Fonts with Custom Inventory
search cancel

How To Detect and Report Fonts with Custom Inventory

book

Article ID: 178598

calendar_today

Updated On:

Products

Inventory Solution Client Management Suite IT Management Suite Server Management Suite Asset Management Suite

Issue/Introduction

The custom inventory script presented in this article detects font files on Windows computers in the C:\Windows\Fonts folder and reports the font names to a custom data class in the Altiris database. Follow the instructions below to set up the custom data class, custom inventory task, and custom report to display the data. Please note that Symantec Support does not support custom scripting or reporting so modifications to the script and report must be made by the user.

Resolution

  1. Create a new custom data class that will store the font information for each computer.
    1. Go to Settings>All Settings then Settings>Discovery and Inventory>Inventory Solution>Manage Custom Data Classes.
    2. Click New data class.
    3. Name the data class "Font" and click OK.
    4. Click Add attribute.
    5. Name the attribute "Font Title", set Key to "No", and click OK.
    6. Enable Allow multiple rows from a single computer resource.
    7. Click Save Changes.
  2. Create a Custom Inventory Script Task.
    1. Go to Manage>Jobs and Tasks.
    2. Browse the folder drop-down menu to where you would like to add a custom inventory script task.
    3. Right-click on the folder, then select New>Task.
    4. Select the Run Script task.
    5. Name the task appropriately.
    6. Select Script type: VBScript.
    7. Copy and paste the entire vbscript below into the large text box of the script task.

      '*******************************************************
      'This Custom Inventory vbscript loops through font files to report their titles
      '*******************************************************

      set objFSO = CreateObject("Scripting.FileSystemObject")

      'Create the NSE
      dim nse
      set nse = WScript.CreateObject ("Altiris.AeXNSEvent")

      ' Set the header data of the NSE. Please don't modify this GUID
      nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
      nse.Priority = 1

      'Create Inventory data block. The following data class with below guid is already configured on server.
      'Brackets are required around the data class guid. To get this GUID, click on the custom data class and then the hand (details).
      dim objDCInstance
      set objDCInstance = nse.AddDataClass ("Font") '***your custom data class name here 
      ' or "{GUID of CUSTOM DATA CLASS include brackets}"
      dim objDataClass
      set objDataClass = nse.AddDataBlock (objDCInstance)
      dim objDataRow
      set objShell = CreateObject("Shell.Application")
      set objFolder = objShell.Namespace("C:\Windows\Fonts\")

      'Loop through each font file and get its Title property (not the file name)
      For Each objFile In objFolder.Items
      set objDataRow = objDataClass.AddRow
      objDataRow.SetField 0, objFolder.GetDetailsOf(objFile, 0)
      Next

      ' Send the NSE data to the NS server
      nse.SendQueued
       
  3. Run the Custom Inventory Script task
    1. Click on New Schedule, choose Now or specify a schedule time and repeat interval.
    2. Specify target computers to run the task on.
    3. To target a single computer click in the Quick add: box and search for the name of the computer, or use the Quick Run feature instead of New Schedule.
    4. To target a list of computers click on Add>Computers or Devices then manually select the desired computers and click > and OK
    5. To target a computer filter (such as All Computers) click on Add>Target, click Add rule, choose exclude computers not in, and search the name of the filter in the final drop-down box. then click OK
  4. Create a Custom Report to view the data collected by the custom inventory
    1. Go to Reports>All Reports.
    2. Browse to a folder where you would like to add the custom report and right-click on the folder.
      Select New>Report>SQL Report.
    3. Give the report an appropriate name.
    4. Replace the text under Parameterized Query with the following query:

      Select * from Inv_Font
      left join vComputer on vComputer.Guid = Inv_Font._ResourceGuid
       
    5. Click Save Changes and then view the collected custom inventory data for each computer.