Quantcast
Viewing all articles
Browse latest Browse all 4767

...not found because The directory service can perform the requested operation only on a leaf object...

Good afternoon,

I have been working on a simple script which will allow me to delete computer objects from the AD. The problem that I am running into though, is very annoying and I have tried some suggestions online, without success.

My script is listed below. Please provide some pointers as to how I can accomplish what I need:

$computers = get-content a:\desktop\deleteadcomputerobjects.txt
foreach ($computer in $computers)
{	Try {
		remove-adcomputer -identity $computer | remove-adobject -recursive -erroraction stop -whatif
		add-content a:\desktop\deletecomputers.log -value "$computer removed"
	}
	Catch {
		Add-content a:\desktop\deletecomputers_errors.log -value "$computer not found because $($error[0])"
	}
}
Thanks in advance!


Viewing all articles
Browse latest Browse all 4767

Trending Articles



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