<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Talk Tech To Me - GFI Blog &#187; Bernard Baldacchino</title>
	<atom:link href="http://www.gfi.com/blog/author/bernard-baldacchino/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gfi.com/blog</link>
	<description>Brought to you by GFI Software</description>
	<lastBuildDate>Fri, 09 Aug 2013 17:06:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>CSVDE – A Means to Simplify Active Directory Administration (Part 3)</title>
		<link>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=csvde-means-simplify-active-directory-administration-part-3</link>
		<comments>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-3/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 14:07:09 +0000</pubDate>
		<dc:creator>Bernard Baldacchino</dc:creator>
				<category><![CDATA[Tech Zone]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[CSVDE]]></category>
		<category><![CDATA[LDAP]]></category>

		<guid isPermaLink="false">http://www.gfi.com/blog/?p=1164</guid>
		<description><![CDATA[Importing Data from AD In Part 2 we  discussed how to export data from a working Active Directory installation. That was the easy part, now the real fun begins as we discuss how to import data to your Active Directory &#8230;]]></description>
				<content:encoded><![CDATA[<p><strong><a class="lightbox" title="CSVDE" href="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE1.jpg"><img class="alignright size-medium wp-image-1167" style="margin: 10px; border: 0px;" title="CSVDE" src="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE1-300x189.jpg" alt="" width="210" height="132" /></a>Importing Data from AD</strong></p>
<p>In Part 2 we  discussed <a href="http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-2/">how to export data from a working Active Directory installation</a>. That was the easy part, now the real fun begins as we discuss how to <em>import</em> data to your Active Directory installation. It is strongly suggested to try this out on a test scenario, and try this out as much as need until you are certain that you know what the different switches do, as this will affect your installation of AD.</p>
<p>There are a few things that need to be done before you can import data to your Active Directory installation. First of all you have to create a CSV file with all the details of your users, which requires some basic knowledge of LDAP properties, manipulation of strings in Excel and some basic knowledge of scripting (which will later allow you to enable all the accounts you have created with a simple double click!).</p>
<p><span id="more-1164"></span>First things first, what are LDAP Properties? Very simple, LDAP, or more fully Lightweight Directory Access Protocol, is an application protocol for querying and modifying directory services running over TCP/IP. A directory is a set of objects with attributes organized in a logical and hierarchical manner, or in plain English the properties of a user when you right click in Active Directory Users and Computers. There are countless options you can add, but for the sake of clarity we will stick to the 8 of the most basic ones you need to work with as described below:</p>
<p style="text-align: center;"><a class="lightbox" title="table1" href="http://www.gfi.com/blog/wp-content/uploads/2009/09/table1.PNG"><img class="aligncenter size-full wp-image-1165" title="table1" src="http://www.gfi.com/blog/wp-content/uploads/2009/09/table1.PNG" alt="" width="480" height="207" /></a></p>
<p>Now that we know what the fields we need are, we can start creating a CSV file. The easiest way to do this is by using a spreadsheet application, in this case Microsoft Excel, which has a built-in function that will create a CSV file by separating the columns with commas. Let us start creating our template in Excel. We will just create the first row and fill in the rest by clicking and dragging</p>
<p>It is very important that before you start you make sure that you have created the Organizational unit you will add the users to, as CSVDE is unable to create Organizational Units. For this example the OU that has been created is named Test.</p>
<p>Below you have an example, simply fill in the first row in your sheet (the ones in bold). Next fill in only the givenName and SN columns.</p>
<p><a class="lightbox" title="table2" href="http://www.gfi.com/blog/wp-content/uploads/2009/09/table2.PNG"><img class="aligncenter size-full wp-image-1166" title="table2" src="http://www.gfi.com/blog/wp-content/uploads/2009/09/table2.PNG" alt="" width="534" height="169" /></a></p>
<p>Now the real fun starts, as the rest of the columns will be filled using string manipulation formulas that are built-in in excel. First of all we must know what naming convention we will adhere to; in this case it will be the first letter of the first name and the entire surname.</p>
<p>Let us start off easy, by concatenating the contents of two different cells so as to create the name and CN fields:</p>
<p><em>=B2&amp;&#8221; &#8220;&amp;C2        </em></p>
<p>This will concatenate cells B2 and C3 with a space in the middle.</p>
<p>The sAMAccountName for our user will be jdoe, and will be created as follows:</p>
<p><em>=LOWER(LEFT(B2,1) &amp; (C2))         </em></p>
<p align="left">This will take the first letter on the left of cell B2  ‘LEFT(B2,1)’ and concatenate to the whole contents  of cell C2 using the ampersand (&amp;) and make sure it is all in lowercase (LOWER).</p>
<p>The process is similar for the userPrincipalName, but using the result of a previous formula:</p>
<p><em>=D2&amp;&#8221;@testdom.com&#8221;                 </em></p>
<p>This will concatenate the contents of cell D2 and append the name of the domain to it.</p>
<p>Finally the most complicated part, creating the Distinguished Name, which will use a combination of all the previous formulas to create a valid DN:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="605" valign="top"><em>=&#8221;CN=&#8221;&amp; B2 &amp; &#8221; &#8221; &amp; C2 &amp; &#8220;,&#8221; &amp; &#8220;OU=Test,dc=testdom,dc=com&#8221;</em> This will create a field containing the complete distinguished name by concatenating a series of text entries to different other cells.</td>
</tr>
</tbody>
</table>
<p>Now fill in the rest of the names and surnames and simply click and drag the other cells to completely fill the table for all your users.</p>
<p>To create a CSV file simply press F12 (Save As…) and select CSV (Comma Separated) as file type, click save and click ok on the prompt that pops up, which warns you that all formatting will be lost and that it won’t let you save multiple books.</p>
<p>The one CSVDE switch we will use to import is the -i switch. This will load the data from any CSV file that has been specified in the command, import the data into Active Directory, and you can also output a report log to a specified file.</p>
<p>The command to import is:</p>
<p><em>CSVDE -i -k -f test.csv</em></p>
<p>Let us break down the different switches:</p>
<p><strong>-i</strong>                             The import switch which tells CSVDE that it has to import not the standard export.</p>
<p><strong>-k</strong>                            Tells CSVDE to ignore all errors and continue importing data.</p>
<p>-<strong>f &lt;filename&gt;</strong>    Specifies the file name of the CSV file to be imported.</p>
<p>Now launch Active Directory Users and Computers so as to verify the users have been created.</p>
<p><strong>Tip:</strong> Before running the CSVDE command, browse to the location of the CSV file so at to avoid typing long UPN path names which make for needless errors. eg. If the CSV file is stored in the Administrator’s documents make sure you have browsed to C:\Documents and Settings\Administrator\ before running the CSVDE command.</p>
<p>However, CSVDE has a limitation; it does not offer the functionality to enable the accounts that have just been created. Do not worry though, you will not have to enable the hundreds of accounts you have added one by one. There are various scripts available online that, with little editing, can help you enable all these accounts, along with the various flavours of the LDAP Property UserAccountControl, this gives you some flexibility on how and what exactly you can do. A good set of scripts and explanations of how they work and how to edit them can be found at the <a href="http://www.computerperformance.co.uk/ezine/ezine23.htm">Computer Performance</a> website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSVDE – A Means to Simplify Active Directory Administration (Part 2)</title>
		<link>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=csvde-means-simplify-active-directory-administration-part-2</link>
		<comments>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-2/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 09:40:00 +0000</pubDate>
		<dc:creator>Bernard Baldacchino</dc:creator>
				<category><![CDATA[Tech Zone]]></category>
		<category><![CDATA[Active Directory]]></category>

		<guid isPermaLink="false">http://www.gfi.com/blog/?p=1009</guid>
		<description><![CDATA[In the first article of this series we discussed what CSVDE is and why you should use it. I will now discuss how to export data from Active Directory and how to import it in Microsoft Excel using CSVDE as well &#8230;]]></description>
				<content:encoded><![CDATA[<h2><a class="lightbox" title="CSVDE" href="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE.jpg"><img class="alignright size-medium wp-image-1011" style="margin: 10px; border: 0px;" title="CSVDE" src="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE-300x189.jpg" alt="" width="300" height="189" /></a></h2>
<p>In the first article of this series we discussed <a href="http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-1/">what CSVDE is and why you should use it</a>. I will now discuss how to export data from Active Directory and how to import it in Microsoft Excel using CSVDE as well as touch on some basic data manipulation commands.</p>
<h2>Exporting Data from AD</h2>
<p>The easiest way to learn CSVDE is through a baptism by fire - try out the commands yourself. However, most of you will think “How can I experiment with AD without ruining my setup?” The easiest way to do this is by learning to use the export commands, which simply exports data and does not in any way modify the setup that there is in place.</p>
<p><span id="more-1009"></span>When using the CSVDE tool, the command will always be formatted as follows:<br />
CSVDE &lt;-switch&gt;  or  CSVDE &lt;-switch&gt; &lt;switch requirement&gt;</p>
<p style="text-align: left;">Example:<br />
CSVDE –<em>f users.csv</em> runs the default CSVDE function, exporting all data to a file users.csv</p>
<p style="text-align: center;"><a class="lightbox" title="CSVDE - Pt 2" href="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE-Pt-2.JPG"><img class="size-medium wp-image-1132 aligncenter" style="margin-top: 10px; margin-bottom: 10px; border: 0px;" title="CSVDE - Pt 2" src="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE-Pt-2-300x142.jpg" alt="" width="300" height="142" /></a><br />
CSVDE -<em>f onlyusers.csv -r &#8220;(&amp;(objectClass=user)(objectCategory=person))&#8221;</em> exports only the specified details to users.csv.</p>
<p>The easiest way to view the data that has been exported by CSVDE is to locate the CSV file that was created, and open it using your favourite spreadsheet utility (all of them work, but here all examples will refer to Microsoft Excel). Note that CSVDE always exports to or imports from the current directory you are browsing in command prompt, thus if you are currently in c:\ it will save the files to c:\.</p>
<p>There a various switches that can be used and here&#8217;s <a href="http://www.computerperformance.co.uk/Logon/Logon_CSVDE_switches.htm" target="_blank">a complete list with a full description</a>. Here we will only discuss a few of the commands.<br />
 <br />
The most commonly used export switches:</p>
<ul>
<li><strong>-f</strong>  Specifies file name to export to:<br />
<em>CSVDE –f example.csv<br />
</em>Note: Try not to use this switch alone, as it will export too much data for it to be comprehensible and thus useful to us.</li>
<li><strong>-d</strong> Specifies a particular Object to export, such as an OU:<br />
<em>CSVDE -d &#8220;OU=&lt;ouname&gt;,DC=&lt;domainname&gt;,dc=com&#8221; -f example.csv<br />
</em></li>
<li><strong>-r</strong> Specifies which rows you want to export, such as users using the objectClass or object category:<br />
 <em>CSVDE –f example.csv –r objectClass=Person</em><br />
You can even combine multiple objects in your filter:<br />
<em>CSVDE -f userdata2.csv -r &#8220;(&amp;(objectCategory=person)(objectclass=user))&#8221;<br />
</em></li>
<li><strong>-L</strong> Specifies which LDAP fields, or columns, will be exported, separated by a comma:<br />
 <em>CSVDE –f example.csv –l &#8220;DN, objectClass, givenName, sn, name&#8221;</em><br />
<strong><span style="text-decoration: underline;">IMPORTANT!<br />
</span></strong>Do not mix <strong>–l</strong> with <strong>–i</strong> as they are used for two completely different things, thus since CSVDE is not case sensitive it would be wise to use <strong>–L</strong> to avoid confusion.</li>
<li><strong>-m</strong> Used to exclude Active Directory properties such as the ObjectGUID, objectSID, pwdLastSet  and samAccountType attributes.</li>
<li><strong>-n</strong> Used to exclude binary values from the exported CSV file.</li>
</ul>
<p>Thus, for example let us imagine you are an administrator, and you have been contacted by HR to produce a list of all the users in the Sales OU, with their Full Name, Logon and full distinguished name and without other junk such as binary data and so on. The command used to produce such a CSV file would be:</p>
<p><em>CSVDE -d &#8220;OU=Test,dc=bernard8,dc=com&#8221; -m -n -f testou.csv -r objectclass=user -l &#8220;name, userPrincipalName,dn&#8221;</em></p>
<p>In this case the first line of the CSV file would read:</p>
<p>DN,name,userPrincipalName</p>
<p>&#8220;CN=John Smith,OU=Test,DC=test,DC=com&#8221;,John Smith,jsmith@test.com</p>
<p>For some reason CSVDE sorts the LDAP fields in its own way no matter how you enter the data.</p>
<p>Now you should be <a href="http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-3/">confident enough with CSVDE to be ready to try the import switch</a>, which we will discuss in part 3 of this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSVDE – A Means to Simplify Active Directory Administration (Part 1)</title>
		<link>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=csvde-means-simplify-active-directory-administration-part-1</link>
		<comments>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-1/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 13:27:31 +0000</pubDate>
		<dc:creator>Bernard Baldacchino</dc:creator>
				<category><![CDATA[Tech Zone]]></category>
		<category><![CDATA[Active Directory]]></category>

		<guid isPermaLink="false">http://www.gfi.com/blog/?p=990</guid>
		<description><![CDATA[One of the most thoroughly used functions on Windows Servers is Active Directory. This can literally hold all information about your users, your corporate organization and corporate contact information. This data is invaluable, and is constantly changing, so keeping it &#8230;]]></description>
				<content:encoded><![CDATA[<p><a class="lightbox" title="CSVDE" href="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE.jpg"><img class="alignright size-medium wp-image-1011" style="margin: 10px; border: 0px;" title="CSVDE" src="http://www.gfi.com/blog/wp-content/uploads/2009/09/CSVDE-300x189.jpg" alt="" width="300" height="189" /></a>One of the most thoroughly used functions on Windows Servers is Active Directory. This can literally hold all information about your users, your corporate organization and corporate contact information. This data is invaluable, and is constantly changing, so keeping it documented and up to date is often a tedious task which consumes a lot of resources. What if you could export this data, and manipulate it in spreadsheets? If your job involves working with Active Directory you will find that there is a command line tool designed precisely for this purpose, and it is really easy to use.</p>
<h2><span id="more-990"></span>What is CSVDE and why should I use it?</h2>
<p>Comma Separated Value Data Exchange (CSVDE) actually comes built-in Windows 2003 Server installations (normally in %windir%/system32 directory). A comma-separated value (CSV) file is usually a plain text file, with the data contained in rows and columns separated by commas (,). This makes it relatively easy to decipher and most common spreadsheet applications (such as Microsoft Excel or OpenOffice Calc) can open it without making any modifications to the file and display it organized neatly in rows and columns.</p>
<p>CSVDE can be used both to export data about a current Active Directory Configuration, the easiest thing that will in no way effect your working configuration, and to import data into a new installation of Active Directory, which is not recommended unless you are doing so on a test setup or is closely familiar with the intricacies of CSVDE. When importing data using CSVDE, it will directly affect your system since data is being added and manipulated. Ideally this should be first tried out in a test scenario which does not affect a live installation.</p>
<p>In the next article we will discuss <a href="http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-2/">how to export data from Active Directory and how to import it in Microsoft Excel using CSVDE </a>as well as touch on some basic data manipulation commands. Finally in the last part, we will also discuss how to create a template using an Excel worksheet, create a CSV file and how to import data into Active Directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gfi.com/blog/csvde-means-simplify-active-directory-administration-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

 Served from: www.gfi.com @ 2013-08-12 15:15:00 by W3 Total Cache --