| Author | Messages | |
ananthrg
Posts:20
 | | 09/03/2010 7:10 AM |
| Hi all,
Is there a script to get a list of inactive/dead computer accounts, like say in the last 30days or last 60 days or more....
saw some appliactions to find and delete or move, we just need to a list and we can manually remove them..
thanks Ananth.
| | | |
| gwelsh123
Posts:2
 | | 09/03/2010 7:13 AM |
| u can write a script to query the pwdlastset attribute i have one if u want to email me
________________________________
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Ananth Rajagopal Sent: Friday, 3 September 2010 02:46 PM To: xxxxxxxxxxxxxxxx Subject: [gptalk] List dead/inactive Computer Accounts in Active Directory.
Hi all,
Is there a script to get a list of inactive/dead computer accounts, like say in the last 30days or last 60 days or more....
saw some appliactions to find and delete or move, we just need to a list and we can manually remove them..
thanks Ananth.
-------------------------------------------------------------------------- Security Statement
The information contained in this electronic mail message is privileged and confidential, and is intended only for use of the addressee. If you are not the intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication is strictly prohibited. Confidentiality and legal privilege attached to this communication are not waived or lost by reason of mistaken delivery to you. If you have received this communication in error, please notify the sender by reply transmission and delete the message without copying or disclosing it.
Disclaimer
Any views expressed in this communication are those of the individual sender, except where the sender specifically states them to be the view of NSW Businesslink Pty. Ltd. Except as required by law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception, inference or interference. --------------------------------------------------------------------------
| | | |
| ananthrg
Posts:20
 | | 09/03/2010 7:23 AM |
