"Polonius19" <> wrote in message
news:bf5684f6-daa1-4d77-b387-...
> I'm working my way through a Server 2003 book as I study for the
> 70-290 exam and I have a question about scripting using a file as a
> source for stdin.
>
> According to the book I should be able to use "dsadd computer
> <names.txt>" to add machine accounts to the domain. If I were adding a
> single machine I would use something like this:
>
> dsadd computer "CN=XP001, OU=Workstations, OU=Phoenix, DC=70-290,
> DC=int"
>
> I have 150 names in the file. I'd really like to get a handle on this.
> Needless to say, simply putting in the command with <names.txt> didn't
> work.
It seems you might have deduced that the redirection character implied a
redirection of stdin from a file. I don't think that is the case, rather I
suspect that the angle brackets are simply their way of denoting that the
parameter is the name of a file. Try it without the angle brackets, and give
the actual name of the actual file containing the required information.
> For starters, I don't see how the OUs and domain components
> could be accurate, unless dsadd is assuming the OUs and DC from the
> system running the command.
I think that it would be up to you to supply names in your names.txt file
that are valid distinguished names for computers in your network. The first
line would likely be:
CN=XP001, OU=Workstations, OU=Phoenix, DC=70-290, DC=int
without the double quotes.
> Any help would be appreciated...
I don't have the tools here, so I'm not sure if dsadd even accrpts a
filename parameter. you could create a batch script to do so like this:
for /f "delims=" %%F in (names.txt) do dsadd computer %%F
/Al
|