Trying to import Enumerations for HW Asset Types and not finding how to do this
1. I have been able to import other things like Vendors and Organizations just fine
2. This is not the main HW Assets, but its the enumerations - so when I go to Administration - Connectors and add a new Connector, I don't need in the Target Class and Combination Class a dropdown for the HW Asset Types , thus I don't know how to add these enumerations.
Thoughts?
Best Answer
-
Justin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭@Thomas_Stickel - Ordinal is necessary. It's the order in which the list values are displayed.
It is likely that powershell can't handle the special characters without some additional edits to the script.
I'd like to point out that this is not a typical way to introduce list values. Although it's possible to use this script, it's more typical(and may actually require less effort) to enter the list values manually through the console.1
Answers
1. What exactly would I update? I almost prefer to do an SSIS ETL to import into a table ... but I think I'm severity lacking the knowledge of the schemas.
2. Would there be a specific Table to import into that you know of ( Microsoft's servicemanager database? )
3. If you are not familiar with the table structure ( i'm sure that sure are though) - can you give me an example of how I can import this with powershell ?
4. Parent | Enumerations | Ordinal
Computer | Desktop | 1
Infrastructure | Blade | 7
thanks in advance
Just a note on your previous question: editing the SQL tables directly is inadvisable as that leaves your SCSM environment in an unsupported state for Microsoft.
I'm working on a powershell method of bringing enum values in by consuming your CSV.
Problem is that I didn't see the enum list in the Connectors ... So where can i have SCSM create a management pack for me for the HW Asset Types (enum lists) ? thx
https://techcommunity.microsoft.com/t5/System-Center-Blog/Create-List-Items-aka-EnumerationValues-In-Bulk-Using/ba-p/341420?advanced=false&collapse_discussion=true&q=create%20list%20items%20in%20bulk&search_type=thread
Here's a link to some powershell that will consume a CSV(attached as well for a reference). I haven't tested it super-thoroughly, but it does seem to be functional and effective. It's hardcoded for Hardware Asset Type, but it could be adapted for other Enums.
CSV Imports for Enumeration Lists
Then I added the path to the CSV file. This is the powershell error that I received . thoughts?
What I do to find the proper name of enums is just go into powershell and do something like "get-scsmenumeration classification" (ie for Incident Classification) This might bring back way more than you wanted, but you can reason out through the returned values what is the root enum and provide that to the script. I would make sure to include a $ at the end of the enum name though because if you don't, the call to get-scsmenumeration will bring back multiple results and the script will fail later on because the $enum variable will be an array and not a single enum.
example is
Model
.....
1. How do I find what the name of the $mpName and $enum (yes i know those names are variables and can be anything, but just for reference on your powershell script) should be ?
2. Then the names in the foreach specific - well i suppose it mostly just uses the combination of the variables and looping over and if there is nested objects ( which in this name of the models.csv that is not the case)
thx again in advance Justin. - Soon I will leave you alone thx
Where do i find the equivalent of these for Models?
Administration/ManagementPacks doesn't seem to show Cireson.AssetManagement.HardwareAssetTypeEnum
$enum is the enum you're looking for. In the case of Asset type, it's the Enum that's in the script. In the case of Model, it's Cireson.AssetManagement.CatalogItemModelEnum. Like I said above, you can find the name of the Enum you're looking for by doing a get-scsmenumeration in powershell with some relevant part of the name acting as a search pattern. (ie get-scsmenumeration model)
I know to use the first one. However for Models should it look like this?
(management pack mpName i'm still not sure about how to find that one , but the $enum should be correct i think)
thx again
I modified the other powershell script that you gave to me and i ended up in the foreach loop with just this line
Add-SCSMEnumeration -Parent $enum -Name ($enum.Name + "." + $t.Model.Replace(' ','')) -DisplayName $t.Model -Ordinal 10 -ManagementPack $mp
Clearly I must be needing to
1. Have a way of handling Ordinal ( I tried to put in 1 and then 10 ) otherwise if i omit it, i will prompt me to enter a number on each loop
2. perhaps i will also need to look to escape certain characters? example : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
thx again ( yes i believe i understand ur saying "$mpName is the name of the Management Pack the script is generating." thus i can literally make it up ... )
thx tom
It is likely that powershell can't handle the special characters without some additional edits to the script.
I'd like to point out that this is not a typical way to introduce list values. Although it's possible to use this script, it's more typical(and may actually require less effort) to enter the list values manually through the console.