Getting Display Name in Logon Script

T

Thomas Karer

Hi!

I am working hard to get a login script up and running with the "real
username".
The %username% ist the login name and i need the active directory "display
name".

with the following:
dsquery user domainroot -samid %username%|dsget user -display -q -l

i got this result:
display: Thomas Karer
dsget war erfolgreich

i need only the text "Thomas Karer" for my login script.

Does anybody know how to "filter" the output for the "Thomas Karer" an put
this in an variable (%displayname%)

many many thanks.

tom
 
W

wayne

@for /f "tokens=3,4" %a in ('"net user %username% /domain | find /i "Full
name""') do echo %a %b

Or you can set a variable replace the echo with set FullName=%a %b
 
W

wayne

Sorry, I should read the question better.
for /f "delims=: tokens=2" %a in ('"dsquery user domainroot -samid
%username%|dsget user -display -q -l | find /i "display""') do echo %a %b

should do it.
 
?

=?ISO-8859-1?Q?Re=EDnhardt_Kern?=

Thomas Karer said:
Hi!

I am working hard to get a login script

Hi Tom,

there is a tiny little script language especially for login
scripts. http://www.kixtart.com

Using cmd batch for enhanced login scripting is very time
consuming and expensive. Kix scripting is so much faster.

Reinhardt
--
Ironie ist für dich ein Fremdwort, gelle?
Wenn du kein Grieche bist, dann dürfte Ironie auch für dich
ein Fremdwort sein ... (Sharky in de.soc.politik.misc)
 
T

Thomas Karer

wayne said:
Sorry, I should read the question better.
for /f "delims=: tokens=2" %a in ('"dsquery user domainroot -samid
%username%|dsget user -display -q -l | find /i "display""') do echo %a %b

should do it.
thank you very much for this but this seems not to work.
i got the following output:
 
W

wayne

You know I'm really not with it, you said you were using it in a batch file,
and I didn't account for that.
If you use a For /F in a batch, you have to double the % in front of the
temporary variable.
It should look like this...

for /f "delims=: tokens=2" %%a in ('"dsquery user domainroot -samid
%username% | dsget user -display -q -l | find /i "display""') do set
FullName=%%a
SET fullName=%fullName:~1%
echo %FullName%

(The second line takes off the leading space)
(Also, I dropped the %b, it was extra)
 
W

wayne

I'm not sure how it is displaying for you, but my reader keeps breaking the
lines in half. Just to be sure I'm seperating each line with a space...


for /f "delims=: tokens=2" %%a in ('"dsquery user domainroot -samid
%username% | dsget user -display -q -l | find /i "display""') do set
FullName=%%a

SET fullName=%fullName:~1%

echo %FullName%
 
T

Thomas Karer

wayne said:
I'm not sure how it is displaying for you, but my reader keeps breaking
the lines in half. Just to be sure I'm seperating each line with a
space...


for /f "delims=: tokens=2" %%a in ('"dsquery user domainroot -samid
%username% | dsget user -display -q -l | find /i "display""') do set
FullName=%%a

SET fullName=%fullName:~1%

echo %FullName%
thank you really very very much, this works perfect for me!

cu
tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top