#29829 - 2002-09-27 02:07 PM
Extracting Username in TXT file
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Hello could someone give me some pointers for extracting all my usersnammes (SAM) into a text file?
Cheers
Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#29831 - 2002-09-27 02:32 PM
Re: Extracting Username in TXT file
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#29832 - 2002-09-27 04:39 PM
Re: Extracting Username in TXT file
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
I Just need to extract the Usernames that appear in User manager for domains into a Text file...
Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#29833 - 2002-09-27 04:45 PM
Re: Extracting Username in TXT file
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Steve,
I think you are looking for something like this..
code:
BREAK ON $userfile = "@CurDir\UserDump.xls" IF Exist("$UserFile") DEL "$UserFile" ENDIF $xl = CreateObject("Excel.application") IF @error EXIT ENDIF $rc = $xl.workbooks.add $xl.cells(1, 1).value = "User ID" $exlrow = 2 $crtheader = -1 $domain = GetObject("WinNT://@LDOMAIN") $domain.filter = User,"" FOR EACH $user IN $domain $user.getinfo() ? $user.name " ..." $xl.cells($exlrow, 1).value = $user.name FOR $i = 0 TO $user.propertycount $property = $user.next IF $property IF $crtheader $xl.cells(1, $i + 2).value = $property.name ENDIF $xl.cells($exlrow, $i + 2).value = $user.get($property.name) ENDIF NEXT $exlrow = $exlrow + 1 $crtheader = 0
NEXT $xl.rows("1:1").select $xl.selection.font.bold = True $xl.cells.select $xl.range("R1").activate $xl.cells.entirecolumn.autofit $xl.rows("2:2").select $xl.activewindow.freezepanes = True $xl.activeworkbook.saveas("$UserFile") $xl.quit EXIT
HTH,
Kent [ 27. September 2002, 16:46: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#29834 - 2002-09-27 04:46 PM
Re: Extracting Username in TXT file
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
code:
$DomainName="dss_test" $domain = GetObject("WinNT://$DomainName,domain")
$domain.filter = "user",""
for each $user in $domain ? $user.name next
|
|
Top
|
|
|
|
#29835 - 2002-09-27 04:47 PM
Re: Extracting Username in TXT file
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
see the groupmembers() UDF and do (domain users)
or this...
code:
break on
$domain = GetObject("WinNT://@ldomain") ;Connect to domain IF $domain $domain.filter="User","" for each $user in $domain ? $user.name next ENDIF
|
|
Top
|
|
|
|
#29836 - 2002-09-27 04:48 PM
Re: Extracting Username in TXT file
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
|
Top
|
|
|
|
#29837 - 2002-09-27 04:49 PM
Re: Extracting Username in TXT file
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Steve,
Sorry about the excel stuff..
Doh!
Kent
|
|
Top
|
|
|
|
#29839 - 2002-09-27 05:37 PM
Re: Extracting Username in TXT file
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
If you have an Exchange Server the easy way is to extract the NT account list. You can take it to a csv file. And then bring it into excel.
|
|
Top
|
|
|
|
#29840 - 2002-09-27 05:45 PM
Re: Extracting Username in TXT file
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Am I missing something I keep getting the following error... code:
= User,""
Microsoft(R) Windows 98 (C)Copyright Microsoft Corp 1981-1999.
C:\WINDOWS>kix32 /d user.kix Script error : unknown command ! $domain.filter = User,""
C:\WINDOWS>
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#29841 - 2002-09-27 05:51 PM
Re: Extracting Username in TXT file
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Do you have ADSI installed on Win98? Run the script from a W2K computer.
|
|
Top
|
|
|
|
#29842 - 2002-09-27 05:53 PM
Re: Extracting Username in TXT file
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Sorry dont have a w2k workstation in the building, ADSI???
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#29843 - 2002-09-27 05:54 PM
Re: Extracting Username in TXT file
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Further to Bob's response, you can also do an extract directly from Active Directory Users and computers, run MS-Access Reports from Hyena, etc.
Kent
|
|
Top
|
|
|
|
#29844 - 2002-09-27 05:56 PM
Re: Extracting Username in TXT file
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#29846 - 2002-09-27 06:08 PM
Re: Extracting Username in TXT file
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Thanks chaps, downloaded ADSI for win98 and this works a treat, just one more question, how do I pipe this output on screen into say notepad or workpad????
Steve
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
#29848 - 2002-09-27 06:43 PM
Re: Extracting Username in TXT file
|
Stephen Wintle
Seasoned Scripter
Registered: 2001-04-10
Posts: 444
Loc: England
|
Smashing, thanks for your help...
Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1452 anonymous users online.
|
|
|