Guru's, your idea's please.

I'm maintaining the organization structure in AD, creating OU when a new
department is created in SAP.
I can also automatically delete them, but how can I check if there are no
objects in the container. If there are, the delete will fail (and
aside-should not have taken place at all)

I should probably query, but for what, and how to check the results?

Same thing for a group, how to check if it still has any members.

Regards,
René