Import a apple supplied computer info file

bmweeks
New Contributor

So we have just ordered 1850 MacBook Air computers for our school district. Now apple is gonna asset tag and image them at the factory with a image I have made. So it will have the JAMF helper on it. Apple will then send me a file with all the info from the computer (asset tag, serial #, Mac address, etc.) I know that when come on online on our network they will report some of this info but the asset tag and who it assigned to will have to be entered manually. Is there any way to import the file that apple sends me so that info will not have to be entered manually.

Thanks,
Brian Weeks

2 ACCEPTED SOLUTIONS

lance_ogletree
Contributor
Contributor

Brian and Don,
take a look at the SDK, specifically the JSS Computer Importer example application.
http://www.jamfsoftware.com/developer-resources/
It may have the functionality you're looking for.

--From the application PDF

The JSS Computer Importer was designed to provide example code for developers interested in developing applications that interact with the JSS API. The primary function of the JSS Computer Importer is to import the following fields from a CSV file to create and update computers in the JSS:
• Asset Tag
• Platform
• Computer Name
• Make
• Model
• MAC Address
• Serial Number
• Username
• Phone
• Real Name
• Department
• Building
• Email Address
• Position
• Room
• Purchased
• Leased
• PO Number
• PO Date
• Warranty Expiration Date
• AppleCare ID
• Lease Expires
• OS AppleCare ID
• OS Maintenance Expires

View solution in original post

mm2270
Legendary Contributor III

Two things I ran into the first time I used the JSS Computer Importer. These may have been addressed by now, but not really sure. The "JSS Computer Importer - Cocoa" application in the SDK I just downloaded still lists a modification date of Aug 12, 2010, so I think these issues are still there.

First, the Purchased and Leased columns, P & Q (or 16, 17) are supposed to be formatted in lower case. If you do a QuickLook on the ImportExample csv on the disk image, you'll see those words in lower case. HOWEVER, if you open it in Excel for editing, it automatically capitalizes these b/c Excel sees words TRUE and FALSE as logical values. So, if you make any edit to the file, save and import, you will get an error from the importer tool, or it will crash. To get around this, you'll have to use something other than Excel to edit your final file. From my experience, Apple's Numbers treats them the same way, so no help there. If you have BBEdit, you can make the initial changes in Excel, save, open in BBEdit and do a global find/replace to change any TRUE to true and FALSE to false, then save and import.
Looking at the file you posted to your OS X Server, I see those fields in cap format, so that is likely the issue.

Second, the only columns that actually MUST to be filled in in addition to MAC Address and Computer Name are the first and last, and there must be exactly 24 (columns A - X) even if all the others are blank. Any more or less will cause an error on import. Check that as well, but as I said, the capital TRUE/FALSE words are likely your culprit.
EDIT: Actually I think its just the last column (OS Maintenance Expires) that must be filled in, not the first, but I can't check that right now.

Since the Importer tool is just an example application and not something really intended to be used by customers, it likely hasn't been updated, but I feel it should be at some point.

View solution in original post

15 REPLIES 15

donmontalvo
Esteemed Contributor III

Importing CSV into JSS has been a feature request for a long time. We often have to manually install lists, very tedious. JAMF released JSSConduit.jar which lets you import IP addresses that conform to a specific format (unfortunately doesn't handle CIDR lists). So hoping JAMF elves are burning the midnight oil crafting a CSV import tool. :)

https://jamfnation.jamfsoftware.com/article.html?id=199

Don

--
https://donmontalvo.com

lance_ogletree
Contributor
Contributor

Brian and Don,
take a look at the SDK, specifically the JSS Computer Importer example application.
http://www.jamfsoftware.com/developer-resources/
It may have the functionality you're looking for.

--From the application PDF

The JSS Computer Importer was designed to provide example code for developers interested in developing applications that interact with the JSS API. The primary function of the JSS Computer Importer is to import the following fields from a CSV file to create and update computers in the JSS:
• Asset Tag
• Platform
• Computer Name
• Make
• Model
• MAC Address
• Serial Number
• Username
• Phone
• Real Name
• Department
• Building
• Email Address
• Position
• Room
• Purchased
• Leased
• PO Number
• PO Date
• Warranty Expiration Date
• AppleCare ID
• Lease Expires
• OS AppleCare ID
• OS Maintenance Expires

bmweeks
New Contributor

So I downloaded the importer app. when I put all the info into the csv and import on the coco app it crashed and on the windows side it say "index was outside the bounds of the array." i have attached a link the csv file see if you can find and problems.

http://wiki.groesbeck.k12.tx.us/importexample.csv

Thanks,
Brian Weeks

lance_ogletree
Contributor
Contributor

Check the formatting on the fields that have dates in them. They need to be in the format of YYYY-MM-DD.

bmweeks
New Contributor

changing the date did not fix the error.

mm2270
Legendary Contributor III

Two things I ran into the first time I used the JSS Computer Importer. These may have been addressed by now, but not really sure. The "JSS Computer Importer - Cocoa" application in the SDK I just downloaded still lists a modification date of Aug 12, 2010, so I think these issues are still there.

First, the Purchased and Leased columns, P & Q (or 16, 17) are supposed to be formatted in lower case. If you do a QuickLook on the ImportExample csv on the disk image, you'll see those words in lower case. HOWEVER, if you open it in Excel for editing, it automatically capitalizes these b/c Excel sees words TRUE and FALSE as logical values. So, if you make any edit to the file, save and import, you will get an error from the importer tool, or it will crash. To get around this, you'll have to use something other than Excel to edit your final file. From my experience, Apple's Numbers treats them the same way, so no help there. If you have BBEdit, you can make the initial changes in Excel, save, open in BBEdit and do a global find/replace to change any TRUE to true and FALSE to false, then save and import.
Looking at the file you posted to your OS X Server, I see those fields in cap format, so that is likely the issue.

Second, the only columns that actually MUST to be filled in in addition to MAC Address and Computer Name are the first and last, and there must be exactly 24 (columns A - X) even if all the others are blank. Any more or less will cause an error on import. Check that as well, but as I said, the capital TRUE/FALSE words are likely your culprit.
EDIT: Actually I think its just the last column (OS Maintenance Expires) that must be filled in, not the first, but I can't check that right now.

Since the Importer tool is just an example application and not something really intended to be used by customers, it likely hasn't been updated, but I feel it should be at some point.

bmweeks
New Contributor

Got it figured out. It turns out the the Mac Address has to be upper case. So I changed it and everything import successively. Thanks for all the help.

Brian Weeks

jarednichols
Honored Contributor

So I've gotten an "Import complete" message from the importer tool but machines aren't actually in my inventory.

Ideas?

jarednichols
Honored Contributor

Nevermind. Figured that bit out. In the same vein, anyone ever modify the JSS importer to add in management account information? I can't seem to get mine to stick.

jarednichols
Honored Contributor

Nevermind. Figured that out too. Helps if you read your XML files correctly!

tmalo627
New Contributor

I'm looking at the import example, but there are a few columns I'm unsure they're supposed to be for. Does anyone have the table headings?

EDIT: Ok I found my own answer on this in the documentation provided. Guess I should have read that.

But in regards to "So I've gotten an "Import complete" message from the importer tool but machines aren't actually in my inventory.

Ideas? "

What solved your problem there?

jarednichols
Honored Contributor

The read me with the code example tells you the order that the columns go in. You can also open the project in Xcode and the names of them are there in a fairly self-explanatory manner. You can also extend the use of the importer by following the format set forth in the code. I was able to pre-populate management account information as well as some other things.

tmalo627
New Contributor

Thanks for the help Jared. I got the order of the fields right and ran the importer and got the "Import Complete" message. But like you mentioned earlier, the computers are not showing up in my inventory. What fixed your problem there?

jarednichols
Honored Contributor

I did indeed needed to ensure the final field in each row of the the CSV had something in it. If it was blank, I was seeing "success"

dba_nc
New Contributor III

Am I correct that adding computers to a JSS manually via CSV file does not actually enroll the device for management capability?

Is installing QuickAdd pkg the only way to enable management on the device? How else would the JAMF binary get on a machine?

Thank you!

David