Author Topic: Computer IT Bore, I need your help  (Read 571 times)

0 Members and 1 Guest are viewing this topic.

mojovonio

  • Guest
Computer IT Bore, I need your help
« on: April 08, 2011, 03:37:43 PM »
Does something like %username% exist but for the users pre-2000 account name?

Corporal

  • Member
Re: Computer IT Bore, I need your help
« Reply #1 on: April 12, 2011, 04:34:38 PM »
Huh. I'm guessing you're scripting for a Pre-2000 (= 9x/NT)  system and want to know the environment variable for the current user login name? Did I understand that correctly?

I'd fiddle around with set on the machine in question to find the correct name. If it exists, that is.

Way I see it you're SOL on 9x machines. Those rely heavily on their DOS underpinnings and thus autoexec.bat (or winset.exe from the Admin folder of the CD).
Hah, found a way involving scripting on a samba server... Might achieve the same using a genuine DC, but dunno, really.

Win NT and onwards all should have the username environment variable.

Some googling turned up a tool named "putinenv.exe" that you can use in conjunction with winset on 9x machines:
\\server\netlogon\putinenv L /L
\\server\netlogon\winset username=%username%
\\server\netlogon\winset computername=%computername%
!list