#58020 - 2001-08-07 06:40 PM
Re: Check for user account
|
Anonymous
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
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
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
|
|
|
|
#58026 - 2001-08-08 10:10 AM
Re: Check for user account
|
Anonymous
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
|
|
|
|
#58028 - 2001-08-09 12:48 AM
Re: Check for user account
|
Anonymous
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
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
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
|
|
|
|
#58032 - 2001-08-08 02:40 PM
Re: Check for user account
|
Anonymous
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
|
|
|
|
#58034 - 2001-08-08 03:05 PM
Re: Check for user account
|
Anonymous
Anonymous
Unregistered
|
>>Thread too long to follow >>Head hurts >>Mail sent to awinkel >>Problem shall be solved >>*grin*
|
Top
|
|
|
|
#58036 - 2001-08-08 03:49 PM
Re: Check for user account
|
Anonymous
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
|
|
|
|
#58039 - 2001-08-08 04:03 PM
Re: Check for user account
|
Lonkero
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|