Video Screencast Help

Advise on Associating Software Products and Software Components

Created: 15 May 2014

There are limitations to using the Software Catalog to associate Software Products and Software Components.  The Software Catalog will not list hidden software components, operating systems or other complex softwares (Microsoft SQL Servers Instances) without creating Targeted Software Inventories.  Additionally, the Software Catalog search mechanisms are not as robust as Regular Expressions.

Using the following powershell script I'm able to make associations between any Software Product and Software Component.  With some additional coding I can start using complex rules that search other tables or use regular expression to make associations.

Is making associations through the ASDK between Software Products and Software Components going to cause issues with the system?  So far my Dev box hasn't made a problem and has left the associations intact.  The idea is to create association using Regular Expressions, the Inv_Database_System table, and the Inv_OS_Operating_System tables when necessary.

function GetLyncSoftwareComponents {
    $con = New-Object System.Data.SqlClient.SqlConnection
    $SoftwareComponents = New-Object System.Data.DataTable
    $con.ConnectionString = "Server=localhost;Database=<DBNAME>;Integrated Security=True"
    $cmd = $con.CreateCommand()
    $cmd.CommandText = "SELECT sc1.Guid AS 'SoftwareComponentGuid'
    , sc1.Name AS 'SoftwareComponent'
FROM vRM_Software_Component_Item sc1
WHERE sc1.Name LIKE '%lync%'"
    $dreader = $cmd.ExecuteReader()
    return $SoftwareComponents

$resourceManagement = New-Object -ComObject "Altiris.ASDK.NS.ResourceManagement"
$resourceManagement.TargetServer = "localhost"

$SoftwareComponents = GetLyncSoftwareComponents

foreach($SoftwareComponent in $SoftwareComponents) {
write-host $SoftwareComponent.SoftwareComponentGuid
$resourceManagement.CreateResourceAssociation("9D67B0C6-BEFF-4FCD-86C1-4A40028FE483", "A9342380-053B-4934-A9E4-D74276B28324", $SoftwareComponent.SoftwareComponentGuid)