Creating a View That Shows Users Which Are Primary Users of Computers Which Have a Certain Software Title Installed

Creating a View That Shows Users Which Are Primary Users of Computers Which Have a Certain Software Title Installed

  • Comments 2
  • Likes

A while back I wrote a post about showing computers which have certain software installed using Type Projections.  Customers have asked how to create a view which shows those users which are the primary users of computers which have a certain software title installed.  Presumably this is because they want to dump the list into an email and tell them to uninstall iTunes ASAP.   Smile

So – this requires a slight modification of the original type projection by including another level in the type projection.

This is what the original type projection looked like to bring together computers and software:

<TypeProjection ID="Microsoft.Demo.ComputersHaveSoftware.ProjectionType" Accessibility="Public" Type="Windows!Microsoft.Windows.Computer">
      <Component Path="$Context/Path[Relationship='SoftwareLibrary!System.DeviceHasSoftwareItemInstalled']$" Alias="WindowsComputerHasSoftwareItem" />
</TypeProjection>

We are just going to essentially reuse that but push it down one level inside of the type projection component hierarchy like this:

<TypeProjection ID="Microsoft.Demo.PrimaryUsersComputersHaveSoftware.ProjectionType" Accessibility="Public" Type="System!System.Domain.User">
    <Component Path="$Context/Path[Relationship='System!System.ComputerPrimaryUser' SeedRole='Target']$" Alias="UserIsPrimaryUserOfComputer">
        <Component Path="$Context/Path[Relationship='SoftwareLibrary!System.DeviceHasSoftwareItemInstalled']$" Alias="WindowsComputerHasSoftwareItem" />
    </Component>
</TypeProjection>

Notice how the TypeProjection Type attribute is now pointed at System.Domain.User instead of Microsoft.Windows.Computer.  That’s because what we want to show in the view is a list of users.  Then we traverse over the ComputerPrimaryUser relationship to get the related computers and then over the DeviceHasSoftwareItemInstalled relationship to get the software installed on the computer.

Notice how there is a special attribution on the Path for the UserIsPrimaryUserOfComputer component called SeedRole.  This is used when the parent component (aka “Seed”) is not the Source object in the relationship type.  In the Microsoft.Windows.Computer class is the Source class and the System.User class is the Target class in the ComputerPrimaryUser relationship type.  So in this case we need to indicate that System.Domain.User (which derives from System.User and is the seed class in this type projection) is the Target of that ComputerPrimaryUser relationship type.

Once we import this MP into SCSM we can see that a new type projection is available to create a view from and that it allows us to use criteria from any of the three classes (user, computer, or software):

image

 

The new Microsoft.Demo.SoftwareViews.xml is attached to this blog post.

Attachment: Microsoft.Demo.SoftwareViews.xml
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment