Create a new managed unit for OU's

Hi, I'm new to AR and was hoping for a little advice if possible.

We've a in the region of 500 OU's and need to create at least two managed units for each one. The managed unit rules will be based on some AR virtual attributes for a region and country.

I am hoping to be able to create the managed units via powershell outside of AR, so that I can follow the process and test before creating all of the MU's

Can anyone please point me in the right direction for this?

Many thanks

Matt