Re: Scripting help needed by Al
Al
Mon Apr 09 16:04:37 CDT 2007
"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:emCXHiteHHA.3548@TK2MSFTNGP05.phx.gbl...
> hi Barb,
>
> Step 1: Read up on the file scripting object (fso). You
> can use it to read in your text file, and write out your
> desired re-formatted file.
>
> Step 2: Read up on the "Split" function. You can use
> that to split up your input lines. I suggest splitting
> based on a comma separator. The split function will
> give you a "string array" (zero-based). The employeeID
> will be the last element of the string array saMyLine(4).
If the canonical name has a comma in it, its record might look like this
"CN=User \,Bill,OU=OU,DC=Domain,DC=com",329949
No problem, in that the employeeID will still be the last item; it just
might not be at (4).
Personally, I'd move this field in front of the DN, where it will always be
at (0). Then to get the DN I would split the line on double-quotes and pick
element (1).
/Al
> Step 3: Once you have what you want, you can use fso to
> write the new file, line by line. You can use the fso
> "text stream" writeline method for this.
>
> It's not going to be a very difficult script to write.
> If you wait around long enough, some generous person
> will probably come along and write it for you.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but,
> no guarantee the answers will be applicable to the questions)
>
>
>
> Barb wrote:
>> OK, this seems like it would be so easy, but I'm not having much luck.
>> And please be gentle, I am no scripter.
>>
>> I need to take the data from an Excel spreadsheet or a CSV file such as
>> shown below:
>> "CN=User,OU=OU,DC=Domain,DC=com",329949
>> "CN=User2,OU=OU,DC=Domain,DC=com",456790
>>
>> And export this data into a text file with particular formatting such as
>> what follows:
>>
>> dn: CN=User,OU=OU,DC=Domain,DC=com
>> changetype: modify
>> replace: employeeID
>> employeeID: 329949
>> -
>> dn: CN=User2,OU=OU,DC=Domain,DC=com
>> changetype: modify
>> replace: employeeID
>> employeeID: 456790
>> -
>>
>> How would I approach this? Like I said, it seems easy, but I'm getting
>> nowhere.