#77578 - 2001-04-11 07:25 PM
K2K/ADSI: User Spotting in your Domain ...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Just testing more of the same and this evolved... code:
break on ; ; SCANUSER.K2K ; ; This script enumerates all the user account's in your domain and displays ; their status (expired, disabled and locked-out)... ; ; To get a hardcopy, pipe the output to a file like this... ; ; kix32c scanuser.k2k $out=filename.ext ;
$padding = " "
if $out if exist("$out") del "$out" endif $= redirectoutput("$out") endif
$domain = getobject("WinNT://@LDOMAIN")
if $domain
$filter = "user","" $domain.filter = $filter for each $user in $domain $status = "" if $user.accountdisabled $status = $status + "disabled" endif if $user.passwordexpired if $status $status=$status+"," endif $status = "$status"+"expired" endif if $user.accountlocked if $status $status=$status+"," endif $status = $status + "locked" endif if $status $username = substr($user.name+$padding,1,32) ? "$username $status" endif next endif exit
Shawn *** Important Info This script runs only on Windows 2000 workstations and servers... but it will enumerate user's in regular old NT4 domains... Shawn.. [This message has been edited by Shawn (edited 11 April 2001).]
|
|
Top
|
|
|
|
#77580 - 2001-04-18 02:15 AM
Re: K2K/ADSI: User Spotting in your Domain ...
|
Kyle
Fresh Scripter
Registered: 2000-05-30
Posts: 9
Loc: Irvine,CA USA
|
Cool! Do you know where I can get a list of available objects?I'm looking to write a script that will enumerate the MS Exchange distribution list membership. Thanks, ------------------ Kyle Shaver, MCSE kyle_shaver@phoenix.com
_________________________
Kyle Shaver, MCSE
[url=mailto:kyleshaver@cox.net]kyleshaver@cox.net[/url]
|
|
Top
|
|
|
|
#77582 - 2001-04-18 04:26 PM
Re: K2K/ADSI: User Spotting in your Domain ...
|
Anonymous
Anonymous
Unregistered
|
Hey Shawn,I have been testing a bit on your script and it works perfectly But I have a bit of a problem...When kix "prints" the username on the screen it only prints the first character!!! I experienced the same thing when I extracted data from a database with kix, anybody know what could be wrong? By the way, I'm using kix2001 ------------------ Cheers.... David
|
|
Top
|
|
|
|
#77584 - 2001-04-18 05:27 PM
Re: K2K/ADSI: User Spotting in your Domain ...
|
Anonymous
Anonymous
Unregistered
|
Hey Shawn,Im running it on my Win95 box with ADSI installed. But I dont think this is related to ADSI, but to the COM/OLE support in Kix, because I got the same problem when communicating with databases. I tried to output in many different ways, with and without brackets, I also tried outputting to a file, but all with the same result. Shawn, do you have a windows 95 you can test this on? ------------------ Cheers.... David
|
|
Top
|
|
|
|
#77586 - 2001-04-18 06:58 PM
Re: K2K/ADSI: User Spotting in your Domain ...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
David, you might be on to something here, this just gets stranger and stranger I've found that if you add a null string into the mix, it works on Win2K !code:
break on ; This script displays your active directory domain name
$domain = getobject("WinNT://@LDOMAIN")
if $domain
?"name=" $domain.name ; <--- this always worked on NT
$name = $domain.name ; <--- assign to variable
?"name=$name" ; <--- this doesn't work ! (as before)
$name = $domain.name+"" ; <--- do same but add null string !
?"domain name=$name" ; <--- and now it works on NT
endif
exit
Shawn. [This message has been edited by Shawn (edited 19 April 2001).]
|
|
Top
|
|
|
|
#77588 - 2001-04-20 09:42 AM
Re: K2K/ADSI: User Spotting in your Domain ...
|
Anonymous
Anonymous
Unregistered
|
Ruud,maybe you have a solution for this? Or maybe you can tell us what we are doing wrong? ------------------ Cheers.... David
|
|
Top
|
|
|
|
#77589 - 2001-04-27 04:28 PM
Re: K2K/ADSI: User Spotting in your Domain ...
|
Anonymous
Anonymous
Unregistered
|
Could this be adapted to check if users were using 'password' as their password?We recently merged several domains into one and had a problem with WINS that prevented users changing their passwords - I'd like to capture all the lazy ones and force them to change at next logon. Any other ideas out their?
|
|
Top
|
|
|
|
#77591 - 2001-05-19 07:48 PM
Re: K2K/ADSI: User Spotting in your Domain ...
|
creutz
Fresh Scripter
Registered: 2000-06-14
Posts: 32
Loc: Helsinki, Finland
|
has anybody succeeded with Class computer i.e. has anybody been able to enumerate the domian computers and getting more than one charater from the name creutz
|
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 874 anonymous users online.
|
|
|