Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - vbscript AD and who create account

Reply
 
Old 10-01-2008   #1 (permalink)
hehehehe


 
 

vbscript AD and who create account

Hello Im usign this script

On Error Resume Next

sciezka = InputBox ("Podaj sciezke gdzie chcesz zapisac plik
*.txt?:"&VBCRLF& "np : c:\plik.txt")
strOutputFile = sciezka
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)

'strDomain = InputBox ("Podaj nazwe dmeny z której chcesz wyciagn±ć
informacje?:")

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://dc=,dc=' WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

Do Until objRecordSet.EOF
strPath = objRecordSet.Fields("ADsPath").Value
Set objUser = GetObject(strPath)
objOutputFile.Write "Pelna nazwa: " & objUser.FullName &VBCRLF
objOutputFile.Write "Uzytkownik: " & objUser.sAMAccountName &VBCRLF
objOutputFile.Write "Konto utworzone: " & objUser.whenCreated & " GMT"
&VBCRLF
objOutputFile.Write "Wylaczone?: " & objUser.accountDisabled &VBCRLF
objOutputFile.Write "----------------------------------"&VBCRLF
objRecordSet.MoveNext
Loop

wscript.echo "Gotowe!"



objOutputFile.Close




To retrive info about users in domain but can i rerive info who create user?

Pls help



My System SpecsSystem Spec
Old 10-01-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: vbscript AD and who create account


"hehehehe" <ehhehe@xxxxxx> wrote in message
news:gbvp63$14ve$1@xxxxxx
Quote:

> Hello Im usign this script
>
> On Error Resume Next
>
> sciezka = InputBox ("Podaj sciezke gdzie chcesz zapisac plik
> *.txt?:"&VBCRLF& "np : c:\plik.txt")
> strOutputFile = sciezka
> Set objFileSystem = CreateObject("Scripting.fileSystemObject")
> Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
>
> 'strDomain = InputBox ("Podaj nazwe dmeny z której chcesz wyciagn±ć
> informacje?:")
>
> Const ADS_SCOPE_SUBTREE = 2
>
> Set objConnection = CreateObject("ADODB.Connection")
> Set objCommand = CreateObject("ADODB.Command")
> objConnection.Provider = "ADsDSOObject"
> objConnection.Open "Active Directory Provider"
> Set objCommand.ActiveConnection = objConnection
>
> objCommand.Properties("Page Size") = 1000
> objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
>
> objCommand.CommandText = _
> "SELECT ADsPath FROM 'LDAP://dc=,dc=' WHERE objectCategory='user'"
> Set objRecordSet = objCommand.Execute
>
> objRecordSet.MoveFirst
>
> Do Until objRecordSet.EOF
> strPath = objRecordSet.Fields("ADsPath").Value
> Set objUser = GetObject(strPath)
> objOutputFile.Write "Pelna nazwa: " & objUser.FullName &VBCRLF
> objOutputFile.Write "Uzytkownik: " & objUser.sAMAccountName &VBCRLF
> objOutputFile.Write "Konto utworzone: " & objUser.whenCreated & " GMT"
> &VBCRLF
> objOutputFile.Write "Wylaczone?: " & objUser.accountDisabled &VBCRLF
> objOutputFile.Write "----------------------------------"&VBCRLF
> objRecordSet.MoveNext
> Loop
>
> wscript.echo "Gotowe!"
>
>
>
> objOutputFile.Close
>
>
>
>
> To retrive info about users in domain but can i rerive info who create
> user?
>
> Pls help
The account used to create any object in AD is not saved anywhere in AD. The
only way to get this information would be to turn on auditing and read the
logs.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 10-02-2008   #3 (permalink)
hehehehe


 
 

Re: vbscript AD and who create account

Thx

regards MJ.


My System SpecsSystem Spec
Old 10-02-2008   #4 (permalink)
pblakeway


 
 

Re: vbscript AD and who create account

On Oct 2, 9:03*am, "hehehehe" <ehh...@xxxxxx> wrote:
Quote:

> Thx
>
> regards MJ.
The one place it may be is on the object security acl, create a user/
comp then look at the security on the object, you will find your
username with full control
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
how to create a tunnel vpn with vbscript? VB Script
Create tables with vbscript. VB Script
Create vbscript to empty secure temp folder when exiting Outlook. VB Script
how to create checkbox using vbscript VB Script
vbscript to create file Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46