How to delete a computer that lives in an OU that no longer exist?

Steven Hoong
Steven Hoong used Ask the Experts™
when I query computers in AD

dsquery computer -inactive 12 -limit 0

Open in new window

this computer shows up


Open in new window

That OU no longer exist and I'm trying to delete it but I keep getting

dsrm failed:CN=VDESKTOP-VM,OU=PA...:The directory service can perform the requested operation only on a leaf object

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Active Directory/Exchange Engineer
Top Expert 2015
open powershell (run as administrator) and let's set a variable to that dN, then run the Remove-ADObject command

$objectname = "CN=VDESKTOP-VM,OU=PA,...."
Remove-ADObject -Identity $objectname -Recursive
Steven HoongSystems Administrator


thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial