[gptalk] Re: Script the deletion of unlinked GPOs in a domain?

  • From: "Jason B. Halladay" <jason@xxxxxxxx>
  • To: gptalk@xxxxxxxxxxxxx
  • Date: Mon, 05 May 2008 14:23:11 -0600

Hello Darren,
Excellent, I was hoping someone would suggest a Powershell way to do it--I have been working a fair bit with PS recently. Thanks so much! Your free GPMC cmlets will be fantastic. Jason

On 5/5/08 1:37 PM, Darren Mar-Elia wrote:
Jason-
Have you done anything with PowerShell? This is actually fairly trivial
using PowerShell with my free GPMC cmdlets
(www.sdmsoftware.com/freeware.php), as follows:

Install the free GPMC cmdlets and then open the shortcut that gets created
by the cmdlets. Create a text file with the first line of "Name" and the
subsequent lines as the names of the unlinked GPOs you want to remove:

e.g.
gpos.txt:

Name
My First GPO
My Second GPO
Marketing GPO


Then from Powershell, run the following interactively or from a script:


$gpos = import-csv gpos.txt
foreach ($gpo in $gpos){remove-sdmgpo $gpo.Name}



That's all there is to it!

Darren




-----Original Message-----
From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of Jason B. Halladay
Sent: Monday, May 05, 2008 12:26 PM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Script the deletion of unlinked GPOs in a domain?

Hello all,
We have a large number of unlinked GPOs in our environment and I plan to delete all the unlinked GPOs. I've used the "FindUnlinkedGPOs.wsf" script that is included with the GPMC scripts to identify all the unlinked GPOs. I'd like to script the deletion of all these unlinked GPOs if possible. Has anyone done this before? Suggestions for someone who doesn't do VBscript?

Thank you,
Jason
***********************
You can unsubscribe from gptalk by sending email to
gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR by
logging into the freelists.org Web interface. Archives for the list are
available at //www.freelists.org/archives/gptalk/
************************

***********************
You can unsubscribe from gptalk by sending email to 
gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR by 
logging into the freelists.org Web interface. Archives for the list are 
available at //www.freelists.org/archives/gptalk/
************************

Other related posts: