Page 2 of 4 <1234>
Topic Options
#58020 - 2001-08-07 06:40 PM Re: Check for user account
Anonymous
Unregistered


I think this just an another bug again.
I want to figure out of there is any option to get this work.
If I found it I will post it here too.

Top
#58021 - 2001-08-08 08:21 AM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

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

did you installed the Service on the Server or did you just copy the inf and the exe ???
See reply #10 for a installation sample !

for testing run :

xnet list \\YourServer\RemoteCmd


hth

Jochen

btw. you need to be connected with administrative privilege to the Server , but who am I telling this ?

[ 08 August 2001: Message edited by: jpols ]

_________________________



Top
#58022 - 2001-08-08 09:45 AM Re: Check for user account
Anonymous
Unregistered


The server has been running the RemoteCmd-service for ages (although it's called rcmd), Jochen, and I'm connecting with administartor priv. The thing is, "net user" works just fine returning a list of all users on the machine but "net user xxxx" gives that [System error 1312 has occurred. A specified logon session does not exist. It may already have been terminated] message.

Think it's got anything to do with my urge to find quadruple-X pornstars on our network??

Top
#58023 - 2001-08-08 09:55 AM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
WAIT A TICK !

sometimes my brain works a bit slooooow

It was during the tests for en/disabling users when i came to the conclusion that 'net user .... /domain causes 1312 errors when executed on Domain Controlers ...

for the name of Service : that's just what you give it at installation .. call it like you want ... call it 'NASI GORENG' and no-one will be able to find it ever again


So, just run it w/o /DOMAIN and that's it


Jochen

[ 08 August 2001: Message edited by: jpols ]

_________________________



Top
#58024 - 2001-08-08 09:55 AM Re: Check for user account
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I believe this specified logon session is the same message as is with kix when ran with at.
there is no actual logged on user as the rcmd-service is ran as system... could this be the case?
_________________________
!

download KiXnet

Top
#58025 - 2001-08-08 09:56 AM Re: Check for user account
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh...
Jpols comes, and with tested answer...
_________________________
!

download KiXnet

Top
#58026 - 2001-08-08 10:10 AM Re: Check for user account
Anonymous
Unregistered


...aahhhrrgg.... thread..
getting.. longer... hard
to read...

*grin*
Jochen >> Running with /DOMAIN does indeed give the same error - but I get a nice complete user list with just "NET USER". What I'm trying is "NET USER JPOLS". It should return "username could not be found" but instead I get the [you know what error I'm getting by now] message. Weird.

ps: we're already running a NASI GORENG service...

[ 08 August 2001: Message edited by: Fuentez ]

Top
#58027 - 2001-08-08 10:39 AM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
aaarrgh ... net ... user..
compute.. invalid.. .. argument ...
reality.sys .. corrupted ...
restarting universe ..
.... .. ....*TILT !

same effect here ...
Don't try to use with unknown ?


NASI GORENG Service ???
I'd like to have menue 69 , please deliver with sticks


Jochen

[ 08 August 2001: Message edited by: jpols ]

_________________________



Top
#58028 - 2001-08-09 12:48 AM Re: Check for user account
Anonymous
Unregistered


Still same problem here.
I have just send a mail to microsoft.

Do you have also bami goreng, is menu 71 if I'm right.

Top
#58029 - 2001-08-08 02:08 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

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

just to make sure we're on the same level here are some snippeties of the enable/disable user thingie (whole script is 16Kb, I won't post it unless someone orders)

Evaluate a list of all Users :

code:

;...
shell "%ComSpec% /c rcmd \\" + $machine + " net user > " + @scriptdir + "\..\tools\" + @wksta + "_all.txt"


;... count all users listed


$ = open(1,@scriptdir + "\..\tools\" + @wksta + "_all.txt",2)
do
$x = readline(1)
until instr($x,"---")
$x = readline(1)
do
if $x
$u1 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u1) = 0
$amount = $amount + 1
endif
$x = substr($x,len($u1)+2,len($x))
$x = ltrim($x)
if $x
$u2 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u2) = 0
$amount = $amount + 1
endif
$x = substr($x,len($u2)+2,len($x))
$x = ltrim($x)
if $x
$u3 = rtrim($x)
if instr($exceptions,$u3) = 0
$amount = $amount + 1
endif
endif
$x = readline(1)
else
$x = readline(1)
endif
else
$x = readline(1)
endif
until instr($x,"The Command")
$ = close(1)


;... dimension and fill the array

