0

I am using this script to add/create a new group:

$strCLass = "Group"
$StrName = "CN=$naam"
$intGroupType = $type
$objADSI = [ADSI]"LDAP://ou=$OU,dc=myADserver,dc=local" 
$objGroup = $objADSI.create($strCLass, $StrName)
$ObjGroup.put("GroupType",$intGroupType)
$objGroup.setInfo()

I can't find a way to reverse this so that i can delete group from the OU.

Axxess
  • 522
  • 2
  • 7
  • 19

2 Answers2

3
$objADSI.Delete($strCLass,$StrName)
Shay Levy
  • 121,444
  • 32
  • 184
  • 206
  • This is useful on servers which have an older version of Powershell that doesn't have the Powershell ActiveDirectory module available. – NikG Oct 03 '13 at 11:16
0

Can you use the Powershell ActiveDirectory module?

If you can, then it's as simple as Remove-ADGroup

http://technet.microsoft.com/en-us/library/ee617228.aspx

Musaab Al-Okaidi
  • 3,734
  • 22
  • 21