none
Find number of times a Request Offering has been used RRS feed

  • Question

  • I want to find the number of times every request offering we have in Service Manager has been used to determine which Request Offerings are now redundant and can be removed.  I have got a script that gets all the Request Offerings as well as their associated templates and Support Groups and last modified dates, but can't find where I could get the amount each of these have ever been used.  Any help anyone?

    Import-Module SMLets
    
    $sv = "d-scsm-ms-01"
    $AllRequestofferings = Get-SCSMRequestOffering -ComputerName $sv
    $AllTemplates = Get-SCSMObjectTemplate -ComputerName $sv
    
    # Connect to SM SDK to return support group names
    $EMG = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup "localhost" # <-- set to your mgmt server name if running remotely
    
    
    ForEach ($RO in $AllRequestofferings)
    {
        ForEach ($Template in $AllTemplates)
        {
         If ($Template.Identifier -eq $RO.TargetTemplate)
         {
         $SGValue = ($template.PropertyCollection | ?{$_.Path -like '*TierQueue$' -or $_.Path -like '*SupportGroup$'}).MixedValue
         $SG=$null
            if($SGValue)
            {
                try { # If GUID was returned
                    [System.Guid]::Parse($SGValue) | Out-Null
                    $SG = ($EMG.EntityTypes.GetEnumerations() |?{$_.Id -eq $SGValue}).DisplayName
                } catch {
                    try{ # if MPValue
                        $SG = ($EMG.EntityTypes.GetEnumerations() |
                            ?{$_.Name -eq $SGValue.Substring($SGValue.IndexOf("'")+1,($SGValue.length - $SGValue.IndexOf("'")-1)-($SGValue.length - $SGValue.LastIndexOf("'")))}).DisplayName
                    } catch {
                        $SG = $SGValue
                    }
                }
              }
         
         Write-host "Request Offering: $($RO.Displayname)  Template: $($Template.DisplayName)   Support Group: $SG   Last Mod:$($RO.LastModified)"    
         }
        }
    
    }

    Monday, September 9, 2019 2:51 PM

All replies

  • There maybe a table or view in the database that keeps this metric.
    More likely in the DWDataMart if looking for a historical case of them.

    The ServiceManager database may keep this aswell but most likely more current data.


    Website: www.walshamsolutions.com Technical Blog: https://www.walshamsolutions.com/technical-blog Personal Blog: https://www.walshamsolutions.com/personal-blog Twitter: Dwalshampro

    Tuesday, September 10, 2019 5:34 PM