How to use CSVIMPORT.EXE to import devices

Version 14

    Verified Product Versions

    Endpoint Manager 9.5Endpoint Manager 9.6Endpoint Manager 2016.x

    Description

    This document covers how to use csvimport.exe to import machines into Bare Metal for LANDESK OS Provisioning.

     


    Question

     

    How to properly use CSVIMPORT.EXE to import devices.

     

    In order to properly import devices Network view, the proper formatting, syntax, and network information must be supplied.

     

    Answer

     

    Automating the naming of computers during an OS Deployment task reduces the work load of the IT department, saving time and money. OSD has the ability to work with sysprep to name computers based off Device Name in the database. It uses the Mac Address of a computer to match a device to the computer name associated with that Mac Address in the Database. Newly purchased computers do not exist in the LANDESK database as these computers have never been scanned. Such computers can be manually added to the database before deploying the image allowing the computers to be automatically named as part

    of an OS Deployment task.


    To accomplish this, LANDESK provides a utility called csvImport.exe to manually add devices to the database. This utility is located in the C:\Program

    Files\LANDESK\ManagementSuite directory.

     

    Adding devices to LANDESK using csvImport is a four step process:

     

    1.  Create a template

    2.  Create a .csv file

    3.  Run csvImport to generate mini-scans

    4.  Process the mini-scans

     

    Step 1 - Create a template file

     

    A template file is required by the csvImport utility. This file contains information about what content will be added to the inventory for a device created with the

    csvImport utility.

     

    (NOTE:  The template file is a plain text file. This file should be created in a plain text editor such as notepad.) Each line in the template file represents an entry that will be inserted into a miniscan file when csvImport.exe is run. This mini-scan processed by moving it to the ldscan directory, at which point the device is added to the database.

     

    Syntax

     

    The template file must be created following strict syntactical guidelines.

     

    (NOTE: Failure to follow the correct syntax could result in one or more of the following:

     

      1. An invalid template file.
      2. Entering invalid data into the database for the added devices.
      3. Entering no data or missing data in the database for the added devices.

     

    The syntax for each desired line is as follows:

    [<Heading> - <Heading> - <Head...>] - <Value name> = <Value Data>

        

     

    (NOTE:  The following characters are not used: <,>,[,]. These symbols are used to help clarify the syntax only.)

     

    The following line is an example of correct syntax for a line in the template file:

    Network - TCPIP - Subnet Mask = 255.255.255.0

        

     

    In this line, "Network" is the first heading while "TCPIP" is a sub heading. "Subnet Mask" is the Value Name and "255.255.255.0" is the Value Data.

     

    Heading

     

    Headings are not required as indicated by the square brackets []. There can be multiple headings. Default heading values can be seen in the Inventory of a fully scanned client on the left panel underneath the computer name.

     

    If a heading has a plus sign next to it, then more headings exist underneath the first heading. Expand any heading by clicking on the + sign and the default values for that heading will be displayed. Headings are not limited to the default values. Custom values may be used and will be entered into the database.

     

    Value Name

     

    This is a required field. Most default Value names can be seen in the right pane by highlighting any heading. All headings are visible in the left pane. If a Value Name is given without a heading, it will be entered under the computer name on the very top

    of left panel of the Inventory screen. Value Names are not limited to the default values. Custom values may be used and will be entered into the database.

     

    Value Data

     

    Value Data can be any date, string, or integer. It is not required to specify in the template file whether the Value Data will be a date, string, or ineger because this is automatically detected. Value Data can be specified with a variable that gets its value from the .csv file (see Variables as Value Data), or it can be statically entered (see Static Entries as Value Data).

     

    Variables as Value Data

     

    Variables are used to get data from the .csv file. The template file is created so each line contains data to enter into the database. The variable %<number>% describes the column in the .csv file from which the value of the variable will be assigned. %1% is or the first column, %2% is for the second column, %3 is for the third column, and so on.

     

    Static Entries as Value Data

     

    If a line does not have a variable (such asthe second line of the example below), the Value Data is considered static. No Column should be made in the .csv file for this line because the data will be the same for all devices. Only lines with a variable should have a column in the .csv file.

     

    Minimal Information Needed for OS Deployment

     

    OS Deployment will use database information to rename a computer. The minimum inventory a device needs is “Device Name” and “Network – NIC Address.” This means the template file must have at least the following two lines:

    Device Name = %1%

    Network - NIC Address = %2%

        

    Sample Template File

     

    The following is the text from a sample template file.

    Device Name = %1%

    Network - NIC Address = %2%

    Network - TCPIP - Subnet Mask = 255.255.255.0

    BIOS - Serial Number = %3%

    BIOS - Asset Tag = %4%

        

    Lines 1, 2, 3 and 5 use variables to get their data value from the .csv file. Line 3 gets its value from the assigned value in the template file.

     

    The following is the text from a sample template file for importing Bare Metal Devices.

     

         Scan Type = BAREMETAL
         Device Name = %1%
         Network - NIC Address = %2%
         Type = Bare Metal Provision
         OS - Name = Bare Metal

     

    The .csv file is an information file referenced by the csvImport. It should contain all the information for the computers that are being added to the database. This information can often come for the computervendor or it can be manually gathered from the computers. Remember that by using csvImport, the naming of computers can be automated through the imaging process. The man hours used to gather the data needed for the .csv file is significantly less than the man hours needed to manually rename every computer during or after the imaging process.

     

    Syntax

     

    In order for csvImport to understand the .csv file, it reads the template file. The

    template file determines how the .csv file should be created. Every variable in the

    template file refers to a column in the .csv file. While the columns are determined

    by the number of variables in the template file, the number of rows is determined by

    the number of computers; one row is needed for each computer.

     

    The following is the proper syntax

    value1,value2,value3,...

    value1,value2,value3,...

    ...

        

    Alternately a space can exist after each comma.

     

    (NOTE: The ellipsis “...” is not part of the syntax. This is used only to represent the

    idea that data for more columns and more rows can be added.)

     

    The following two lines are an example of correct syntax for a line in the .csv file:

    ComputerName1, 000ABBCCDD01, SN-0001, ASSETTAG-01

    ComputerName2, 000ABBCCDD02, SN-0002, ASSETTAG-02

        

     

    Though the above two lines have four columns, any number of columns is possible. The minimum should include columns for the Device Name and NIC Address. The number of columns and the type of data the column contains is directly related to the Template file.

     

    The Relationship between the Template File and the .csv File

     

    Below is a copy of the template file from the previous step:

    Device Name = %1%

    Network - NIC Address = %2%

    Network - TCPIP - Subnet Mask = 255.255.255.0

    BIOS - Serial Number = %3%

    BIOS - Asset Tag = %4%

        


    This sample template file has four variables %1%, %2%, %3%, %4%. This indicates that
    the .csv file will have four columns. Each column should contain the data for which the variable represents. For example, in the template file shown above, %1% stands for the NIC Address. Column one of the .csv file should contain only NIC Addresses; one NIC Address for each row, or each computer. Similarly, %2% represents the Serial Number for the BIOS. Column two of the .csv file should contain only BIOS Serial Numbers; one Serial Number for each row, or each row for each computer.

     

    Sample .csv File

     

    The following is a sample .csv file. This sample file has been created based on the sample template file using only four machines.

    ComputerName1, 000ABBCCDD01, SN-0001, ASSETTAG-01

    ComputerName2, 000ABBCCDD02, SN-0002, ASSETTAG-02

    ComputerName3, 000ABBCCDD03, SN-0003, ASSETTAG-03

    ComputerName4, 000ABBCCDD04, SN-0004, ASSETTAG-04

        

    (NOTE:  This can be created in any text editoror in any spreadsheet application. If created in a spreadsheet application, makesure the file is saved as a comma delimited .csv file. Also note that the commas are automatically inserted when creating a file using a spreadsheet application and should not be

    manually added in the spreadsheet.)

     

    Step 2 - Using the CSVImport utility

     

    The csvImport utility is used to create mini-scan files from a template file and a .csv file. It does not automatically enter these scans or create machines in the database.  Instead, it creates mini-scan files that must be placed in the ldscan directory so that the LANDESK Inventory service can process them. It is the LANDESK Inventory service that processes the mini-scans and adds the device to the database.

     

    Syntax

     

    The syntax for csvImport is as follows:

    csvImport <template file> <.csv file> <output directory>

        

    [template file = any template file]  [.csv file = any .csv file]  [output directory  = folder where mini-scans are created]

     

    The csvImport utility requires all three options (the template file, the .csv file, and the output directory) to be specified. Ifthese files are not in the directory from

    which csvImport is launched, then full paths may need to be specified.

     

    Example:

    csvImport c:\path\to\templatefile.txt c:\path\to\computers.csv c:\folder

        

     

    Running csvImport will result in the generation of mini-scan files, one for each device in the .csv file.

     

    Step 3 - Processing mini-scan files


    Mini-scan files are text files with a .IMS extension that contain information about a
    device. This is information is in plain text but is formatted so that the LANDESK

    Inventory service can read and process it. The LANDESK Inventory service uses the information from the mini-scan to add devices to the database.

    Mini-scans are created by csvImport as explained in Step 3.

     

    How to Process Mini-Scans

     

    To process the mini-scans, copy all the mini-scan files (files with a .ims extension) to the \Program Files (x86)\LANDESK\Managementsuite\ldscan directory on the core. These scans will be processed and deleted from the directory by the LANDESK Inventory service. The devices created from the mini-scans will be viewable in the LANDESK Console in the Network View under All Devices.

     

    Note: The core server will not process a mini-scan if it does not have [Network - NIC Address = ] in it.  The scans will be placed in the ErrorScan directory and no errors messages will be generated.

     

    Sample Mini-Scan

     

    The following information is the output of a sample mini-scan named csvImp2.ims.

     

    Notice that the mini-scan is in the same format as the template without variables.

    Device Name = COMPUTERNAME2

    Network - NIC Address = 000ABBCCDD02

    Network - TCPIP - Subnet Mask = 255.255.255.0

    BIOS - Serial Number = SN-0002

    BIOS - Asset Tag = ASSETTAG-02

        

     

    Creating a Mini-Scan in a Text Editor

     

    Understand that csvImport is a utility that automates the creation of mini-scans. The csvImport utility is not required to create mini-scans.  Manual creation of mini-scans can be done in a text editor if created withthe correct syntax. The syntax for a miniscan is the same as for a template file without the variables; all data must be static.)

     

    Test the following:

     

    1.  Create a text file with the following syntax. Put in any computer name and any NIC Address not already in the database

    Device Name = ANYNAME

    Network - NIC Address = 000123456789

        

     

    2.  Save the file as test.ims and copy the file to the ldscan directory for processing by the LANDESK Inventory service.

     

    3.  In the LANDESK Console, refresh All Devices under the Network View. The new device will exist.

     

    Sample Use of csvImport

     

    This section will demonstrate the use of csvImport, using example files and example computers.

     

    1.  Create a template file by opening a text editor and copying the information below. Save the file to c:\temp\template.txt.

    Device Name = %1%

    Network - NIC Address = %2%

    Network - TCPIP - Subnet Mask = 255.255.255.0

    BIOS - Serial Number = %3%

    BIOS - Asset Tag = %4%

        

     

    2.  Create a .csv file by opening a text editor and copying the information below. Notice that each column corresponds to a variable from the template file.

    Save the file to c:\temp\data.csv.

    ComputerName1, 000ABBCCDD01, SN-0001, ASSETTAG-01

    ComputerName2, 000ABBCCDD02, SN-0002, ASSETTAG-02

    ComputerName3, 000ABBCCDD03, SN-0003, ASSETTAG-03

    ComputerName4, 000ABBCCDD04, SN-0004, ASSETTAG-04

        

     

    3.  Open a command prompt and change to the C:\Program Files\LANDESK\ManagementSuite directory. Then run the following command:

    csvImport c:\temp\template.txtc:\temp\data.csv c:\temp

        

     

    4.  Once the above command is run, four .ims files (one for each computer), will be created in the c:\temp directly.
    Copy those files to the \Program Files (x86)\LANDESK\ManagementSuite\ldscan directory.

     

    5.  Open the console and go to the All Devices under the Network View to verify that the devices are added to the database.

     

    Summary


    This article has explained the four step process by which computers can be added to the database using csvImport.

     

      1. Creating a template
      2. Creating a .csv file
      3. Running csvImport to generate mini-scans
      4. Processing the mini-scans

     

    Adding devices to the database using csvImport is necessary only before OS Deployment using Sysprep and is used in conjunction with OS Deployment and Sysprep to automate the naming of computers that are not already in the database.

     

    Appendix A – Wake on LAN

     

    For sending a wake on LAN packet, the following is the minimal information needed:

    Device Name = %1%

    Network - NIC Address = %2%

    Network - TCPIP - Subnet Mask = 255.255.255.0

    Network – TCPIP - Address = %3%

    Network – TCPIP – Subnet Broadcast Address = %4%

        

     

    Since 9.6, to Wake up a device, the minimal information needed are the following:

     

    Device Name = %1%

    Network - NIC Address = %2%

    Network - TCPIP - Subnet Mask = 255.255.255.0

    Network – TCPIP - Address = %3%

    Network – TCPIP – Subnet Broadcast Address = %4%

    Device Name = %1%

    Network - NIC Address = %2%

    Network - TCPIP - Subnet Mask = 255.255.255.0

    BIOS - Serial Number = %3%

    BIOS - Asset Tag = %4%