Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Delete conflicting objects in AD and keep an ongoing log of what is being deleted

$
0
0

Hello,

I need to create a script that deletes conflcting objects within AD, and then append that info into a log. Below is what I have, however, I cannot get what is being deleted to be appended to the text file. I've tried variations and combos, including trying to use Export-Excel, or putting the line after the brackets. I've Bing'ed and consulted friends, and they do not understand why Out-File just doesn't work.


Any suggestions?

$test = dsquery * forestroot -gc -attr distinguishedname,whenchanged,whencreated -limit 0 -scope subtree -filter "(name=*\0ACNF:*)" 
foreach ($object in $test){
Remove-QADObject -Identity $object -Force -Verbose | Out-File -Append "c:\scripts\ConflictingObjectLog.txt" -noclobber
}


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>