Add Scripts/Powershell/Reporting/Inactive Users.md
This commit is contained in:
6
Scripts/Powershell/Reporting/Inactive Users.md
Normal file
6
Scripts/Powershell/Reporting/Inactive Users.md
Normal file
@ -0,0 +1,6 @@
|
||||
``` 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')}}
|
||||
```
|
Reference in New Issue
Block a user