Page 1 of 4 1234>
Topic Options
#58000 - 2001-08-07 02:24 PM Check for user account
Anonymous
Unregistered


Does anyone know how I can check or a useraccount exist on a NT server?
Top
#58001 - 2001-08-07 02:55 PM Re: Check for user account
Anonymous
Unregistered


The simplest thing that comes to mind is "NET USER XXXX". You'll get a neat "Username could not be found" if the user doesn't exist...
Top
#58002 - 2001-08-07 02:56 PM Re: Check for user account
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
but, that gives you user of domain if you are on server, doesn't it?
_________________________
!

download KiXnet

Top
#58003 - 2001-08-07 03:05 PM Re: Check for user account
Anonymous
Unregistered


Thanks, it works!
Top
#58004 - 2001-08-07 03:12 PM Re: Check for user account
Anonymous
Unregistered


Just a little question too.
This only works when you prompt it from the server but how can I check or a account exist sitting behind my desk?
The command "net user <username> /domain" doesn't work.

Top
#58005 - 2001-08-07 03:24 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Sander,

one possibility :
use rcmd to pass that net user line to the Server ... I used it to disable/enable all(except some admin accounts) on our PDC's and it worked a treat !

Jochen

ahh, and i fergot to mention : There must be some ADSI enhanced Scripting method to gain this ... Shawn ???

_________________________



Top
#58006 - 2001-08-07 03:38 PM Re: Check for user account
Anonymous
Unregistered


Command-line tools rule my world...
NTuser.exe allows for a server-parameter so
you can get useraccounts from any machine.
(and much much more: http://www.pedestalsoftware.com )

WHOOOPS! Forgot to mention that it's not free however...

[ 07 August 2001: Message edited by: Fuentez ]

Top
#58007 - 2001-08-07 04:29 PM Re: Check for user account
Anonymous
Unregistered


Where can I find rcmd?
Top
#58008 - 2001-08-07 04:31 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
NT Server Resource Kit !
_________________________



Top
#58009 - 2001-08-07 04:34 PM Re: Check for user account
Anonymous
Unregistered


In which directory?
I can find it.

Top
#58010 - 2001-08-07 04:49 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
if you have the Reskit installed it should be in the path ... just type rcmd /? :

to install rcmd on a remote server just do somehting like this (It's one of my older ones , as you can see i was on Uppercase KiX )

code:

IF EXIST("\\$Server\admin$\system32\Oemnsvrc.inf") = 0
COPY "%0\..\tools\Oemnsvrc.inf" "\\$Server\admin$\system32\"
ENDIF
IF EXIST("\\$Server\admin$\system32\Rcmdsvc.exe") = 0
COPY "%0\..\tools\Rcmdsvc.exe" "\\$Server\admin$\system32\"
ENDIF
SHELL '%ComSpec% /C %0\..\tools\xnet list \\' + $Server + ' |find /C "RemoteCmd" >nul'
IF @error = 0
SHELL "%ComSpec% /C %0\..\tools\xnet stop \\" + $Server + "\RemoteCmd >nul"
SHELL "%ComSpec% /C %0\..\tools\xnet remove \\" + $Server + "\RemoteCmd /y >nul"
ENDIF
SHELL '%ComSpec% /C %0\..\tools\xnet install \\' + $Server
+ '\RemoteCmd /b:Rcmdsvc.exe /d:LanmanServer /n:"Remote Command Server" /u:LocalSystem /s:auto >nul'
SHELL "%ComSpec% /C %0\..\tools\xnet start \\" + $Server + "\RemoteCmd >nul"

_________________________



Top
#58011 - 2001-08-07 04:53 PM Re: Check for user account
Anonymous
Unregistered


I'm sorry, I had placed the wrong cd in the cdrom.
Bad enought I can find the resource kit cdrom at the moment.

Top
#58012 - 2001-08-07 04:59 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
btw,

here is a sample of how to check not the errorlevel of rcmd (1=OK) in a Script but the errorlevel of the passed command !

code:

shell '%ComSpec% /c (rcmd \\' + $Server + ' "tlist") | find /i "robocopy" > %0\..\tools\dummy.txt'
if @error = 1 ;there is no task called robocopy
'robocopy has been finished' ?
else
'robocopy still runs' ?
endif

_________________________



Top
#58013 - 2001-08-07 05:01 PM Re: Check for user account
Anonymous
Unregistered


Can I download this file somewhere?
I can't find the @#*&^*$% cdrom.

Top
#58014 - 2001-08-07 05:04 PM Re: Check for user account
Anonymous
Unregistered


Relaxxxxx.... mail is underway!
Top
#58015 - 2001-08-07 05:07 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Thanks Ramon,

I have to go home now !

Jochen

_________________________



Top
#58016 - 2001-08-07 05:07 PM Re: Check for user account
Anonymous
Unregistered


Yes, I just found it in my mailbox.
Thanks in advance!

Top
#58017 - 2001-08-07 05:23 PM Re: Check for user account
Anonymous
Unregistered


Right click on the .inf file gives a "Installation failed" messagebox.
What can be wrong?
I have both rcmd.exe and rcmdsvc.exe in the same directory.

Top
#58018 - 2001-08-07 05:29 PM Re: Check for user account
Anonymous
Unregistered


It works yet, just copy the .inf file and rcmdsvc.exe to /winnt/system32

UPDATE:

The command net user <username> doesn't work.
It comes with a error: System error 1312 has occurred. A specified logon session does not exist. It may already have been terminated.

Very strang because the account exist.
All other command works well.

[ 07 August 2001: Message edited by: awinkel ]

Top
#58019 - 2001-08-07 06:03 PM Re: Check for user account
Anonymous
Unregistered


I get the same response... can't figure out why though. Starting the rcmd service with a different account doesn't work.
Top
Page 1 of 4 1234>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2141 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.045 seconds in which 0.018 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org