| Author | Messages | |
gabriel/tfi
Posts:145
 | | 09/24/2008 2:30 PM |
| Dear all, as the subject says, I would like to create a csv list of users who are "enabled" but have not logged in since 31 July 2008.
This line seems to do the job: C:\bin\AdFind.exe -default -binenc -f "(&(objectcategory=person)(objectclass=user)(lastlogontimestamp<={{LOCAL:200 8/08/01}})(!userAccountControl:1.2.840.113556.1.4.803:=2))" displayname description company lastlogontimestamp -tdcs -csv > c:\out\InactiveUsers.txt
Now - forgive my question that can sound a bit silly - ... is there a way to use the today's date in place of {{LOCAL:2008/08/01}} in that single command line? Or even better the today's date - (minus) xx days?
Thanks in advance - Gabriele.
List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.activedir.org/ma/default.aspx
| | | |
| laurahcomputing
Posts:43
 | | 09/24/2008 2:30 PM |
| Why not just use oldcmp with the -users switch? One of the switches lets you specify "give me users whose llts is at least <X> days old", which should suffice for what you're describing.
On Thu, Sep 18, 2008 at 7:51 PM, Gabriele Scolaro <gabro@gabro.net> wrote:
> Dear all, as the subject says, I would like to create a csv list of users > who are "enabled" but have not logged in since 31 July 2008. > > This line seems to do the job: > C:\bin\AdFind.exe -default -binenc -f > > "(&(objectcategory=person)(objectclass=user)(lastlogontimestamp<={{LOCAL:200 > 8/08/01}})(!userAccountControl:1.2.840.113556.1.4.803:=2))" displayname > description company lastlogontimestamp -tdcs -csv > > c:\out\InactiveUsers.txt > > Now - forgive my question that can sound a bit silly - ... is there a way > to > use the today's date in place of {{LOCAL:2008/08/01}} in that single > command > line? Or even better the today's date - (minus) xx days? > > Thanks in advance - Gabriele. > > List info : http://www.activedir.org/List.aspx > List FAQ : http://www.activedir.org/ListFAQ.aspx > List archive: http://www.activedir.org/ma/default.aspx >
-- ----------------------- Laura E. Hunter Architect, Oxford Computer Group (http://www.oxfordcomputergroup.com) Microsoft MVP, Directory Services ( https://mvp.support.microsoft.com/profile/laura) Author, Active Directory Consultant's Field Guide (http://tinyurl.com/7f8ll) Author, Active Directory Cookbook, Second Edition (http://tinyurl.com/z7svl)
| | | |
| mkline
Posts:18
 | | 09/24/2008 2:30 PM |
| It has several output formats using -format and you can also add your filter using -af
http://www.joeware.net/freetools/tools/oldcmp/usage.htm
Hands down one of the best tools around.
Thanks Mike
On Thu, Sep 18, 2008 at 8:45 PM, Gabriele Scolaro <gabro@gabro.net> wrote:
> Does oldcomp output to csv and enumerate non-disabled accounts? > > > > *From:* ActiveDir-owner@mail.activedir.org [mailto: > ActiveDir-owner@mail.activedir.org] *On Behalf Of *Laura E. Hunter > *Sent:* venerdì 19 settembre 2008 2.33 > *To:* ActiveDir@mail.activedir.org > *Subject:* Re: [ActiveDir] Using AdFind to enumerate inactive accounts > > > > Why not just use oldcmp with the -users switch? One of the switches lets > you specify "give me users whose llts is at least <X> days old", which > should suffice for what you're describing. > > On Thu, Sep 18, 2008 at 7:51 PM, Gabriele Scolaro <gabro@gabro.net> wrote: > > Dear all, as the subject says, I would like to create a csv list of users > who are "enabled" but have not logged in since 31 July 2008. > > This line seems to do the job: > C:\bin\AdFind.exe -default -binenc -f > > "(&(objectcategory=person)(objectclass=user)(lastlogontimestamp<={{LOCAL:200 > 8/08/01}})(!userAccountControl:1.2.840.113556.1.4.803:=2))" displayname > description company lastlogontimestamp -tdcs -csv > > c:\out\InactiveUsers.txt > > Now - forgive my question that can sound a bit silly - ... is there a way > to > use the today's date in place of {{LOCAL:2008/08/01}} in that single > command > line? Or even better the today's date - (minus) xx days? > > Thanks in advance - Gabriele. > > List info : http://www.activedir.org/List.aspx > List FAQ : http://www.activedir.org/ListFAQ.aspx > List archive: http://www.activedir.org/ma/default.aspx > > > > > -- > ----------------------- > Laura E. Hunter > Architect, Oxford Computer Group (http://www.oxfordcomputergroup.com) > Microsoft MVP, Directory Services ( > https://mvp.support.microsoft.com/profile/laura) > Author, Active Directory Consultant's Field Guide ( > http://tinyurl.com/7f8ll) > Author, Active Directory Cookbook, Second Edition ( > http://tinyurl.com/z7svl) >
| | | |
| RobertBobel
Posts:7
 | | 10/01/2008 8:07 AM |
| I ook m a whl o g hs soy fo h la pos... h PoSh ommand would b somhng.
g-qadus -ldapFl "(|(lasLogonTmsamp&l;=$(([aTm]"2008/01/01").ToFlTmUTC()))(!(lasLogonTmsamp=*)))" -Enabld | f Nam, LasLogonTmsamp
Pobably no as fas h oh ools mnond, bu woks.
Bob
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Tony Muay Sn: Thusday, Spmb 18, 2008 9:25 PM To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
H Gabl
Ys, o boh of hos.
hp://www.jowa.n/fools/ools/oldmp/usag.hm
You an us h sam fl you us fo FIN.EXE
FWIW, I pf usng FIN as an g m nly fomad da flds n h oupu CSV, n fo h k ons lk whnCad. H's how I us :
adfnd -s -dfaul -da -u -bnn -b -f "(&(samaounyp=805306368)(|(lasLogonTmsamp&l;={{u:2008/01/01}})(!(lasLogonTmsamp=*)))(!(usounConol:N:=2)))" laslogonmsamp pwdlass aounxps whnad
Wh hs nfomaon you ha a good han of wokng ou whh an aoun s na o no.
Gong bak o you ognal quson, you should b abl o do wha you wan wh a sp wapp (VBSp o Powshll) aound FIN.
Tony
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Gabl Solao Sn: Fday, 19 Spmb 2008 12:45 p.m. To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
os oldomp oupu o s and numa non-dsabld aouns?
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Laua E. Hun Sn: ndì 19 smb 2008 2.33 To: @mal.ad.og Subj: R: [] Usng dFnd o numa na aouns
Why no jus us oldmp wh h -uss swh? On of h swhs ls you spfy "g m uss whos lls s a las &l;X&g; days old", whh should suff fo wha you' dsbng. On Thu, Sp 18, 2008 a 7:51 PM, Gabl Solao &l;gabo@gabo.n&l;malo:gabo@gabo.n&g;&g; wo: a all, as h subj says, I would lk o a a s ls of uss who a "nabld" bu ha no loggd n sn 31 July 2008.
Ths ln sms o do h job: C:\bn\dFnd.x -dfaul -bnn -f "(&(objagoy=pson)(objlass=us)(laslogonmsamp&l;={{LOCL:200 8/08/01}})(!usounConol:1.2.840.113556.1.4.803:=2))" dsplaynam dspon ompany laslogonmsamp -ds -s &g; :\ou\InaUss.x
Now - fog my quson ha an sound a b slly - ... s h a way o us h oday's da n pla of {{LOCL:2008/08/01}} n ha sngl ommand ln? O n b h oday's da - (mnus) xx days?
Thanks n adan - Gabl.
Ls nfo : hp://www.ad.og/Ls.aspx Ls FQ : hp://www.ad.og/LsFQ.aspx Ls ah: hp://www.ad.og/ma/dfaul.aspx
-- ----------------------- Laua E. Hun h, Oxfod Compu Goup (hp://www.oxfodompugoup.om) Mosof MVP, oy Ss (hps://mp.suppo.mosof.om/pofl/laua) uho, oy Consulan's Fld Gud (hp://nyul.om/7f8ll) uho, oy Cookbook, Sond Edon (hp://nyul.om/z7sl)
| | | |
| gabriel/tfi
Posts:145
 | | 10/02/2008 8:04 PM |
| Thanks o Tony and Bob fo h suggsons.
Is possbl o fn h odays da n ha PoSh on-ln sp?
Thanks - Gabl
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Rob Bobl Sn: moldì 1 oob 2008 14.04 To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
I ook m a whl o g hs soy fo h la pos
h PoSh ommand would b somhng.
g-qadus -ldapFl "(|(lasLogonTmsamp&l;=$(([aTm]"2008/01/01").ToFlTmUTC()))(!(lasL ogonTmsamp=*)))" -Enabld | f Nam, LasLogonTmsamp
Pobably no as fas h oh ools mnond, bu woks.
Bob
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Tony Muay Sn: Thusday, Spmb 18, 2008 9:25 PM To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
H Gabl
Ys, o boh of hos.
hp://www.jowa.n/fools/ools/oldmp/usag.hm
You an us h sam fl you us fo FIN.EXE
FWIW, I pf usng FIN as an g m nly fomad da flds n h oupu CSV, n fo h k ons lk whnCad. Hs how I us :
adfnd -s -dfaul -da -u -bnn -b -f "(&(samaounyp=805306368)(|(lasLogonTmsamp&l;={{u:2008/01/01}})(!(la sLogonTmsamp=*)))(!(usounConol:N:=2)))" laslogonmsamp pwdlass aounxps whnad
Wh hs nfomaon you ha a good han of wokng ou whh an aoun s na o no.
Gong bak o you ognal quson, you should b abl o do wha you wan wh a sp wapp (VBSp o Powshll) aound FIN.
Tony
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Gabl Solao Sn: Fday, 19 Spmb 2008 12:45 p.m. To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
os oldomp oupu o s and numa non-dsabld aouns?
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Laua E. Hun Sn: ndì 19 smb 2008 2.33 To: @mal.ad.og Subj: R: [] Usng dFnd o numa na aouns
Why no jus us oldmp wh h -uss swh? On of h swhs ls you spfy "g m uss whos lls s a las &l;X&g; days old", whh should suff fo wha you' dsbng.
On Thu, Sp 18, 2008 a 7:51 PM, Gabl Solao &l;gabo@gabo.n&g; wo:
a all, as h subj says, I would lk o a a s ls of uss who a "nabld" bu ha no loggd n sn 31 July 2008.
Ths ln sms o do h job: C:\bn\dFnd.x -dfaul -bnn -f "(&(objagoy=pson)(objlass=us)(laslogonmsamp&l;={{LOCL:200 8/08/01}})(!usounConol:1.2.840.113556.1.4.803:=2))" dsplaynam dspon ompany laslogonmsamp -ds -s &g; :\ou\InaUss.x
Now - fog my quson ha an sound a b slly - ... s h a way o us h oday's da n pla of {{LOCL:2008/08/01}} n ha sngl ommand ln? O n b h oday's da - (mnus) xx days?
Thanks n adan - Gabl.
Ls nfo : hp://www.ad.og/Ls.aspx Ls FQ : hp://www.ad.og/LsFQ.aspx Ls ah: hp://www.ad.og/ma/dfaul.aspx
-- ----------------------- Laua E. Hun h, Oxfod Compu Goup (hp://www.oxfodompugoup.om) Mosof MVP, oy Ss (hps://mp.suppo.mosof.om/pofl/laua) uho, oy Consulan's Fld Gud (hp://nyul.om/7f8ll) uho, oy Cookbook, Sond Edon (hp://nyul.om/z7sl)
| | | |
| michael1
Posts:181
 | | 10/02/2008 8:26 PM |
| g-qadus -ldapFl "(|(lasLogonTmsamp&l;=$((g-da).ToFlTmUTC()))(!(lasLogonTmsamp= *)))" -Enabld | f Nam, LasLogonTmsamp
Rgads,
Mhal B. Smh, MCITP:S,EM/MCSE/Exhang MVP
My blog: hp://ThEssnalExhang.om/blogs/mhal
Lnk wh m a: hp://www.lnkdn.om/n/hssnalxhang
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Gabl Solao Sn: Thusday, Oob 02, 2008 8:00 PM To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
Thanks o Tony and Bob fo h suggsons.
Is possbl o fn h odays da n ha PoSh on-ln sp?
Thanks - Gabl
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Rob Bobl Sn: moldì 1 oob 2008 14.04 To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
I ook m a whl o g hs soy fo h la pos
h PoSh ommand would b somhng.
g-qadus -ldapFl "(|(lasLogonTmsamp&l;=$(([aTm]"2008/01/01").ToFlTmUTC()))(!(lasL ogonTmsamp=*)))" -Enabld | f Nam, LasLogonTmsamp
Pobably no as fas h oh ools mnond, bu woks.
Bob
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Tony Muay Sn: Thusday, Spmb 18, 2008 9:25 PM To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
H Gabl
Ys, o boh of hos.
hp://www.jowa.n/fools/ools/oldmp/usag.hm
You an us h sam fl you us fo FIN.EXE
FWIW, I pf usng FIN as an g m nly fomad da flds n h oupu CSV, n fo h k ons lk whnCad. Hs how I us :
adfnd -s -dfaul -da -u -bnn -b -f "(&(samaounyp=805306368)(|(lasLogonTmsamp&l;={{u:2008/01/01}})(!(la sLogonTmsamp=*)))(!(usounConol:N:=2)))" laslogonmsamp pwdlass aounxps whnad
Wh hs nfomaon you ha a good han of wokng ou whh an aoun s na o no.
Gong bak o you ognal quson, you should b abl o do wha you wan wh a sp wapp (VBSp o Powshll) aound FIN.
Tony
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Gabl Solao Sn: Fday, 19 Spmb 2008 12:45 p.m. To: @mal.ad.og Subj: RE: [] Usng dFnd o numa na aouns
os oldomp oupu o s and numa non-dsabld aouns?
Fom: -own@mal.ad.og [malo:-own@mal.ad.og] On Bhalf Of Laua E. Hun Sn: ndì 19 smb 2008 2.33 To: @mal.ad.og Subj: R: [] Usng dFnd o numa na aouns
Why no jus us oldmp wh h -uss swh? On of h swhs ls you spfy "g m uss whos lls s a las &l;X&g; days old", whh should suff fo wha you' dsbng.
On Thu, Sp 18, 2008 a 7:51 PM, Gabl Solao &l;gabo@gabo.n&g; wo:
a all, as h subj says, I would lk o a a s ls of uss who a "nabld" bu ha no loggd n sn 31 July 2008.
Ths ln sms o do h job: C:\bn\dFnd.x -dfaul -bnn -f "(&(objagoy=pson)(objlass=us)(laslogonmsamp&l;={{LOCL:200 8/08/01}})(!usounConol:1.2.840.113556.1.4.803:=2))" dsplaynam dspon ompany laslogonmsamp -ds -s &g; :\ou\InaUss.x
Now - fog my quson ha an sound a b slly - ... s h a way o us h oday's da n pla of {{LOCL:2008/08/01}} n ha sngl ommand ln? O n b h oday's da - (mnus) xx days?
Thanks n adan - Gabl.
Ls nfo : hp://www.ad.og/Ls.aspx Ls FQ : hp://www.ad.og/LsFQ.aspx Ls ah: hp://www.ad.og/ma/dfaul.aspx
-- ----------------------- Laua E. Hun h, Oxfod Compu Goup (hp://www.oxfodompugoup.om) Mosof MVP, oy Ss (hps://mp.suppo.mosof.om/pofl/laua) uho, oy Consulan's Fld Gud (hp://nyul.om/7f8ll) uho, oy Cookbook, Sond Edon (hp://nyul.om/z7sl)
| | | |
|
|