Testing Associations

Tests if an Association between the objects supplied exists. Returns true, if the Association exists and false if it doesn't. Specifying the the type of Association is mandatory, optionally the source- or / and target-object can be supplied.


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


The first example checks, if the Computer WIN10-02 has an associated User:


$MyComputer = Get-EmdbComputer "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\ITService\Workstations\WIN10-02"

Test-EmdbAssociation -AssociationType ComputerAssociatedUser -Source $MyComputer


The types of Associations are valid for a specific type of object can be determined by calling the GetAssociationTypeNames()-method of an object.


In the following example we test, if the Patch-Package "Cumulative Update for Windows 10 Version 1607 x64 (KB3213522)"  is reported missing for at least one Computer of the DSM environment:


$MyPatch = Get-EmdbSoftwarePackage "Cumulative Update for Windows 10 Version 1607 x64 (KB3213522)" -Recurse

Test-EmdbAssociation -AssociationType ComputerMissingPatch -Target $MyPatch


Finally in the last example, we test if the Software-Package "Adobe Reader X" is a component of the Software-Set "Windows 7 Baseline":


$MyPackage = Get-EmdbSoftwarePackage "Adobe Reader X" -Recurse

$MySoftwareSet = Get-EmdbSoftwarePackage "Windows 7 Baseline" -Recurse

Test-EmdbAssociation -AssociationType SwSetComponents -Source $MySoftwareSet -Target $MyPackage