![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Detect newly created computeraccounts in AD I am looking around for a vbs that could help me find computer accounts created within for example, a week. Our users has managed to get their hands on our deploy-floppy, and are sometimes reinstalling their pc's without our knowledge. If I could do a search in our workstation OU, and get a list of computeraccounts created within a week, I could easily sort out which ones we installed at the IT dept. and which we did not. A problem is that a reinstallation in our environment reuses the old computername automatically, and maybe those pc's will not have their "creationattribute" changed. But other fresh new installations will render a new computer account. Pls help! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Detect newly created computeraccounts in AD <johan.m.eriksson@xxxxxx> wrote in message news:a01aa94a-cbba-4150-8ac2-347737bad8ca@xxxxxx Quote: >I am looking around for a vbs that could help me find computer > accounts created within for example, a week. > > Our users has managed to get their hands on our deploy-floppy, and are > sometimes reinstalling their pc's without > our knowledge. > > If I could do a search in our workstation OU, and get a list of > computeraccounts created within a week, I could > easily sort out which ones we installed at the IT dept. and which we > did not. > > A problem is that a reinstallation in our environment reuses the old > computername automatically, and maybe those pc's will not have their > "creationattribute" changed. > > But other fresh new installations will render a new computer account. > > Pls help! the whenCreated attribute is after a specified date. For example: =========== Option Explicit Dim adoCommand, adoConnection, strBase, strFilter, strAttributes Dim strQuery, adoRecordset, strDN ' Setup ADO objects. Set adoCommand = CreateObject("ADODB.Command") Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Open "Active Directory Provider" adoCommand.ActiveConnection = adoConnection ' Search specified OU. strBase = "<LDAP://ou=West,dc=MyDomain,dc=com>" ' Filter on computer objects created after sepcified date. ' This example is September 1, 2008 (UTC). strFilter = "(&(objectCategory=computer)(whenCreated>=20080901000000.0Z))" ' Comma delimited list of attribute values to retrieve. strAttributes = "distinguishedName" ' Construct the LDAP syntax query. strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree" adoCommand.CommandText = strQuery adoCommand.Properties("Page Size") = 100 adoCommand.Properties("Timeout") = 30 adoCommand.Properties("Cache Results") = False ' Run the query. Set adoRecordset = adoCommand.Execute ' Enumerate the resulting recordset. Do Until adoRecordset.EOF ' Retrieve values and display. strDN = adoRecordset.Fields("distinguishedName").Value Wscript.Echo strDN ' Move to the next record in the recordset. adoRecordset.MoveNext Loop ' Clean up. adoRecordset.Close adoConnection.Close -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to get the content of a newly created instance of IE | VB Script | |||
| Unable to login with newly created accounts | Vista account administration | |||
| Newly created files protected from further access | Vista General | |||
| Problem logging in with newly created user | Vista account administration | |||
| not able to format newly created shrink volume | Vista installation & setup | |||