Skip to content

Commit

Permalink
Update Remove-StaleADObjects.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
cosine83 authored Nov 10, 2017
1 parent 72bda62 commit e4d8455
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Remove-StaleADObjects.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ ForEach ($computer in $compLogon) {
Move-ADObject -Identity $computer.ObjectGUID -TargetPath $InactiveCompsOU
Write-Host -Foreground Yellow -Background Black $computer.Name "disabled and moved"
}
Else {
Write-Host -Foreground Yellow -Background Black $computer.Name "has logged in within the last 90 days"
}
}

Write-Host -Foreground Yellow -Background Black "Beginning user search..."
Expand All @@ -24,6 +27,9 @@ ForEach ($user in $userLogon) {
Move-ADObject -Identity $user.ObjectGUID -TargetPath $InactiveUsersOU
Write-Host -Foreground Yellow -Background Black $user.DisplayName "disabled and moved"
}
Else {
Write-Host -Foreground Yellow -Background Black $User.DisplayName "has logged in within the last 90 days"
}
}

Write-Host -Foreground Yellow -Background Black "Removing users and computers from groups..."
Expand Down

0 comments on commit e4d8455

Please sign in to comment.