I am sure this is a beginner question here but I am unable to find anything online about it.
I see the list, but would like to go through it manually to make sure accounts that are needed do not get deleted. The problem is that when I pipe it to export-csv, it creates a blank file with nothing in it even though I do see the list on the screen
Is there something I am missing? Also, how can I tell it to look in certain OU's and not the whole domain?
Any help would be greatly appreciated.
To search a particular OU use the -SearchBase parameter to define the OU (by distinguished name)
Whatif appears to be similar to write-hoist in that it writes directly to screen.
One suggestion would be to use start/stop-transcripot round your command – the output of this will be captured
You don't need to use -WhatIf to get the expected result for your review. The Search-ADAccount cmdlet returns ADUser objects with the Enabled property which you can use to filter for only enabled inactive users, select the properties required in your CSV and pipe to Export-Csv.
I hope above helps.
You must be logged in to reply to this topic.