Frankly, you wont get a ready made script from the forums, but can guide you so that you can start writing it.
You would use Get-AdUser, Get-ADGroup cmdlets , may be you could use ForEach-Object as well. I suggest you reading the documentation of those cmdlets and start writing the script. You can update this thread with any blockers/errors you face using/writing the script.