Discussion Locked

Logon Script Environment Variables

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have had experience writing logon scripts using the USERNAME and COMPUTERNAME variables. At my previous position, NT was already configured and using these variables, I merely expanded on them to automate tasks. Currently, I have a W2K Server with W9*/ME/NT workstations and need to "grab" this info. In testing, these variables are not present, "ECHO UserId: USERNAME%" yields "UserId:" only. No username displayed.

How can I establish or use these in my logon scripting? Is there a server setting or feature to activate?

Thanks in advance.

2 replies

by dclausson

Ooops! the missing "%" in "USERNAME%" was a typo.

Should have read - ECHO UserID: %USERNAME%

by aidanod

try using echo %username%

and echo %computername%

this certainly works in NT and 2000

you could also set an enviromenet variable youself in autoexec.bat (win9x)and test for that E.G. Set PCNAME=MYPC1

then in yourbatch file:-
If %PCNAME%=MYPC1 goto MYPC etc

look into windows scripting host for more powerful solutions

Aidan

This discussion is closed to new replies.