none
I'm not able to get enumeration ID

    Question

  • Hi to all,

    I’m trying getting enumeration id with attached script using following command:

    $parentEnumID = (Get-SCSMChildEnumeration -Enumeration $cartScopeEnum | where {$_.DisplayName -eq $parent}).Id

    But it didn’t return to me any value.

    Please refer to  # -- Inizio modifiche 13Apr18 à  # -- Fine modifiche 13Apr18 section for command details you would like to help me.

    I apologized for Italian comments. 😊

    Here some more details I tried to check in depth with PowerShell debugger active:

    1. First      Step (the value I need to look for)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $CartographyScopeList

    Applicazioni Infrastrutturali\Applicazioni Infrastrutturali\Printing

    1. Second      Step (parent àtop level)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parent

    Applicazioni Infrastrutturali

    1. Third      Step (child àmiddle level)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $child

    Applicazioni Infrastrutturali

    1. Fourth      Step (leaf àlow level)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $leaf

    Printing

    1. fifth      Step (to check if Get-SCSMEnumeration works)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $cartScopeEnum

    ordinal name                 displayname          

    ------- ----                 -----------          

            CartographyScopeList Cartography Scope List

    1. Sixth      Step (attempt to collect enumeration id parameter)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parentEnumID = (Get-SCSMChildEnumeration -Enumeration $cartScopeEnum | where {$_.DisplayName -eq $parent}).Id

    _____________________________________________________________________________________________________________________________________________________________

    1. SeventhStep (attempt to split above command in two distinct ones)

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parentEnum = Get-SCSMChildEnumeration -Enumeration $cartScopeEnum | where {$_.DisplayName -eq $parent}

    ______________________________________________________________________________________________________________________________________________________

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parentEnum

    ordinal name                                              displayname                 

    ------- ----                                              -----------                 

    -1.125  Enum.e0d4a935da7842bfa0f494bf7a529af1             Applicazioni Infrastrutturali

    1       CartographyScopeList.ApplicazioniInfrastrutturali Applicazioni Infrastrutturali

    0       Enum.0f34235e5b4a4970a137085703558396             Applicazioni Infrastrutturali

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parentEnumID = $parentEnum.Id

    _________________________________________________________________________________________________________________________________________________________

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parentEnumID

    _________________________________________________________________________________________________________________________________________________________

                 Same null result if I use:

                 $parentEnumID = $parentEnum.name

                 $parentEnumID = $parentEnum.Displayname

    1. Eighth      Step (checked if SCSM db has that triplet…)

    I looked at SCSM database to be sure above value ($CartographyScopeList = Applicazioni Infrastrutturali\Applicazioni Infrastrutturali\Printing) exists in it. 😊

    I used EnumType table.

    The leaf value (Printing) has D70D687C-6C3F-A011-DFAA-4BE8AA64CC58 as ID, so I looked at it to identify the child value (Applicazioni Infrastrutturali) with ParentEnumTypeId field:

    Same step to collect last parent level (Applicazioni Infrastrutturali):

    Then I compared above values with that one got with Step 7:

    PS C:\4-CSV\ImportAssetSR\RGP_Update_Full\ps1> $parentEnum

    ordinal name                                              displayname                 

    ------- ----                                              -----------                 

    -1.125  Enum.e0d4a935da7842bfa0f494bf7a529af1             Applicazioni Infrastrutturali

    1       CartographyScopeList.ApplicazioniInfrastrutturali Applicazioni Infrastrutturali

    0       Enum.0f34235e5b4a4970a137085703558396             Applicazioni Infrastrutturali

    Question is: why Seventh Step doesn’t return any id ?

    Any help will be appreciated a lot.


    Grazie mille Alex

    Tuesday, May 01, 2018 3:39 PM