A while ago I have written a post about CSV Import of objects. Last time I was just mentioning about importing objects of specific classes. But what about importing objects of combination classes (aka type projections)? This would be the case if you for instance want to import a computer object (one class) and in the same step want to configure the primary user (wich is a relationship to another class). If this sounds interesting, read on.
So how does this work? The procedure is exactly the same as when importing regular classes objects. That means, we will use a CSV-file that holds the information about the objects we want to import. On the other side we use an XML-file that will be used to map the information from the CSV-file to specific attributes. So let’s say we want to import new computer objects and in the same step configure the primary user of the computer. For that we start with the XML-file.
First we have to make sure to select the correct type projection name, in this case “Microsoft.Windows.Computer.ProjectionType (instead of just a class as shown in the first Part). Because we are specifying a Projection, we need to specify the seed class, in this case the class “Microsoft.Windows.Computer”.
Where do you get this information from? There are several documents about that, but you can also find out yourself what the exact names of the projections and classes are by using Powershell with the smlets. There is a nice cmdlet called “get-scsmtypeprojection” that lists the available projections and also displays the seed classes.
So based on that information you are able to build the XML-file for the import. But for now, we only defined the properties of the computer class (the seed class). Because we also want to configure the Primary User attribute, we need to add some more fields to the XML-file that we can use to identify a user object.
Now we are ready to create the data file. Because we are now using Projections, the data file will contain values for two different classes. Make sure the order is exactly the one that was specified in the XML-file.
Now start the import process using the Service Manager Console. If the import was successful, the new computer object is created and the Primary User is specified.
Now we have to structure and just need to add more information to the files. One cool thing would be doing this automatically from an Excel document. If time permits I will write an article about that. Stay tuned.
I was looking in your post trying to figure out how to do this but with a Relationship.
I have a class extension of ChangeRequest with some new properties and a Relationship. Now I’m trying to do some magic to replicate the Work Items from the Production environment to the Development environment. So, I think that importing through the CSV connector is a way I can achieve that. Of course, I’m open to listen suggestions.
I appreciate if you can help me with some ideas.
Why not using Orchestrator?
I don’t have a Orchestrator in the production environment, but I will make a test in Development.
Can you CSV import Service Request?
Why do you want to import Service Requests?
We are migrating our Access control process to Service Requests.
OK, so why do you want to import them? Is it to document old, already fulfilled requests? If you want that, check out the CSV Import blog posts here, they explain the procedure …
Could you give me an example of the xml code used to import a Service request. Have you seen one? Been looking fro a while without any luck.
Some XML lines would be great to know what projection class to select and how to choose a certain Service request template, as i have about 12 Service requests. eg i have an Access Request Service Request and Meeting Assistance Service request templates.
When i use CSV what do i put in the xml to create an Access Request Service request instead of a Meesting assistance Service request, for example
Pingback: SCSM: Using multiple key properties in classes | marcelzehner.ch
How do I configure Format File when I multiple *unrelated* classes. Eg. do I have to have multiple blocks?
Here I have 1 Projection from the System.ConfigItem class.
I also have my own custom class property.
Alas, I get this odd error that seems to indicate to me that I’m fundamentally misunderstanding something:
Creating new CSVImporter
Data Filename: D:\PeterMP\VirtualServerUpoload.csv
Format Filename: D:\PeterMP\VirtualServerUpload-Format.xml
Validating against XSD schema…
The element ‘CSVImportFormat’ has invalid child element ‘Projection’.
Expected one child node of type \”Component\” or \”Class\” under Component node
Line number: 1, Position: 2
Could not initialize a Management Object Creator from format file D:\PeterMP\VirtualServerUpload-Format.xml. Import thread exiting.
What do you mean with “unrelated classes”? If they are not related you can import them separately. If you have related classes you need to use Type Projections. If you send me your files with a short description I can take a quick look at it.
Thanks, your phrase “If they are not related you can import them separately” helped clear up a misconception of mine that, in turn, allowed me to solve my problem.
Good to hear that Peter! Have fun importing things 🙂
Error: “Unknown alias SUS_WINDOWSCOMPUTER at node Component”
I have extended the Windows.Computer class in the SCSM Authoring Tool to create the extended class SUS_WindowsComputer class. The Authoring Tool gave that extended class the name :
Now I am trying to import via CSV into this extended class using the XML below, but I run into an error that I don’t know what I’m supposed to enter.
Here is the XML Format for the CSVImporter
Do you know how i add an object from type projection with powershell and not using a CSV-file?
CSV imports and updates, but how do i remove with Type Projection? (Have two classes i want to remove instances from)
I am attempting to import/ update Unix and Linux Computer CI’s from a CSV file. What am I missing?
Example CSV pattern-
Linux01.domain.com,Linux01.domain.com,hyper-v01.domain.com,Red Hat Enterprise Linux,7.1
My XML –
I am getting the following when I am trying to import the csv..
Creating new CSVImporter
Data Filename: D:\CSV_Import\TEST_Linux_Computers.csv
Format Filename: D:\CSV_Import\Linux_Computers.xml
Validating against XSD schema…
Could not find property named OSVersionDisplayName in class UnixComputerExtension
Line number: 13, Position: 14
Could not initialize a Management Object Creator from format file D:\CSV_Import\Linux_Computers.xml. Import thread exiting.
As a note…
OSVersionDisplayName is a property under the “Microsoft.Unix.ComputerHostsOperatingSystem” relationship type within the “UnixComputerExtension” class of the MP used.
I can’t post the XML….
Property ID=”PrincipalName” /
Property ID=”DNSName” /
Property ID=”HostServerName” /