{"id":15,"date":"2007-06-10T23:58:04","date_gmt":"2007-06-10T23:58:04","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=15"},"modified":"2023-01-16T08:24:22","modified_gmt":"2023-01-16T08:24:22","slug":"creating-an-extensible-ma","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/creating-an-extensible-ma","title":{"rendered":"Creating an Extensible MA"},"content":{"rendered":"<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Here&#8217;s a quick walkthrough of creating an XMA. It&#8217;s by no means complete or authoritative, and just shows a method I&#8217;ve found success with. The example is creating Netware home directories, something I recognize most people don&#8217;t need to do these days, but it&#8217;s a flexible method which I have used for other scenarios as well.<\/span><\/p>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span style=\"font-family: Arial;\">Step 1 &#8211; Create the MA<\/span><\/h3>\n<ol style=\"margin-top: 0cm;\" type=\"1\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\">Create an Extensible MA in Identity Manager. <\/span><\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\">On the Properties page, after entering a name for the MA, untick the separate process option, as it will stop you being able to debug your code.<\/span><\/li>\n<\/ol>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 270px; height: 35px;\" src=\"https:\/\/www.wapshere.com\/images\/xma-seperateprocess.GIF\" width=\"270\" height=\"35\" align=\"middle\" \/><\/p>\n<ol start=\"3\">\n<li>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\">On the Configure Connection Information page, I always tick the <strong>Import and Export<\/strong> option. I really don&#8217;t know what circumstances might need an Import-only or Export-only MA &#8211; perhaps I&#8217;ll find out one day.<\/span><\/p>\n<\/li>\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\">For the Connected Data Source extension name just put the name of the dll you will write &#8211; it doesn&#8217;t matter if it doesn&#8217;t exist yet. The convention is <em>MAName<\/em>_CSExtension.dll.<\/span><\/li>\n<\/ol>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 348px; height: 219px;\" src=\"https:\/\/www.wapshere.com\/images\/xma-connection.GIF\" width=\"348\" height=\"219\" align=\"middle\" \/><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\">\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt 36pt;\">\u00a0<\/p>\n<ol style=\"margin-top: 0cm;\" start=\"5\" type=\"1\">\n<li class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\">On the Configure Attributes page, you need to tell MIIS the attributes in the <a href=\"https:\/\/www.wapshere.com\/missmiis\/?page_id=8#CDS\" target=\"_blank\" rel=\"noopener noreferrer\">CDS<\/a>, because MIIS doesn&#8217;t know how to go and find them out itself. On the Advanced tab you specify the object type &#8211; you can only have one object type in an XMA, but you can call it whatever you like.<\/span><\/li>\n<\/ol>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 463px; height: 384px;\" src=\"https:\/\/www.wapshere.com\/images\/xma-attribs.GIF\" width=\"463\" height=\"384\" align=\"middle\" \/>\u00c2\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\">\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt; tab-stops: list 36.0pt;\"><span style=\"font-family: Times New Roman;\">Most of the rest of the MA config pages are similar to all MAs, and should not need explanation.<\/span><\/p>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span style=\"font-family: Arial;\">Step 2 &#8211; Create the CSExtension<\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">In Identity Manager, highlight your new MA and click <strong>Create Extension Projects<\/strong>. Select the Project Type and change the Project Name as shown here:<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 539px; height: 239px;\" src=\"https:\/\/www.wapshere.com\/images\/xma-createcsext.GIF\" width=\"539\" height=\"239\" align=\"middle\" \/><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">This will give you a skeleton project with the procedures GenerateImportFile, BeginExport, ExportEntry and EndExport to be filled in by you.<\/span><\/p>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span style=\"font-family: Arial;\">Step 3 &#8211; Export Steps<\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">I&#8217;ll look at the Exports first. The BeginExport and EndExport subs are run once at the start and end of the whole export and are used to establish and end your connection to the <a href=\"https:\/\/www.wapshere.com\/missmiis\/?page_id=8#CDS\" target=\"_blank\" rel=\"noopener noreferrer\">CDS<\/a>. The ExportEntry sub is run for each object exported.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\u00a0<\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">I tend to maintain a SQL table alongside the CDS where I can record extra information about the objects. So, taking my Netware home directory example, I have a table in a SQL database on the MIIS server with these columns:<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\">\u00a0<\/p>\n<table class=\"MsoTableGrid\" style=\"border-collapse: collapse;\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 73.45pt; background-color: transparent; border: windowtext 1pt solid; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\" width=\"98\"><strong><span style=\"font-size: medium;\"><span style=\"font-family: Times New Roman;\">Path<\/span><\/span><\/strong><\/td>\n<td style=\"border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; border-left: #ece9d8; width: 71.65pt; border-bottom: windowtext 1pt solid; background-color: transparent; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\" width=\"96\"><strong><span style=\"font-size: medium;\"><span style=\"font-family: Times New Roman;\">DN<\/span><\/span><\/strong><\/td>\n<td style=\"border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; border-left: #ece9d8; width: 76.3pt; border-bottom: windowtext 1pt solid; background-color: transparent; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\" width=\"102\"><strong><span style=\"font-size: medium;\"><span style=\"font-family: Times New Roman;\">Server<\/span><\/span><\/strong><\/td>\n<td style=\"border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; border-left: #ece9d8; width: 77.95pt; border-bottom: windowtext 1pt solid; background-color: transparent; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\" width=\"104\"><strong><span style=\"font-size: medium;\"><span style=\"font-family: Times New Roman;\">Volume<\/span><\/span><\/strong><\/td>\n<td style=\"border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; border-left: #ece9d8; width: 76.35pt; border-bottom: windowtext 1pt solid; background-color: transparent; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\" width=\"102\"><strong><span style=\"font-size: medium;\"><span style=\"font-family: Times New Roman;\">Folder<\/span><\/span><\/strong><\/td>\n<td style=\"border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; border-left: #ece9d8; width: 67.1pt; border-bottom: windowtext 1pt solid; background-color: transparent; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\" width=\"89\"><strong><span style=\"font-size: medium;\"><span style=\"font-family: Times New Roman;\">Status<\/span><\/span><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-family: Times New Roman;\">The Path is the primary key of the table. The DN is the owner&#8217;s &#8211; and this field allows me to join back to the user object in the metaverse. Status may contain &#8220;adding&#8221;, &#8220;active&#8221;, &#8220;archived&#8221;, or &#8220;deleted&#8221;. I could also add fields for dates and comments if I wanted to improve my logging.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">So, in my code, the ExportEntry step calls scripts that create the homedir itself, and then enter information into the SQL table to record the fact.<\/span><\/p>\n<blockquote>\n<p><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\">Public<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> <span style=\"color: blue;\">Sub<\/span> ExportEntry(<span style=\"color: blue;\">ByVal<\/span> modificationType <span style=\"color: blue;\">As<\/span> ModificationType, <span style=\"color: blue;\">ByVal<\/span> changedAttributes <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>(), <span style=\"color: blue;\">ByVal<\/span> csentry <span style=\"color: blue;\">As<\/span> CSEntry) <\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">Implements<\/span> IMAExtensibleCallExport.ExportEntry<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> <br \/><span style=\"color: green;\">&#8216;A CS object has already been created by the provisioning code<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> server <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span> = csentry(&#8220;Server&#8221;).Value <\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> volume <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span> = csentry(&#8220;Volume&#8221;).Value <\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> folder <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span> = csentry(&#8220;Folder&#8221;).Value <\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> path <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span> = &#8220;\\&#8221; server &amp; &#8220;&#8221; &amp; volume &amp; &#8220;&#8221; &amp; folder<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 If<\/span> modificationType = modificationType.Add <span style=\"color: blue;\">Then<\/span><\/span><br \/><span style=\"font-size: 8pt; color: green; font-family: 'Courier New';\">\u00a0 &#8216;Check it is not already in the SQL table<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 If<\/span> <span style=\"color: blue;\">Not<\/span> rowExists(path) <span style=\"color: blue;\">AndAlso<\/span> csentry(&#8220;DN&#8221;).IsPresent <span style=\"color: blue;\">Then<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> dn <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span> = csentry(&#8220;DN&#8221;).Value <\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 If<\/span> CreateHomeDir(csentry) = 0 <span style=\"color: blue;\">Then<\/span><\/span><br \/><span style=\"font-size: 8pt; color: green; font-family: 'Courier New';\">\u00a0 &#8216;Only add the SQL table row if CreateHomeDir<\/span><br \/><span style=\"font-size: 8pt; color: green; font-family: 'Courier New';\">\u00a0 &#8216;was successful. This will force MIIS to try <\/span><br \/><span style=\"font-size: 8pt; color: green; font-family: 'Courier New';\">\u00a0 &#8216;again next export if CreateHomeDir failed.<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 addRow(path, dn, server, volume, folder, &#8220;adding&#8221;)<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 End<\/span> <span style=\"color: blue;\">If<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 End<\/span> <span style=\"color: blue;\">If<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 End<\/span> <span style=\"color: blue;\">If<\/span><\/span><br \/><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\">End<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> <span style=\"color: blue;\">Sub<\/span><\/span><\/p>\n<\/blockquote>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span style=\"font-family: Arial;\">Step 4 &#8211; Import Steps<\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Extensible MAs can only import objects from a text file, so your job, in the GenerateImportFile sub, is to construct the text file that contains all the information MIIS will be expecting. My preferred format is AVP because it will support both single and multi-valued attributes.<\/span><\/p>\n<blockquote>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Path: \\server1homectest<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">DN: ctest.staff.nds<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Server: server1<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Volume: home<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Folder: ctest<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">Status: active<\/span><\/p>\n<\/blockquote>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">I tend to combine harvesting information direct from the source, with matching against what I&#8217;ve written into the SQL table. If an object doesn&#8217;t actually exist &#8211; say a homedir was not created, or was accidentally deleted &#8211; I won&#8217;t list the object in the text file; MIIS will register that as an unexpected disappearance; and will reprovision the object. Which is exactly what you&#8217;d want to happen.<\/span><\/p>\n<blockquote>\n<p><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\">Public<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> <span style=\"color: blue;\">Sub<\/span> GenerateImportFile(<span style=\"color: blue;\">ByVal<\/span> filename <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>, <span style=\"color: blue;\">ByVal<\/span> connectTo <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>, <span style=\"color: blue;\">ByVal<\/span> user <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>, <span style=\"color: blue;\">ByVal<\/span> password <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>, <span style=\"color: blue;\">ByVal<\/span> configParameters <span style=\"color: blue;\">As<\/span> ConfigParameterCollection, <span style=\"color: blue;\">ByVal<\/span> fullImport <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">Boolean<\/span>, <span style=\"color: blue;\">ByVal<\/span> types <span style=\"color: blue;\">As<\/span> TypeDescriptionCollection, <span style=\"color: blue;\">ByRef<\/span> customData <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>)<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Implements<\/span> IMAExtensibleFileImport.GenerateImportFile<\/span><br \/><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\">\u00a0 Dim<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> Servers <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span>() = {&#8220;server1&#8221;, &#8220;server2&#8221;, &#8220;server3&#8221;}<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> i <span style=\"color: blue;\">As<\/span> Int16<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> s() <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">String<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> folders <span style=\"color: blue;\">As<\/span> System.Collections.IEnumerator<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> sqlConn <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">New<\/span> SqlConnection(MIISDB_CONNECTION_STRING)<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> sqlConn.Open()<\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> fw <span style=\"color: blue;\">As<\/span> StreamWriter<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Try<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: green;\">\u00a0 &#8216;Open the output file specified in the run profile<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw = <span style=\"color: blue;\">New<\/span> StreamWriter(filename, <span style=\"color: blue;\">False<\/span>)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Catch<\/span> ex <span style=\"color: blue;\">As<\/span> Exception<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Throw<\/span> <span style=\"color: blue;\">New<\/span> UnauthorizedAccessException(&#8220;Unable to open file: &#8221; &amp; filename)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 End<\/span> <span style=\"color: blue;\">Try<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 For<\/span> i = 0 <span style=\"color: blue;\">To<\/span> UBound(Servers)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: green;\">\u00a0 &#8216;List all folders under \\serverhome<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 s = System.IO.Directory.GetDirectories(&#8220;\\&#8221; &amp; Servers(i) &amp; &#8220;Home&#8221;)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 folders = s.GetEnumerator<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 While<\/span> folders.MoveNext<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: green;\">\u00a0 &#8216;For each folder, write an entry into the import file<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;Path: &#8221; &amp; folders.Current)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;Server: &#8221; &amp; Servers(i))<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;Volume: Home&#8221;)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;Folder: &#8221; &amp; folders.Current.Replace(&#8220;\\&#8221; &amp; Servers(i) &amp; &#8220;Home&#8221;, &#8220;&#8221;))<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: green;\">\u00a0 &#8216;Get DN and Status from the SQL table<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> sqlQuery <span style=\"color: blue;\">As<\/span> <span style=\"color: blue;\">New<\/span> SqlCommand(&#8220;SELECT * FROM &#8221; &amp; MIISDB_TABLE &amp; &#8221; where path='&#8221; &amp; folders.Current &amp; &#8220;&#8216;&#8221;, sqlConn)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Dim<\/span> cnReader <span style=\"color: blue;\">As<\/span> SqlDataReader = sqlQuery.ExecuteReader<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 If<\/span> cnReader.Read <span style=\"color: blue;\">Then<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;stringDN: &#8221; &amp; cnReader.Item(1))<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> fw.WriteLine(&#8220;Status: &#8221; &amp; cnReader.Item(5))<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 Else<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;stringDN: &#8220;)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine(&#8220;Status: owner unknown&#8221;)<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 End<\/span> <span style=\"color: blue;\">If<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.WriteLine()<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 cnReader.Close()<\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0 End<\/span> <span style=\"color: blue;\">While<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"color: blue;\">\u00a0Next<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 sqlConn.Close()<\/span><\/span><\/span><br \/><span style=\"font-size: 8pt; font-family: 'Courier New';\"><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\"><span style=\"font-size: 8pt; font-family: 'Courier New';\">\u00a0 fw.Close()<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-size: 8pt; color: blue; font-family: 'Courier New';\">End<\/span><span style=\"font-size: 8pt; font-family: 'Courier New';\"> <span style=\"color: blue;\">Sub<\/span><\/span><\/p>\n<\/blockquote>\n<h3 style=\"margin: 12pt 0cm 3pt;\"><span style=\"font-family: Arial;\">And the rest:<\/span><\/h3>\n<p class=\"MsoNormal\" style=\"margin: 0cm 0cm 0pt;\"><span style=\"font-family: Times New Roman;\">The complete solution also includes deprovisioning, as well as steps to archive home directories to ZIP files before deletion&#8230; but I&#8217;ll cover all that in <a href=\"https:\/\/www.wapshere.com\/missmiis\/?p=40\">another post<\/a>.<\/span><\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a quick walkthrough of creating an XMA. It&#8217;s by no means complete or authoritative, and just shows a method I&#8217;ve found success with. The example is creating Netware home directories, something I recognize most people don&#8217;t need to do these days, but it&#8217;s a flexible method which I have used for other scenarios as&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[34,28,7],"tags":[],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-ilm2007","category-miis2003","category-novell"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-f","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":5,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":3354,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/15\/revisions\/3354"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}