Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - How do I delete an OU in Active Directory from Powershell.

Reply
 
Old 05-19-2008   #1 (permalink)
Johannes L


 
 

How do I delete an OU in Active Directory from Powershell.

it's probably a stupid question but I can't seem to find info on it anywhere.
Looking for a simple command in Powershell too remove a OU completely.
Thanks alot, really appreachiating all the help I can get.

My System SpecsSystem Spec
Old 05-19-2008   #2 (permalink)
RichS [MVP]


 
 

RE: How do I delete an OU in Active Directory from Powershell.

There isn't one. When you install PowerShell there are no cmdlets for
working with AD. You will either have to script it or use the Quest AD
cmdlets (better solution) and use the Remove-QADObject cmdlet
--
Richard Siddaway
All scripts are supplied "as is" and with no warranty
PowerShell MVP
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"Johannes L" wrote:
Quote:

> it's probably a stupid question but I can't seem to find info on it anywhere.
> Looking for a simple command in Powershell too remove a OU completely.
> Thanks alot, really appreachiating all the help I can get.
My System SpecsSystem Spec
Old 05-19-2008   #3 (permalink)
Shay Levi


 
 

Re: How do I delete an OU in Active Directory from Powershell.



Try:

$ou = [adsi] "LDAP://ou=ouName,dc=domain,dc=com"
$ou.psbase.deleteTree()


---
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> it's probably a stupid question but I can't seem to find info on it
> anywhere.
> Looking for a simple command in Powershell too remove a OU completely.
> Thanks alot, really appreachiating all the help I can get.

My System SpecsSystem Spec
Old 05-19-2008   #4 (permalink)
Johannes L


 
 

Re: How do I delete an OU in Active Directory from Powershell.

Thanks Mr. Levi, that's the syntaks I was looking for! !

"Shay Levi" wrote:
Quote:

>
>
> Try:
>
> $ou = [adsi] "LDAP://ou=ouName,dc=domain,dc=com"
> $ou.psbase.deleteTree()
>
>
> ---
> Shay Levi
> $cript Fanatic
> http://scriptolog.blogspot.com
>
Quote:

> > it's probably a stupid question but I can't seem to find info on it
> > anywhere.
> > Looking for a simple command in Powershell too remove a OU completely.
> > Thanks alot, really appreachiating all the help I can get.
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Access Active directory with sql server in powershell PowerShell
Making changes to Active Directory with Powershell PowerShell
PowerShell Active Directory Groups_Users Issue. PowerShell
Powershell & Active Directory PowerShell
Active Directory support in PowerShell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46