Adding a multi-line value to NetInfo using niutil and Applescript

1. Create the file you want to load into the value as plain text and scp it to your destination server.
2. Create an applescript with the following text:
set the text_file to open for access file “Remote HD:path:to:file”
set text_of_file to read text_file
do shell script “niutil -createprop -t radmind/network /computer_lists/Peds\ Managed\ Classic mcx_settingss ‘” & text_of_file & “‘”
3. Save the applescript local, then scp it to the destination server
4. ssh to the destination server as root and run `osascript name_of_applescript`
5. Check with NetInfo Manager to see how things went.

It’s recommended to make the property you add to a non-critical one, then rename it later (example, mine uses mcx_settingss instead of the real mcx_settings value).
Your milage may vary, playing with NetInfo may make your machine very sick and unable to boot. You have been warned.

One thought on “Adding a multi-line value to NetInfo using niutil and Applescript

  1. You talk about inserting multiline text into a NetInfo property, but what about readng them back out.

    Whenever I use “nituil -read . /users/myuser” the output is screwed up because my mcx_settings is very long xml document. I cannot correctly parse the output without jumping through oops….grr. Have you seen how to get around this, you’re the only google hit!! Please email me privately if you get this. Thanks!

Comments are closed.