Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Determine computer objects password days

Reply
 
Old 10-13-2008   #1 (permalink)
IT Staff


 
 

Determine computer objects password days

Is there a way to determine the AD computer object password days ? Eg i wish
to extract machines that password was not changed for more than 180 days,
etc

I think if computer is offline for *too long*, and if it is bring up to the
domain again, the machine may need to rejoin domain.

What functions are there in powershell to determine this ?



My System SpecsSystem Spec
Old 10-13-2008   #2 (permalink)
tojo2000


 
 

Re: Determine computer objects password days

On Oct 13, 1:48*am, "IT Staff" <jkk...@xxxxxx> wrote:
Quote:

> Is there a way to determine the AD computer object password days ? Eg i wish
> to extract machines that password was not changed for more than 180 days,
> etc
>
> I think if computer is offline for *too long*, and if it is bring up to the
> domain again, the machine may need to rejoin domain.
>
> What functions are there in powershell to determine this ?
You can do it the same way you do with users. I usually check the
lastLogonTimeStamp property of its object in AD, which will be mostly
accurate (replicates slowly).

There's also an attribute called pwdLastSet for the date that the
password was last set. All computers are users, so the same
attributes apply when it comes to passwords.
My System SpecsSystem Spec
Old 10-13-2008   #3 (permalink)
adrian


 
 

Re: Determine computer objects password days

On Oct 13, 2:19*am, tojo2000 <tojo2...@xxxxxx> wrote:
Quote:

> On Oct 13, 1:48*am, "IT Staff" <jkk...@xxxxxx> wrote:
Quote:

> There's also an attribute called pwdLastSet for the date that the
> password was last set. *All computers are users, so the same
> attributes apply when it comes to passwords.
Here's a script I just wrote for this using pwdLastSet. Needs Quest AD
Management shell cmdlets. This will get computer accounts that haven't
changed their passwords in x days and move them to a pending delete
OU. Also, you can make a goodlist so if some machines should not be
deleted you don't have to skip them every time.

#Where to look
$searchroot = 'yourdomain.com/Computers'

#get the good list into an array
import-csv "move-over90days_goodlist.txt"|%{[array]$good += $_.name}
$pendingdelete = "OU=PendingDelete,DC=yourdomain,DC=com"

$old = (Get-Date).AddDays(-90)
$logfile = "PendingDeleteLog.csv"
$date = Get-Date

# get the list of computers with the date earlier than this date
$computers = Get-QADComputer -SearchRoot $searchroot -
IncludedProperties pwdLastSet -SizeLimit 0 | where { $_.pwdLastSet -le
$old }

$computers |ft name, description, pwdLastSet
write-host Found: $computers.count

$computers| % {
if ($good -notcontains $_.name) {
if ((Read-Host Name: $_.name Description: $_.description LastChange:
$_.pwdLastSet) -eq "y") {
$ou = $_.ou
$lastLogon = $_.pwdlastset
$name = $_.name
$out = "$name, $ou, $lastlogon, $date"
Out-File -FilePath $logfile -Append -NoClobber -InputObject $out

$a = Get-QADComputer $_.name|set-qadobject -ObjectAttributes
@{userAccountControl=514}|Move-QADObject -to $pendingdelete
Write-Host Disabled and moved $_.name
Write-Host " "
}
}
}
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
script to determine password expire date and send email notificati PowerShell
Log On Password Expires in X days Vista security
Password Expires in 60 days Vista General
could not determine if this computer contains a valid system volum Vista installation & setup
Setup cannot determine if this computer supports installation Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46