Re: Simple AD shell script - discover usernames
- From: "Dean Wells [MVP]" <dwells@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 13 Aug 2005 11:44:40 -0400
for /f "tokens=*" %a in (<textfile of usernames>) do dsquery user -name
"%a" | dsget user -samid
If you're intending in placing the command above in a batch file don't
forget to replace the single percent (%a) with double percent (%%a) in
both cases.
--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l
Martin Jones wrote:
> Hi,
> Ok, one of my users passed me a txt list of users:
>
> smith, john
> jones, bob
> etc ...
>
> Which coincides with our "Name" convention in AD.
> To do what the user wants me to do, I need to convert those "surname,
> firstname"
> into their AD username.
>
> The Command:
> dsquery user -name "smith, john" | dsget user -samid
>
> at prompt returns:
> samid
> SMITHJ
> dsget succeeded
>
> now I could type that command for each entry in the txt file (200+),
> but obviously want to automate it, so it finds the corresponding
> username for each entry.
> All I want is the SMITHJ appending to the "smith, john" in the text
> file so my txt file looks like:
> smith, john SMITHJ
> jones, bob JONESB
>
> Then I can pull into Excel and populate our printer address books.
>
> Even simpler : User passed me a txt list of names, which I need to
> batch convert to AD usernames.
>
> Hope that clears it up, Thanks for the help so far.
.
- Follow-Ups:
- Re: Simple AD shell script - discover usernames
- From: Martin Jones
- Re: Simple AD shell script - discover usernames
- References:
- Simple AD shell script - discover usernames
- From: Martin Jones
- Re: Simple AD shell script - discover usernames
- From: Marty List
- Re: Simple AD shell script - discover usernames
- From: Martin Jones
- Re: Simple AD shell script - discover usernames
- From: Marty List
- Re: Simple AD shell script - discover usernames
- From: Martin Jones
- Simple AD shell script - discover usernames
- Prev by Date: Re: reinstalling vbscript 5.6
- Next by Date: Copy file script
- Previous by thread: Re: Simple AD shell script - discover usernames
- Next by thread: Re: Simple AD shell script - discover usernames
- Index(es):
Relevant Pages
|