Loading
SCCM Collection Sync

I would like to find a way to add computers to SCCM Collections based on the installation information found in SLM. We have a script that transfer collection information from one machine to another but were finding the collection information is not always populated. In short if a install of a product is found the Workflow would utilize the collection information populated in the Store data of SLM to then place the computer in that collection. Creating the SCCM Powershell is pretty simple but I'm struggling with collecting the data from SLM. Is there any way to use the API to provide what software is installed on a computer? I should be able to then take that data and query the API to capture the collection information of the application.

Thanks

Jerry


  • Oskar Frolin (Flexera Software)

    Hi Jerry, I'm boiling it down to the need to retrieve information from SLM to run different procedures with that retrieved information It would be pretty easy to for example retrieve custom fields in SLM to get a stored SCCM collection ID for the application, and then use it in your activity. This activity code is used to retrieve all the information for a SLM Application over the API. I would suggest that you streamline it to better handle the array object retrieved for Custom Fields (The parameter CustomValues in the API). param (   $apiuser   , $applicationid   , $slmurl   , $customerid   , $ApplicationName   , $ApplicationManufacturerId   , $ApplicationManufacturerName   , $ApplicationManufacturerWebsite   , $ApplicationLanguageName   , $ApplicationReleaseDate   , $ApplicationCreatedDate   , $ApplicationCreatedBy   , $ApplicationUpdatedDate   , $ApplicationUpdatedBy   , $ApplicationDescription   , $ApplicationSystemOwnerName   , $ApplicationSystemOwnerPhone   , $ApplicationSystemOwnerEmail   , $ApplicationMedia   , $ApplicationIsOperatingSystem   , $ApplicationOperatingSystemType   , $ApplicationApplicationTypes   , $ApplicationUpgradeOptions   , $ApplicationDowngradeOptions   , $ApplicationTotalCoverage   , $ApplicationLicenseRequired   , $ApplicationLicenseRequirement   , $ApplicationLicenseCount   , $ApplicationInstallationCount   , $ApplicationBundleInstallationCount   , $ApplicationUnusedInstallationCount   , $ApplicationUsageFactor   , $ApplicationUserCount   , $ApplicationRisk   , $ApplicationRiskUnused   , $ApplicationCompliance   , $ApplicationAllocation   , $ApplicationLicenseKeys   , $ApplicationMetric   , $ApplicationApplicationCostTotal   , $ApplicationApplicationCostPerLicense   , $ApplicationAverageCostPerLicense   , $ApplicationLicenseCostTotal   , $ApplicationLicenseCostCurrency   , $ApplicationUserLicenseCost   , $ApplicationAlertOnOverlicensing   , $ApplicationAlertOnUnderlicensing   , $ApplicationAlertWhenNotUsed   , $ApplicationCustomValues   , $ApplicationSecondaryUseAllowed   , $ApplicationMultipleVersionsAllowed   , $ApplicationMultipleEditionsAllowed   )     $serviceAccount = Get- ServiceAccount - Name $apiuser   $apipassword = $serviceAccount . Password       #{{na:service.vendorItemId}} == this is the application id from the sync job with SLM, can be used to configure the template service         #if there is an issue with getting the URL from the input parameter, it can be retrieved directly from the AP Setting.   #$slmurl  = Get-APSetting "SLMUri"   $uri = "$slmurl/api/customers/$customerid/applications/$applicationid/"     $headers = @{ "Authorization" = "Basic " + [ System. Convert] : : ToBase64String ( [ System. Text. Encoding] : : UTF8 . GetBytes ( $apiuser + ":" + $apipassword ) ) }   $application = Invoke- WebRequest - Uri $uri - contentType "application/json" - Method Get - Headers $headers - UseBasicParsing | ConvertFrom- Json       $ApplicationName                                           = $application . body. Name                                          $ApplicationManufacturerId                                 = $application . body. ManufacturerId                                $ApplicationManufacturerName                               = $application . body. ManufacturerName                              $ApplicationManufacturerWebsite                            = $application . body. ManufacturerWebsite                           $ApplicationLanguageName                                   = $application . body. LanguageName                                  $ApplicationReleaseDate                                    = $application . body. ReleaseDate                                   $ApplicationCreatedDate                                    = $application . body. CreatedDate                                   $ApplicationCreatedBy                                      = $application . body. CreatedBy                                     $ApplicationUpdatedDate                                    = $application . body. UpdatedDate                                   $ApplicationUpdatedBy                                      = $application . body. UpdatedBy                                     $ApplicationDescription                                    = $application . body. Description                                   $ApplicationSystemOwnerName                                = $application . body. SystemOwnerName                               $ApplicationSystemOwnerPhone                               = $application . body. SystemOwnerPhone                              $ApplicationSystemOwnerEmail                               = $application . body. SystemOwnerEmail                              $ApplicationMedia                                          = $application . body. Media                                         $ApplicationIsOperatingSystem                              = $application . body. IsOperatingSystem                             $ApplicationOperatingSystemType                            = $application . body. OperatingSystemType                           $ApplicationApplicationTypes                               = $application . body. ApplicationTypes                              $ApplicationUpgradeOptions                                 = $application . body. UpgradeOptions                                $ApplicationDowngradeOptions                               = $application . body. DowngradeOptions                              $ApplicationTotalCoverage                                  = $application . body. TotalCoverage                                 $ApplicationLicenseRequired                                = $application . body. LicenseRequired                               $ApplicationLicenseRequirement                             = $application . body. LicenseRequirement                            $ApplicationLicenseCount                                   = $application . body. LicenseCount                                  $ApplicationInstallationCount                              = $application . body. InstallationCount                             $ApplicationBundleInstallationCount                        = $application . body. BundleInstallationCount                       $ApplicationUnusedInstallationCount                        = $application . body. UnusedInstallationCount                       $ApplicationUsageFactor                                    = $application . body. UsageFactor                                   $ApplicationUserCount                                      = $application . body. UserCount                                     $ApplicationRisk                                           = $application . body. Risk                                          $ApplicationRiskUnused                                     = $application . body. RiskUnused                                    $ApplicationCompliance                                     = $application . body. Compliance                                    $ApplicationAllocation                                     = $application . body. Allocation                                    $ApplicationLicenseKeys                                    = $application . body. LicenseKeys                                   $ApplicationMetric        
    Expand Post
    • Thanks for the fast response Oskar! This does solve one of the issues but I'm still struggling with how to identify what software is installed on a machine through the API. Basically I need to know what machine to add to a collection so my plan was to look at what software is installed on the machines and then check those software titles to see if they are in the App Store and have a SCCM Collection and next add them to the SCCM collection (which I have script to do). Thanks Jerry
      Expand Post
      • Oskar Frolin (Flexera Software)

        Hi Jerry, I would suggest you reuse the code from that activity, and change it to the computer endpoint. You might need to do a couple of different API calls based on what identifier you have, but start by looking into the SLM API. Browse http://yourslminstallation/API /Customers in any browser to see what exists in the API. For example, if you only have the hostname, to retrieve the computer installed software you need the ID for the computer in SLM. First retrieve the computer basic information by filtering on hostname (/api/customers/1/computers/?%24filter=Name+eq+%27 COMPUTER75 %27), then use the ID of the result in the URL to list the applications on the computer (api/customers/1/computers/ 1 /applications/). All the code to retrieve these web endpoints is in the previous code, "just" change the URL and you will get the different information back. Hope this helps! /Oskar
        Expand Post
  • Oskar, Would there be away to add the discovered software from to the My Services information in the App Store? Basically I want the user to be able to see everything they have installed and be able to uninstall it whether or not they have requested the title through the App Store or they were placed in the SCCM collection manually. Jerry
    • Oskar Frolin (Flexera Software)

      Hi Jerry, First of all, yes, this is possible. It is done by creating Inventory Services (under Administer). A bit difficult to do at first, but once you get a hang of it you can basically inventory _anything_ and populate it under "My Services". Only limitation here would be your imagination In this case I would consider two different scenarios: 1. Build a Inventory Service that looks up all the Applications inventoried in SLM. This would list them all as installed applications under My Services. Then you add Edit workflows to the inventoried applications to give this more power than just beeing a list of installed applications. Edit workflow examples: Uninstall: a workflow that handles uninstallation in whatever way that is possible in your environment. Could be that it looks up SCCM collection information from a Custom Field in SLM, could be that it just sends an email to your service desk, could be both. Raise Support Ticket: a workflow gathers information from the user and then either emails it to your service desk, or integrates to your ticket system and creates a ticket. 2.  Same as above, except you look at SCCM instead of SLM as the source of what is installed. This method would be easier to trigger fully automatic uninstallations, but would then also only show things that you have in SCCM collections and you would miss out on all the inventoried software found by SLM bonus:  why don't do both scenarios Cheers! /Oskar
      Expand Post

Loading
SCCM Collection Sync