Hi I need assistance on how I can get a list of users in a specific sub OU (sub container) and exported it out. I have this PowerShell script but it's not recognizing the sub ou , it says cannot find an object with the identity "ABCTestgroup" under DC=IT, DA=ITS
Here is the PowerShell script that I used:
Get-ADGroup ABCtestgroup | Get-ADGroupMember | Get-ADUser -Properties Lastlogondate | Select Name, SamAccountName, LastlogonDate | Export-CSV -Path "c:\temp\ADUsers.csv" -NotypeInformation
ABCtextgroup is sub OU of ABCUsers OU . The goal is to find out if the users within the ABCtextgroup are still active users and if not, I want move them in the nonactive users container.