| Hi Greame,
Kindly send the script, it will be much helpful.
regards Ananth.
On Fri, Sep 3, 2010 at 10:18 AM, Graeme Welsh < xxxxxxxxxxxxxxxx> wrote:
> u can write a script to query the pwdlastset attribute > i have one if u want to email me > > ------------------------------ > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Ananth Rajagopal > *Sent:* Friday, 3 September 2010 02:46 PM > *To:* xxxxxxxxxxxxxxxx > *Subject:* [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > Hi all, > > Is there a script to get a list of inactive/dead computer accounts, like > say in the last 30days or last 60 days or more.... > > saw some appliactions to find and delete or move, we just need to a list > and we can manually remove them.. > > thanks > Ananth. > -------------------------------------------------------------------------- > Security Statement > > The information contained in this electronic mail message is > privileged and confidential, and is intended only for use of > the addressee. If you are not the intended recipient, you are > hereby notified that any disclosure, reproduction, distribution > or other use of this communication is strictly prohibited. > Confidentiality and legal privilege attached to this communication > are not waived or lost by reason of mistaken delivery to you. > If you have received this communication in error, please notify > the sender by reply transmission and delete the message without > copying or disclosing it. > > Disclaimer > > Any views expressed in this communication are those of the > individual sender, except where the sender specifically states them > to be the view of NSW Businesslink Pty. Ltd. Except as required by > law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or > guarantee that the integrity of this communication has been > maintained nor that the communication is free of errors, virus, > interception, inference or interference. > -------------------------------------------------------------------------- >
| | | |
| gwelsh123
Posts:2
 | | 09/03/2010 7:29 AM |
| this will get machines who havent set their password in the last 35 days, i.e. dead machines i tried gettin the OS out aswell, but couldnt get it going, u welcome to improve it oh, and its doing servers, not desktops, u can tweak the code to your hearts content run it from the command line using cscript scriptname.vbs <path to text file of server names> cheers graeme
'''''start of script 'Option Explicit on error resume next Const ADS_UF_PASSWD_CANT_CHANGE = &H40 Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
Dim strFilePath, objFSO, objFile, adoConnection, adoCommand Dim objRootDSE, strDNSDomain, strFilter, strQuery, adoRecordset Dim strDN, objShell, lngBiasKey, lngBias, blnPwdExpire Dim objDate, dtmPwdLastSet, lngFlag, k dim strOS, strName
' Check for required arguments. If (Wscript.Arguments.Count < 1) Then Wscript.Echo "Arguments <FileName> required. For example:" & vbCrLf _ & "cscript PwdLastChanged.vbs c:\MyFolder\compList.txt" Wscript.Quit(0) End If
strFilePath = Wscript.Arguments(0) Set objFSO = CreateObject("Scripting.FileSystemObject")
' Open the file for write access. On Error Resume Next Set objFile = objFSO.OpenTextFile(strFilePath, 2, True, 0) If (Err.Number <> 0) Then On Error GoTo 0 Wscript.Echo "File " & strFilePath & " cannot be opened" Set objFSO = Nothing Wscript.Quit(1) End If On Error GoTo 0
' Obtain local time zone bias from machine registry. ' This bias changes with Daylight Savings Time. Set objShell = CreateObject("Wscript.Shell") lngBiasKey = objShell.RegRead("HKLM\System\CurrentControlSet\Control\" _ & "TimeZoneInformation\ActiveTimeBias") If (UCase(TypeName(lngBiasKey)) = "LONG") Then lngBias = lngBiasKey ElseIf (UCase(TypeName(lngBiasKey)) = "VARIANT()") Then lngBias = 0 For k = 0 To UBound(lngBiasKey) lngBias = lngBias + (lngBiasKey(k) * 256^k) Next End If
' Use ADO to search the domain for all computers. Set adoConnection = CreateObject("ADODB.Connection") Set adoCommand = CreateObject("ADODB.Command") adoConnection.Provider = "ADsDSOOBject" adoConnection.Open "Active Directory Provider" Set adoCommand.ActiveConnection = adoConnection
' Determine the DNS domain from the RootDSE object. Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("DefaultNamingContext")
' Filter to retrieve all computer/server objects. strFilter = "(&(objectCategory=computer)(operatingsystem=*server*))"
'LDAP query strAttribs = ";distinguishedname,pwdlastset,useraccountcontrol,operatingSystem,name" strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & strattribs & ";subtree"
'msgbox strquery adoCommand.CommandText = strQuery adoCommand.Properties("Page Size") = 1000 adoCommand.Properties("Timeout") = 60 adoCommand.Properties("Cache Results") = False
' Write each comps Distinguished Name and when ' secure channel password was last set
on error resume next Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
strDN = adoRecordset.Fields("distinguishedName").Value lngFlag = adoRecordset.Fields("userAccountControl").Value strOS = adoRecordset.Fields("operatingSystem").Value strName = adoRecordset.Fields("name").Value blnPwdExpire = True If ((lngFlag And ADS_UF_PASSWD_CANT_CHANGE) <> 0) Then blnPwdExpire = False End If If ((lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) <> 0) Then blnPwdExpire = False End If ' The pwdLastSet attribute should always have a value assigned, ' but other Integer8 attributes representing dates could be "Null". If (TypeName(adoRecordset.Fields("pwdLastSet").Value) = "Object") Then Set objDate = adoRecordset.Fields("pwdLastSet").Value dtmPwdLastSet = Integer8Date(objDate, lngBias) Else dtmPwdLastSet = #1/1/1601# End If if (now - 35) < dtmpwdlastset then ' if password hasnt been set in 35 days objFile.WriteLine strname '& "," & strOS & "," & dtmPwdLastSet else end if adoRecordset.MoveNext Loop adoRecordset.Close
' Clean up. objFile.Close adoConnection.Close
Wscript.Echo "Done"
Function Integer8Date(ByVal objDate, ByVal lngBias) ' Function to convert Integer8 (64-bit) value to a date, adjusted for ' local time zone bias. Dim lngAdjust, lngDate, lngHigh, lngLow lngAdjust = lngBias lngHigh = objDate.HighPart lngLow = objdate.LowPart ' Account for error in IADsLargeInteger property methods. If (lngLow < 0) Then lngHigh = lngHigh + 1 End If If (lngHigh = 0) And (lngLow = 0) Then lngAdjust = 0 End If lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _ + lngLow) / 600000000 - lngAdjust) / 1440 ' Trap error if lngDate is ridiculously huge. On Error Resume Next Integer8Date = CDate(lngDate) If (Err.Number <> 0) Then On Error GoTo 0 Integer8Date = #1/1/1601# End If On Error GoTo 0 End Function
________________________________
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Ananth Rajagopal Sent: Friday, 3 September 2010 02:56 PM To: xxxxxxxxxxxxxxxx Subject: Re: [gptalk] List dead/inactive Computer Accounts in Active Directory.
Hi Greame,
Kindly send the script, it will be much helpful.
regards Ananth.
On Fri, Sep 3, 2010 at 10:18 AM, Graeme Welsh <xxxxxxxxxxxxxxxx> wrote:
u can write a script to query the pwdlastset attribute i have one if u want to email me
________________________________
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Ananth Rajagopal Sent: Friday, 3 September 2010 02:46 PM To: xxxxxxxxxxxxxxxx Subject: [gptalk] List dead/inactive Computer Accounts in Active Directory.
Hi all,
Is there a script to get a list of inactive/dead computer accounts, like say in the last 30days or last 60 days or more....
saw some appliactions to find and delete or move, we just need to a list and we can manually remove them..
thanks Ananth.
------------------------------------------------------------------------ -- Security Statement
The information contained in this electronic mail message is privileged and confidential, and is intended only for use of the addressee. If you are not the intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication is strictly prohibited. Confidentiality and legal privilege attached to this communication are not waived or lost by reason of mistaken delivery to you. If you have received this communication in error, please notify the sender by reply transmission and delete the message without copying or disclosing it.
Disclaimer
Any views expressed in this communication are those of the individual sender, except where the sender specifically states them to be the view of NSW Businesslink Pty. Ltd. Except as required by law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception, inference or interference.
------------------------------------------------------------------------ --
-------------------------------------------------------------------------- Security Statement
The information contained in this electronic mail message is privileged and confidential, and is intended only for use of the addressee. If you are not the intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication is strictly prohibited. Confidentiality and legal privilege attached to this communication are not waived or lost by reason of mistaken delivery to you. If you have received this communication in error, please notify the sender by reply transmission and delete the message without copying or disclosing it.
Disclaimer
Any views expressed in this communication are those of the individual sender, except where the sender specifically states them to be the view of NSW Businesslink Pty. Ltd. Except as required by law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception, inference or interference. --------------------------------------------------------------------------
| | | |
| ananthrg
Posts:20
 | | 09/03/2010 7:55 AM |
| Thanks Greame,
Looking at OldCMP, as you said, it looks like what we are looking for.
We are not much intoscripting, so probably won't be able to make head and tail from the script!! ...
Thanks all the same... :-)
regards Ananth.
On Fri, Sep 3, 2010 at 10:31 AM, Graeme Welsh < xxxxxxxxxxxxxxxx> wrote:
> u need to be careful with that > it will delete cluster virtual server names if you arent careful ! > > ------------------------------ > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Castillo, Daniel (Directory > Services) > *Sent:* Friday, 3 September 2010 02:56 PM > > *To:* xxxxxxxxxxxxxxxx > *Subject:* RE: [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > OldCMP from *joe* is what you need J > > http://www.joeware.net/freetools/tools/oldcmp/index.htm > > > > ~D > > > > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Graeme Welsh > *Sent:* Thursday, September 02, 2010 10:48 PM > *To:* xxxxxxxxxxxxxxxx > *Subject:* RE: [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > > > u can write a script to query the pwdlastset attribute > > i have one if u want to email me > > > ------------------------------ > > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Ananth Rajagopal > *Sent:* Friday, 3 September 2010 02:46 PM > *To:* xxxxxxxxxxxxxxxx > *Subject:* [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > Hi all, > > Is there a script to get a list of inactive/dead computer accounts, like > say in the last 30days or last 60 days or more.... > > saw some appliactions to find and delete or move, we just need to a list > and we can manually remove them.. > > thanks > Ananth. > -------------------------------------------------------------------------- > Security Statement > > The information contained in this electronic mail message is > privileged and confidential, and is intended only for use of > the addressee. If you are not the intended recipient, you are > hereby notified that any disclosure, reproduction, distribution > or other use of this communication is strictly prohibited. > Confidentiality and legal privilege attached to this communication > are not waived or lost by reason of mistaken delivery to you. > If you have received this communication in error, please notify > the sender by reply transmission and delete the message without > copying or disclosing it. > > Disclaimer > > Any views expressed in this communication are those of the > individual sender, except where the sender specifically states them > to be the view of NSW Businesslink Pty. Ltd. Except as required by > law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or > guarantee that the integrity of this communication has been > maintained nor that the communication is free of errors, virus, > interception, inference or interference. > -------------------------------------------------------------------------- > -------------------------------------------------------------------------- > Security Statement > > The information contained in this electronic mail message is > privileged and confidential, and is intended only for use of > the addressee. If you are not the intended recipient, you are > hereby notified that any disclosure, reproduction, distribution > or other use of this communication is strictly prohibited. > Confidentiality and legal privilege attached to this communication > are not waived or lost by reason of mistaken delivery to you. > If you have received this communication in error, please notify > the sender by reply transmission and delete the message without > copying or disclosing it. > > Disclaimer > > Any views expressed in this communication are those of the > individual sender, except where the sender specifically states them > to be the view of NSW Businesslink Pty. Ltd. Except as required by > law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or > guarantee that the integrity of this communication has been > maintained nor that the communication is free of errors, virus, > interception, inference or interference. > -------------------------------------------------------------------------- >
| | | |
| peavey
Posts:2
 | | 09/03/2010 1:01 PM |
| HI Graeme,
could I get a copy of that script please
thanks
Tony
On 3 September 2010 00:48, Graeme Welsh < xxxxxxxxxxxxxxxx> wrote:
> u can write a script to query the pwdlastset attribute > i have one if u want to email me > > ------------------------------ > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Ananth Rajagopal > *Sent:* Friday, 3 September 2010 02:46 PM > *To:* xxxxxxxxxxxxxxxx > *Subject:* [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > Hi all, > > Is there a script to get a list of inactive/dead computer accounts, like > say in the last 30days or last 60 days or more.... > > saw some appliactions to find and delete or move, we just need to a list > and we can manually remove them.. > > thanks > Ananth. > -------------------------------------------------------------------------- > Security Statement > > The information contained in this electronic mail message is > privileged and confidential, and is intended only for use of > the addressee. If you are not the intended recipient, you are > hereby notified that any disclosure, reproduction, distribution > or other use of this communication is strictly prohibited. > Confidentiality and legal privilege attached to this communication > are not waived or lost by reason of mistaken delivery to you. > If you have received this communication in error, please notify > the sender by reply transmission and delete the message without > copying or disclosing it. > > Disclaimer > > Any views expressed in this communication are those of the > individual sender, except where the sender specifically states them > to be the view of NSW Businesslink Pty. Ltd. Except as required by > law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or > guarantee that the integrity of this communication has been > maintained nor that the communication is free of errors, virus, > interception, inference or interference. > -------------------------------------------------------------------------- >
| | | |
| its.mike
Posts:3
 | | 09/03/2010 4:43 PM |
| doesn't joeware's oldcmp do this nicely (and more!)?
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Tony Pearson Vinn Sent: Friday, September 03, 2010 4:14 am To: xxxxxxxxxxxxxxxx Subject: Re: [gptalk] List dead/inactive Computer Accounts in Active Directory.
ah dam,
bloody gmail, I didnt read down,
DOH!
On 3 September 2010 07:12, Tony Pearson Vinn <xxxxxxxxxxxxxxxx> wrote:
HI Graeme,
could I get a copy of that script please
thanks
Tony
On 3 September 2010 00:48, Graeme Welsh <xxxxxxxxxxxxxxxx> wrote:
u can write a script to query the pwdlastset attribute
i have one if u want to email me
_____
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Ananth Rajagopal Sent: Friday, 3 September 2010 02:46 PM To: xxxxxxxxxxxxxxxx Subject: [gptalk] List dead/inactive Computer Accounts in Active Directory.
Hi all,
Is there a script to get a list of inactive/dead computer accounts, like say in the last 30days or last 60 days or more....
saw some appliactions to find and delete or move, we just need to a list and we can manually remove them..
thanks Ananth.
-------------------------------------------------------------------------- Security Statement
The information contained in this electronic mail message is privileged and confidential, and is intended only for use of the addressee. If you are not the intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication is strictly prohibited. Confidentiality and legal privilege attached to this communication are not waived or lost by reason of mistaken delivery to you. If you have received this communication in error, please notify the sender by reply transmission and delete the message without copying or disclosing it.
Disclaimer
Any views expressed in this communication are those of the individual sender, except where the sender specifically states them to be the view of NSW Businesslink Pty. Ltd. Except as required by law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or guarantee that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception, inference or interference. --------------------------------------------------------------------------
| | | |
| jsclmedave
Posts:67
 | | 09/03/2010 4:43 PM |
| YES it does!
Tim Bolton 148 2nd Street North Central City Iowa, 52214 SMS - xxxxxxxxxxxxxxxx
Microsoft Certified IT Professional
Blog - Http://timbolton.net/
"Applying computer technology is simply finding the right wrench to pound in the correct screw." ~ Steve Riley
On Fri, Sep 3, 2010 at 9:15 AM, mike Mitchell <xxxxxxxxxxxxxxxx> wrote:
> doesn't joeware's oldcmp do this nicely (and more!)? > > > > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Tony Pearson Vinn > *Sent:* Friday, September 03, 2010 4:14 am > > *To:* xxxxxxxxxxxxxxxx > *Subject:* Re: [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > > > ah dam, > > > > > > bloody gmail, I didnt read down, > > > > DOH! > > On 3 September 2010 07:12, Tony Pearson Vinn <xxxxxxxxxxxxxxxx> wrote: > > HI Graeme, > > > > could I get a copy of that script please > > > > thanks > > > > Tony > > On 3 September 2010 00:48, Graeme Welsh < > xxxxxxxxxxxxxxxx> wrote: > > u can write a script to query the pwdlastset attribute > > i have one if u want to email me > > > ------------------------------ > > *From:* xxxxxxxxxxxxxxxx [mailto: > xxxxxxxxxxxxxxxx] *On Behalf Of *Ananth Rajagopal > *Sent:* Friday, 3 September 2010 02:46 PM > *To:* xxxxxxxxxxxxxxxx > *Subject:* [gptalk] List dead/inactive Computer Accounts in Active > Directory. > > Hi all, > > Is there a script to get a list of inactive/dead computer accounts, like > say in the last 30days or last 60 days or more.... > > saw some appliactions to find and delete or move, we just need to a list > and we can manually remove them.. > > thanks > Ananth. > > -------------------------------------------------------------------------- > Security Statement > > The information contained in this electronic mail message is > privileged and confidential, and is intended only for use of > the addressee. If you are not the intended recipient, you are > hereby notified that any disclosure, reproduction, distribution > or other use of this communication is strictly prohibited. > Confidentiality and legal privilege attached to this communication > are not waived or lost by reason of mistaken delivery to you. > If you have received this communication in error, please notify > the sender by reply transmission and delete the message without > copying or disclosing it. > > Disclaimer > > Any views expressed in this communication are those of the > individual sender, except where the sender specifically states them > to be the view of NSW Businesslink Pty. Ltd. Except as required by > law, NSW Businesslink Pty. Ltd. does not represent, warrant and/or > guarantee that the integrity of this communication has been > maintained nor that the communication is free of errors, virus, > interception, inference or interference. > -------------------------------------------------------------------------- > > > > >
| | Tim Bolton | |
|
|