289769a601
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 8s
20 lines
707 B
Markdown
20 lines
707 B
Markdown
---
|
|
tags:
|
|
- PowerShell
|
|
- Reporting
|
|
- Scripting
|
|
---
|
|
|
|
## Purpose
|
|
This document records the procedure for inactive users. Follow the environment assumptions and commands below.
|
|
|
|
```powershell
|
|
InactiveDays = 30
|
|
$Days = (Get-Date).Adddays(-($InactiveDays))
|
|
Get-ADUser -Filter {LastLogonTimeStamp -lt $Days -and enabled -eq $true} -Properties LastLogonTimeStamp |
|
|
select-object Name,@{Name="Date"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp).ToString('MM-dd-yyyy')}}
|
|
```
|
|
|
|
## Related Documentation
|
|
- [Related Identity and Certificates Documentation](<../../../../reference/Identity and Certificates/index.md>) — Find the connected deployments, procedures, and references for this subject.
|