Name of user currently logged in


G

Guest

Hello all

Is there any way to use " reg query" in a batch file to get the name (NOT the SID) of the user currently logged into a workstation?

Thanks in advance

David.
 
Ad

Advertisements

D

David Candy

Yes but what's wrong with %username%.

Type in a command prompt
echo %username%
 
G

Guest

My Mistake. I was not specific enough. I am trying to get the current user name from remote workstations. I want to use DOS batch file and not VBS if possible.
 
D

Dread

Hello all,

Is there any way to use " reg query" in a batch file to get the name (NOT the SID) of the user currently logged into a workstation??

Thanks in advance.

David.
from a cmd prompt type "set" : you get a rundown of variables. One of
these is the username of the currently logged on user. OK, its not reg
query, but maybe it will be relevent to you.
 
D

David Candy

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
and logonname =

To redirect the output to a temp file, read in the temp file with a for command.
 
M

Mark V

In microsoft.public.win2000.cmdprompt.admin =?Utf-8?B?RGF2aWQ=?=
wrote:
My Mistake. I was not specific enough. I am trying to get the
current user name from remote workstations. I want to use DOS
batch file and not VBS if possible.
You could try psloggedon.exe from
http://www.sysinternals.com
 
Ad

Advertisements

G

Guest

I tried that but unfortunately, reg works with only HKLM and HKU on remote machines. It does not work with HKCU on remote machines. Similarly, %username% also gets the username from the local machine and not from the remote machine. There has to be a way out, but I am stuck. I am not sure if psloggedin can be used in an enterprise for fear of licensing issues, which is why I would like to explore built-in tools in Windows2000.
 

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