Best Practice Ezine #55 CSVDE

Best Practice Ezine.  Computer Performance. Advertise

Best Practice Ezine #55 CSVDE

I truly believe that my advice will save newcomers to CSVDE, or those having a refresher a great deal of time and frustration.  I also have two tips that may surprise you.  Firstly, even if your mission is to bulk import users, always start with CSVDE export.  My thinking is this, with CSVDE export you can gain expertise with out the risk of swamping your domain with failed import experiments.   If you examine an export in Excel, you are sure to get ideas for more LDAP attributes that you can add to the import. 

This leads to my second CSVDE tip, concentrate on the LDAP attributes.  The real skill lies in the spreadsheet, not with the CSVDE switches.  CSVDE -i -f filename.csv is all you need to know on the CSVDE side, but mastering those LDAP attributes in the first row of the spreadsheet, is half a day’s work.

Guy Recommends: Tools4ever’s UMRAUMRA The User Management Resource Administrator

Tired of writing scripts? The User Management Resource Administrator solution by Tools4ever offers an alternative to time-consuming manual processes.

It features 100% auto provisioning, Helpdesk Delegation, Connectors to more than 130 systems/applications, Workflow Management, Self Service and many other benefits. Click on the link for more information onUMRA.

Guy’s CSVDE Litmus tests

It’s a while since I have had one of my Litmus tests.  If you remember Guy’s ‘Litmus tests’ asks a simple question, and the answer tells you instantly if you’re dealing with amateurs or professionals.

Litmus Test 1 – Where is the CSVDE ou switch?
Amateurs look for a CSVDE switch to specify the import OU.
Professionals know that you have to set the OU in the spreadsheet using the DN attribute.  There is nothing like a CSVDE -OU switch.

Litmus Test 2 – How should you save the Excel file?
Amateurs just create .csv files
Professionals create .xls or even .xlt files before the SAVE as .csv

One of the higher-level skills with CSVDE (and VBScript) spreadsheets, is deriving one LDAP field from another LDAP field.  For example, creating sAMAccountName by employing Excel’s =left(text,4) function then joining givenName and sn.  My tip here is remember to save the spreadsheet as an .xls, before you Save AS CSV.  If you do not heed my tip, then you will lose all those lovely formulae.

Guy Recommends: The Free IP Address Tracker (IPAT) IP Tracker

Calculating IP Address ranges is a black art, which many network managers solve by creating custom Excel spreadsheets.  IPAT cracks this problem of allocating IP addresses in networks in two ways:

For Mr Organized there is a nifty subnet calculator, you enter the network address and the subnet mask, then IPAT works out the usable addresses and their ranges. 

For Mr Lazy IPAT discovers and then displays the IP addresses of existing computers. Download the Free IP Address Tracker

Litmus Test 3 – Where to put a space in the CSV commands?
Amateurs put a space between the minus and the CSVDE switch. CSVDE –  i (Wrong)
Professionals know it’s CSVDE -f filename.csv not CSVDE – f filename.csv.

Litmus Test 4 – Which filter switches should you use with CSVDE?
Amateurs only use the -m or -n parameters or switches.
Professionals use the CSVDE -d, r, or l switches

Here is another tip, if you do get a CSVDE error message, naturally read it very carefully for clues. Then if the message says, ‘Add error on line 2:’, it means there is probably a fatal error with all your spreadsheet rows. However, if the message, says Add error on line 31: then ask your self, why did the first 30 work and now I have an error on line 31?

I have to confess to discovering a bizarre error.  As you probably know it is possible to paste into the command prompt, however when you click on that paste menu, sometimes you inadvertently introduce an extra phantom character.  It looks like a small o and is only visible in Word for Windows.  The scenario is that you paste into the command prompt menu, but the command fails even though you know that the CSVDE syntax is perfect.  Knowledge is power and once you realise this strange behaviour, there are two obvious solutions, clean the text in Word before you paste, or type it by hand!

See more on CSVDE – Whole Section here