Creating OU in Powershell


  • I was just wondering how to create an OU in powershell. I'm trying to use this script. I want it to work without a domain so it can run on my schools computer.

    $objDomain =[ADSI]"LDAP://"
    $objOU = $objDomain.Create("organizationalUnit","ou=HR")

    I keep getting this error.. But I don't know what to do, I've looked around a lot and can't really find what I need.

    The following exception occurred while retrieving member "Create": "Unknown error (0x80005000)"
    At :line:2 char:8
    + $objOU = <<<<  $objDomain.Create("organizationalUnit","ou=HR")

    Sunday, May 23, 2010 12:07 PM

All replies