Announcement

Collapse
No announcement yet.

delims for importing plain text ...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • delims for importing plain text ...

    I am trying to findout what delims I need to use to import text (plain text provides some sort of description) into a description field.

    My batch file is :

    FOR /F "eol=; tokens=1-2 delims=, " %%a in (%1) do dsadd group cn=%%a,ou=stage,dc=testlab,dc=fastback,dc=com -secgrp yes -scope l -samid %%a -desc %%b

    My input file has:

    W01Q_Readers,"Provides Read access to W01Q"

    Error is:

    dsadd group cn=W01Q_Readers,ou=stage,dc=testlab,dc=fastback,dc =com -secgrp yes -scope l -samid W01Q_Readers -desc "Provides

    As you can see it is only picking up "Provides from the second field in my input file.

    any clue as to what my delims should be so that I can get all the text into the description field?

    Thanks in advance

  • #2
    Re: delims for importing plain text ...

    There are two solutions,

    1. remove the space as a delimiter
    Code:
    FOR /F "usebackq tokens=1-2 delims=," %%a in (%1) do echo %%a %%b
    OR
    2. all other tokens after the first token must be considered as one token
    Code:
    FOR /F "usebackq tokens=1,* delims=, " %%a in (%1) do echo %%a %%b

    \Rems


    I optionally added "usebackq" into the FOR statement, that 'll make it possible to use also quotes around the batch parameter. In cases the directory or filename of the input file contains spaces the path must be added between quotes.
    .
    Last edited by Rems; 18th March 2009, 23:53.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: delims for importing plain text ...

      Grats Rems!. Tried the first option and it worked perfectly.

      Now that that piece is done I was wondering if you have any ideas on how one adds information into the Notes section of the AD group using dsadd. Ideally I would like to script it so that the group gets created, the description added and the notes updated. I have not been able to find a switch to add notes!!

      Once again thanks for your help.

      Comment


      • #4
        Re: delims for importing plain text ...

        C:\>dsadd group /?
        Description: Adds a group to the directory.
        Syntax: dsadd group <GroupDN> [-secgrp {yes | no}] [-scope {l | g | u}]
        [-samid <SAMName>] [-desc <Description>] [-memberof <Group ...>]
        [-members <Member ...>] [{-s <Server> | -d <Domain>}] [-u <UserName>]
        [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

        I don't think there is a way to do this unless there is a hidden switch that is not published in this list

        Comment


        • #5
          Re: delims for importing plain text ...

          Originally posted by glacieredlightning View Post
          I don't think there is a way to do this unless there is a hidden switch that is not published in this list
          How about using CSVDE and LDIFDE tools? This seems like a nice starting point.

          -vP

          Comment


          • #6
            Re: delims for importing plain text ...

            yup .. ended up going that route eventually. Would have liked to stick with the ds toolset but .. ohh well

            Thanks for your help and suggestions guys.

            Comment

            Working...
            X