$ = open(1,@scriptdir + "\..\tools\" + @wksta + "_all.txt",2)
dim $User[$amount]
do
$x = readline(1)
until instr($x,"---")
$array = 0
$x = readline(1)
do
if $x
$u1 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u1) = 0
$User[$array] = $u1
$array = $array + 1
endif
$x = substr($x,len($u1)+2,len($x))
$x = ltrim($x)
if $x
$u2 = substr($x,1,instr($x," ")-1)
if instr($exceptions,$u2) = 0
$User[$array] = $u2
$array = $array + 1
endif
$x = substr($x,len($u2)+2,len($x))
$x = ltrim($x)
if $x
$u3 = rtrim($x)
if instr($exceptions,$u3) = 0
$User[$array] = $u3
$array = $array + 1
endif
endif
$x = readline(1)
else
$x = readline(1)
endif
else
$x = readline(1)
endif
until instr($x,"The Command")
$ = close(1)


;... do action for all listed $active = 'YES' or 'NO'


$array = 0
do
shell "%ComSpec% /c rcmd \\" + $machine + " net user " + $User[$array] + " /active:"
+ $active + " > " + @scriptdir + "\..\tools\" + @wksta + ".txt"

if @error = 1
$ = open(1,@scriptdir + "\..\tools\" + @wksta + ".txt",2)
$x = readline(1)
while @error = 0
if instr($x,"successfully.")
$check = 1
$done = $done + 1
color g+/n
select
case $done < 10
at(11,52)$done
case $done > 9 and $done < 100
at(11,51)$done
case $done > 99
at(11,50)$done
endselect
endif
$x = readline(1)
loop
$ = close(1)
if $check
$check = 0
else
$failed = $failed + 1
color r+/n
select
case $failed < 10
at(12,52)$failed
case $failed > 9 and $failed < 100
at(12,51)$failed
case $failed > 99
at(12,50)$failed
endselect
$msgcount = $msgcount + 1
if $msgcount = 3
$msgcount = 0
$msg = $msg + $User[$array] + chr(13) + chr(10)
else
if len($user[$array]) >= 8 and $User[$array] <> "salesmgr" and $User[$array] <> "tmersrvd"
and $User[$array] <> "secretary" and $User[$array] <> "salessup"
$msg = $msg + $User[$array] + chr(9)
else
$msg = $msg + $User[$array] + chr(9) + chr(9)
endif
endif
endif
else
$failed = $failed + 1
color r+/n
select
case $failed < 10
at(12,52)$failed
case $failed > 9 and $failed < 100
at(12,51)$failed
case $failed > 99
at(12,50)$failed
endselect
$msgcount = $msgcount + 1
if $msgcount = 3
$msgcount = 0
$msg = $msg + $User[$array] + chr(13) + chr(10)
else
if len($user[$array]) >= 8 and $User[$array] <> "salesmgr" and $User[$array] <> "tmersrvd"
and $User[$array] <> "secretary" and $User[$array] <> "salessup"
$msg = $msg + $User[$array] + chr(9)
else
$msg = $msg + $User[$array] + chr(9) + chr(9)
endif
endif
endif
color n/b+
$col_now = 15 + ($array * 50 / $amount + 1)
while $col < $col_now
$col = $col + 1
at(20,$col)" "
loop
color w+/n
$percent = 100 * ($array + 1) / $amount
at(22,41)'$percent %'
$array = $array + 1
until $array = $amount


;... display messagebox on error(s)

if $msg
$status = "" + $failed + " of " + $amount + " failed"
color r+/n
at(16,21)" "
at(16,21)$status
$ = messagebox($msg,$status,16,4096)
else
$status = "done"
color g+/n
at(16,21)" "
at(16,21)$status
endif


[ 08 August 2001: Message edited by: jpols ]

[ 08 August 2001: Message edited by: jpols ]

_________________________



Top
#58030 - 2001-08-08 02:31 PM Re: Check for user account
Anonymous
Unregistered


I will give a short explain why I want to check or an user account exist or not.
I'm working on a high school.
Each year we have new classnumbers
For example, classnumbers can be A1A, W2y, Z1C and more...
It can be that a classnumber still exist in the next year so I don't have to remove it from the usermanager.
If it not exist then I have to add them to the usermanager.
I have a batchfile that add classnumbers to the usermanager but I want to make that easier.
So I want to make a kixtart script what reads the classnumbers from a textfile, checkt or they still exist and if they don't they will be added.
I they exist the only thing that the script has to do is enabling the account and clears the password.

Top
#58031 - 2001-08-08 02:36 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
... So your $action should be 'ADD' or 'DELETE' (I updated above)

have a look and check if it fits ...
ahh , you can keep the progress bar ... no problem for me

_________________________



Top
#58032 - 2001-08-08 02:40 PM Re: Check for user account
Anonymous
Unregistered


I can't discover in your script how kixtart check or account exist or not.
The add/delete/active part is clear for me.

Top
#58033 - 2001-08-08 02:43 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
That's not the point in the script ...
I only use enumerated users (net user > file > cut users to array )

It's in the first part , See ?

J.

_________________________



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


>>Thread too long to follow
>>Head hurts
>>Mail sent to awinkel
>>Problem shall be solved
>>*grin*

Top
#58035 - 2001-08-08 03:07 PM Re: Check for user account
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I still think, even thou head might heart, that this can be solved without rcmd.
how, I'm gonna figure it out.
utleast retrieving usernames should be accessible in other ways too....
_________________________
!

download KiXnet

Top
#58036 - 2001-08-08 03:49 PM Re: Check for user account
Anonymous
Unregistered


JPols: Yes, I see it.

Fuentez: You have got new mail...

Lonkero: I hope it can, I haven't found any freeware third party tool that helps me.
I doesn't know any NT tool that can do it.

Top
#58037 - 2001-08-08 03:55 PM Re: Check for user account
Jochen Administrator Offline
KiX Supporter
*****

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

to answer another question : No, we haven't migrated to KiX2K yet (oficially )

And Yes, there should be a possibility to have this done with 20 lines of code using ADSI, KiX2K ...

Sorry i haven't yet installed the runtimes to my NT box , on the other hand i haven't yet installed Win2k to it (btw.. is it hard to get both NT and W2K installed to the same Disk on 2 Partitions ???=)

As soon i have done this you can expect sample scripts !


J.

_________________________



Top
#58038 - 2001-08-08 03:59 PM Re: Check for user account
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it ain't hard.
I don't remember well anymore, but when there was RC (1 or 2) of the win2k prof I installed them on same disk.
win2k replaces ntedect and some other stuff on the root of active partition, but otherwise no difference.
_________________________
!

download KiXnet

Top
#58039 - 2001-08-08 04:03 PM Re: Check for user account
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well. it's not so hard to put it to exe eather:
quote:

NET_API_STATUS NetQueryDisplayInformation(
LPCWSTR ServerName,
DWORD Level,
DWORD Index,
DWORD EntriesRequested,
DWORD PreferredMaximumLength,
LPDWORD ReturnedEntryCount,
PVOID *SortedBuffer
);
Parameters
ServerName
[in] Pointer to a constant null-terminated Unicode string specifying the name of the remote server on which the function is to execute. The string must begin with \\. If this parameter is NULL, the local computer is used.
Level
[in] Specifies the information level of the data. This parameter can be one of the following values. Value Meaning
1 Return user account information. The SortedBuffer parameter points to an array of NET_DISPLAY_USER structures.
2 Return individual computer information. The SortedBuffer parameter points to an array of NET_DISPLAY_MACHINE structures.
3 Return group account information. The SortedBuffer parameter points to an array of NET_DISPLAY_GROUP structures.


Index
[in] Specifies the index of the first entry for which to retrieve information. Specify zero to retrieve account information beginning with the first display information entry. For more information, see the following Remarks section.
EntriesRequested
[in] Specifies the maximum number of entries for which to retrieve information. On Windows 2000, each call to NetQueryDisplayInformation returns a maximum of 100 objects.
PreferredMaximumLength
[in] Specifies the preferred maximum size, in bytes, of the system-allocated buffer returned in the SortedBuffer parameter. It is recommended that you set this parameter to 0xFFFFFFFF.
ReturnedEntryCount
[out] Pointer to a DWORD value that receives the number of entries in the buffer returned in the SortedBuffer parameter. If this parameter is zero, there are no entries with an index as large as that specified. Entries may be returned when the function's return value is either NERR_Success or ERROR_MORE_DATA.
SortedBuffer
[out] Pointer to a buffer that receives a pointer to a system-allocated buffer specifying a sorted list of the requested information. The format of this data depends on the value of the Level parameter. Because this buffer is allocated by the system, it must be freed using the NetApiBufferFree function. Note that you must free the buffer even if the function fails with ERROR_MORE_DATA. For more information, see the following Return Values section.


_________________________
!

download KiXnet

Top
Page 2 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 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.176 seconds in which 0.147 seconds were spent on a total of 13 queries. Zlib compression enabled.

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