ITMS Inventory Solution Custom Inventory can be used to gather Open Database Connectivity (ODBC) data source names (DSNs) from computers if present. This article presents a sample custom inventory PowerShell script and custom report that displays the custom inventory 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. For more information on creating custom inventories, see KB article Introduction to Custom Inventory in Notification Server 8.x [Altiris]
Altiris Inventory Solution 8.x
Do the following:
Computer Name
DSN Name
Driver Name
DSN Type
Inventory Date (agent local)
------------------------------------ Start Of Script ------------------------------------
# Altiris Custom Inventory: PowerShell script to inventory ODBC DSN Names
$Computer = hostname
$nse = New-Object -com Altiris.AeXNSEvent
# Please don't modify this GUID -->
$nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
$nse.Priority = 1
#-----------------------------------------------------------------------
# Modify this variable with the custom data class GUID
$objDCInstance = $nse.AddDataClass("{paste the GUID here between braces}")
#-----------------------------------------------------------------------
$Flag = 0
$DSNs = Get-OdbcDsn
$objDataClass = $nse.AddDataBlock($objDCInstance)
foreach ($DSN in $DSNs)
{
if ($Flag -eq 0) {
$Flag = 1
}
$objDataRow = $objDataClass.AddRow()
$objDataRow.SetField(0, $Computer )
$objDataRow.SetField(1, $DSN.Name )
$objDataRow.SetField(2, $DSN.DriverName )
$objDataRow.SetField(3, $DSN.DsnType )
$objDataRow.SetField(4, $((Get-Date).ToString()) )
}
if ($Flag -eq 0) {
$objDataRow = $objDataClass.AddRow()
$objDataRow.SetField(0, $Computer )
$objDataRow.SetField(1, "None Found" )
$objDataRow.SetField(2, "n/a" )
$objDataRow.SetField(3, "n/a" )
$objDataRow.SetField(4, $((Get-Date).ToString()) )
}
# send the data
$nse.Send()
------------------------------------ End Of Script ------------------------------------
Then do the following:
NOTE: Symantec Support does not support custom scripting or reporting. Modifications to the script and report must be made by the user. Please contact Symantec Consulting Services for assistance with creating custom inventory scripts or custom reports, who can be reached as documented in this article Symantec Consulting Services