Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: List - computer created date in AD

HTVi
TV Discussion Newsgroups

List - computer created date in AD
Ranjan 5/21/2007 5:26:01 AM
Hi ,
I am new to scripting.
How to List of computer with created date for only windows 2000 and 2003
servers.
I created script but not working. Please do the needful.

Thanks and Regards,

Ranjan



------------



Const ADS_SCOPE_SUBTREE = 2

dtmCreationDate = "20001230000000.0Z"


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

objCommand.CommandText = _
"SELECT Name, operatingSystem, whenCreated FROM " _
& "'LDAP://DC=fabrikam,DC=com' WHERE objectClass='computer' " _
& "and operatingSystem = 'Windows 2000 Server)'" _
& "and whenCreated>='" & dtmCreationDate & "'"

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute


objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
Wscript.Echo " whenCreated: " & objRecordSet.Fields("whenCreated ").Value
objRecordSet.MoveNext
Loop

RE: List - computer created date in AD
neothwin 5/21/2007 11:02:01 AM
Hi,

dsquery * "OU=test,dc=your,dc=domain,dc=com" -filter "(&(|(operatingsys
tem=*2003*)(operatingsystem=*2000*))(objectclass=computer))" -attr name
operatingsystem whencreated

pls try the above dsquery command. you can also try the query string in
csvde command.
pls note the word wrapping and your domain name.

regards,



"Ranjan" wrote:

[Quoted Text]
> Hi ,
> I am new to scripting.
> How to List of computer with created date for only windows 2000 and 2003
> servers.
> I created script but not working. Please do the needful.
>
> Thanks and Regards,
>
> Ranjan
>
>
>
> ------------
>
>
>
> Const ADS_SCOPE_SUBTREE = 2
>
> dtmCreationDate = "20001230000000.0Z"
>
>
> Set objConnection = CreateObject("ADODB.Connection")
> Set objCommand = CreateObject("ADODB.Command")
> objConnection.Provider = "ADsDSOObject"
> objConnection.Open "Active Directory Provider"
> Set objCommand.ActiveConnection = objConnection
>
> objCommand.CommandText = _
> "SELECT Name, operatingSystem, whenCreated FROM " _
> & "'LDAP://DC=fabrikam,DC=com' WHERE objectClass='computer' " _
> & "and operatingSystem = 'Windows 2000 Server)'" _
> & "and whenCreated>='" & dtmCreationDate & "'"
>
> objCommand.Properties("Page Size") = 1000
> objCommand.Properties("Timeout") = 30
> objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
> objCommand.Properties("Cache Results") = False
> Set objRecordSet = objCommand.Execute
>
>
> objRecordSet.MoveFirst
> Do Until objRecordSet.EOF
> Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
> Wscript.Echo " whenCreated: " & objRecordSet.Fields("whenCreated ").Value
> objRecordSet.MoveNext
> Loop
>
RE: List - computer created date in AD
Ranjan 5/21/2007 12:19:01 PM

Hi,

Thanks for information.
I managed with other scipt and taken report.

Regards,
Ranjan
"neothwin" wrote:

[Quoted Text]
> Hi,
>
> dsquery * "OU=test,dc=your,dc=domain,dc=com" -filter "(&(|(operatingsys
> tem=*2003*)(operatingsystem=*2000*))(objectclass=computer))" -attr name
> operatingsystem whencreated
>
> pls try the above dsquery command. you can also try the query string in
> csvde command.
> pls note the word wrapping and your domain name.
>
> regards,
>
>
>
> "Ranjan" wrote:
>
> > Hi ,
> > I am new to scripting.
> > How to List of computer with created date for only windows 2000 and 2003
> > servers.
> > I created script but not working. Please do the needful.
> >
> > Thanks and Regards,
> >
> > Ranjan
> >
> >
> >
> > ------------
> >
> >
> >
> > Const ADS_SCOPE_SUBTREE = 2
> >
> > dtmCreationDate = "20001230000000.0Z"
> >
> >
> > Set objConnection = CreateObject("ADODB.Connection")
> > Set objCommand = CreateObject("ADODB.Command")
> > objConnection.Provider = "ADsDSOObject"
> > objConnection.Open "Active Directory Provider"
> > Set objCommand.ActiveConnection = objConnection
> >
> > objCommand.CommandText = _
> > "SELECT Name, operatingSystem, whenCreated FROM " _
> > & "'LDAP://DC=fabrikam,DC=com' WHERE objectClass='computer' " _
> > & "and operatingSystem = 'Windows 2000 Server)'" _
> > & "and whenCreated>='" & dtmCreationDate & "'"
> >
> > objCommand.Properties("Page Size") = 1000
> > objCommand.Properties("Timeout") = 30
> > objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
> > objCommand.Properties("Cache Results") = False
> > Set objRecordSet = objCommand.Execute
> >
> >
> > objRecordSet.MoveFirst
> > Do Until objRecordSet.EOF
> > Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
> > Wscript.Echo " whenCreated: " & objRecordSet.Fields("whenCreated ").Value
> > objRecordSet.MoveNext
> > Loop
> >

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen