Hi,
Yes copy paste in the powershell and yes try with admin rights to launch powershell.
==
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi everyone,
I want to export all of my AD users whom have not logged in more than 180 days.
Is there anyway I can do it through Powershell or directly from ADUC?
Thank you..
Hi,
Yes copy paste in the powershell and yes try with admin rights to launch powershell.
==
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.
Hi,
I have updated the code via the Q&A feature this should work without any spaces or hypen. Thanks @Andreas Baumgarten
Import-Module ActiveDirectory
$DaysInactive = 180
$Time = (Get-Date).Adddays( - ($DaysInactive))
Get-ADUser -Filter { LastLogonTimeStamp -lt $Time -and enabled -eq $true } -Properties * |
Select-Object Name, LastLogonDate |
Export-Csv "c:\Export\InactiveUsers.csv" -Encoding UTF8 -NoTypeInformation
==
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.
Hi Abdul,
Yes you can use this script:
Import-Module ActiveDirectory
$DaysInactive = 180
$Time = (Get-Date).Adddays( - ($DaysInactive))
Get-ADUser -Filter { LastLogonTimeStamp -lt $Time -and enabled -eq $true } -Properties * |
Select-Object Name, LastLogonDate |
Export-Csv "c:\Export\InactiveUsersdate.csv" -Encoding UTF8 -NoTypeInformation
=
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.
Hi,
It seems you copied and paste the command there might be some space or characters in the script, just make sure not to put any space between the hyphen(-) and the Name parameter and the same way Don’t put any space between the hyphen(-) and Location parameter.
==
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.