AD+.txt related scrypt question


hello, trying figure out how make script that:

1. takes data text file(which contains list of user id's ad)

2. sorts out users, did not log in in 30 days

3. exports file.

at moment got:

i figured not getting id's .txt xxx path, searching whole ad noticed, , txt document, giving list of inside.

$text1 = write-output >random text<

$lastdate = (get-date).adddays(-30)

$filter = {lastlogon -le $lastdate}

get-content -path xxxx

get-aduser -filter $filter -property lastlogondate | sort-object -property lastlogon -descending | export-csv xxx

$text1

hi heim,

try this:$date = (get-date).adddays(-30)

get-aduser -filter * -properties * | select -property name,lastlogondate | ? {.lastlogondate -le $date} | sort -property lastlogondate -descending | export-csv logon.csv  

best regards,

andy


please remember mark replies answers if , unmark them if provide no help.
if have feedback technet subscriber support, contact tnmff@microsoft.com.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B

DFSR RPC replication errors 5014 1726 with large files over VPN