
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lead, Follow, or Move &#187; Group Policy</title>
	<atom:link href="http://www.leadfollowmove.com/archives/tag/group-policy/feed" rel="self" type="application/rss+xml" />
	<link>http://www.leadfollowmove.com</link>
	<description>Adam Bell on Deployment, Automation, PowerShell et al</description>
	<lastBuildDate>Thu, 22 Apr 2010 14:34:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Presentation &#8211; Managing Group Policy using PowerShell</title>
		<link>http://www.leadfollowmove.com/archives/powershell/presentation-managing-group-policy-using-powershell</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/presentation-managing-group-policy-using-powershell#comments</comments>
		<pubDate>Thu, 22 Nov 2007 18:27:09 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Get-PSUGUK]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell Groups]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/presentation-managing-group-policy-using-powershell</guid>
		<description><![CDATA[So. I gave the presentation to the UG on Tuesday night. It was the first real time I&#8217;ve done that sort of thing. I tend to be very self critical so I believe it could have gone better, but I&#8217;m happy that the fundamental message got across. I&#8217;ll write up the meeting soon. [Updated 27 [...]]]></description>
			<content:encoded><![CDATA[<p>So. I gave the presentation to the UG on Tuesday night. It was the first real time I&#8217;ve done that sort of thing. I tend to be very self critical so I believe it could have gone better, but I&#8217;m happy that the fundamental message got across.</p>
<p>I&#8217;ll write up the meeting soon.</p>
<p>[Updated 27 Nov 2007]</p>
<p>I&#8217;ve put the presentation inside a zip file. This should resolve any issues. Please let me know ..</p>
<p>Any comments on either the night, or the attached PowerPoint are welcome &#8230;.<br />
<a href='http://www.leadfollowmove.com/wp-content/uploads/lfm-gpomanagementwithpowershell-v11.zip' title='Group Policy Management with PowerShell'>Group Policy Management with PowerShell</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/presentation-managing-group-policy-using-powershell/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Nine. No. Twelve</title>
		<link>http://www.leadfollowmove.com/archives/powershell/nine-no-twelve</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/nine-no-twelve#comments</comments>
		<pubDate>Thu, 15 Nov 2007 10:32:26 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Announcements]]></category>
		<category><![CDATA[PowerShell Tools]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/nine-no-twelve</guid>
		<description><![CDATA[..and he has given unto you these these nine &#8230;. twelve! twelve cmdlets for GPO management! Apologies for the poor homage. I couldn&#8217;t help myself ;)]]></description>
			<content:encoded><![CDATA[<p>..and he has given unto you these these <a title="Dmitry's Blog: SDM' provides 9 cmdlets" href="http://dmitrysotnikov.wordpress.com/2007/11/15/sdm-software-provides-9-gpo-cmdlets/">nine</a> &#8230;. twelve! <a title="SDM Software: GPO cmdlets updated" href="http://sdmsoftware.com/blog/2007/11/sdm_software_gpmc_cmdlets_upda.html">twelve cmdlets</a> for GPO management!</p>
<p>Apologies for the poor <a title="IMDB: History of the World Part 1 Quotes" href="http://www.imdb.com/title/tt0082517/quotes">homage</a>. I couldn&#8217;t help myself ;) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/nine-no-twelve/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CTP&#8217;s, Beta&#8217;s and Releases</title>
		<link>http://www.leadfollowmove.com/archives/powershell/ctps-betas-and-releases</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/ctps-betas-and-releases#comments</comments>
		<pubDate>Fri, 09 Nov 2007 10:55:01 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/ctps-betas-and-releases</guid>
		<description><![CDATA[It looks like everyone is busy this week: The PowerShell Team have released a CTP of 2.0. Skype have released Beta 2.0 for Linux (finally bringing video!) SDM Software have released a set of free cmdlets full of GPO goodness! And even though it wasn&#8217;t technically this week, Microsoft&#8217;s Deployment4, was officially named Microsoft Deployment, [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like everyone is busy this week:</p>
<p>The PowerShell Team have released a <a title="Microsoft: PowerShell 2.0 CTP" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=60deac2b-975b-41e6-9fa0-c2fd6aa6bc89&#038;displaylang=en">CTP of 2.0</a>.</p>
<p>Skype have released <a title="Skype: Linux Beta" href="http://www.skype.com/intl/en/download/skype/linux/beta/">Beta 2.0 for Linux</a> (finally bringing video!)</p>
<p>SDM Software have released a set of <a title="SDM Software: Freeware page" href="http://www.sdmsoftware.com/freeware.php">free cmdlets</a> full of GPO goodness!</p>
<p>And even though it wasn&#8217;t technically this week, Microsoft&#8217;s Deployment4, was officially named <em>Microsoft Deployment</em>, and went to <a title="Microsoft Deployment Blog: RC1 announcement" href="http://blogs.technet.com/msdeployment/archive/2007/10/26/download-microsoft-deployment-rc1-from-microsoft-connect-today.aspx">RC1</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/ctps-betas-and-releases/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SpecOps Command</title>
		<link>http://www.leadfollowmove.com/archives/powershell/specops-command</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/specops-command#comments</comments>
		<pubDate>Thu, 01 Nov 2007 23:32:40 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Tools]]></category>
		<category><![CDATA[Tech Talk]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/specops-command</guid>
		<description><![CDATA[PowerShell is gaining in popularity, and more companies are announcing products that provide access to interfaces to PowerShell for automation and administration. This situation is very similar to when the Windows Installer (MSI) technology first came on to the scene around 2000-2001, and anyone authoring setup software was dealing with how to get it out [...]]]></description>
			<content:encoded><![CDATA[<p>PowerShell is gaining in popularity, and more companies are announcing products that provide access to interfaces to PowerShell for automation and administration.</p>
<p>This situation is very similar to when the Windows Installer (MSI) technology first came on to the scene around 2000-2001, and anyone authoring setup software was dealing with how to get it out into their environments. Everyone was including the redistributable with their software in case the machine it was going to be installed on didn&#8217;t have it in place already.</p>
<p>The complexity with PowerShell however is that there are two questions that need to be dealt with:1) Like MSI, how do you deploy PowerShell out in your environment? and 2) How do you manage your <a title="LFM: PowerShell Portability" href="http://www.leadfollowmove.com/archives/powershell/powershell-portability">PowerShell landscape</a> of Snappins?</p>
<p>I was lucky enough see an online demo from Magnus and Thorbjorn from Special Operations Software today. They have a new product expected to be announced at TechEd later this month, called <em>SpecOps Command</em> which I believe will deal with these questions, for starters.</p>
<p><em>SpecOps Command</em>, seems to be a tightly integrated product between Group Policy and PowerShell. This combination has the ability to provide it with the best of both products: the ease and flexibility of PowerShell, and the centralised environment management of Group Policy.</p>
<p>The tool has loads of cool features including the ability to run PoSH scripts assigned in GPO&#8217;s, Undo scripts for when things fall out of scope, reporting, and the ability to target clients in a very granular manner e.g. Only apply to Dell machines running Windows XP.</p>
<p>Thorbjorn advised that <em>SpecOps</em> intend to release a couple of versions of <em>Command</em>, including a free version that should provide the core functionality including the abilty to distribute PowerShell out into your environment. </p>
<p>I think it&#8217;s great that ISV&#8217;s like <em>Quest</em> and <em>SpecOps</em> are adding value to the PowerShell community with free offerings, as well as their commercial products. It give them exposure to their intended market, and provides us with some cool tools to make life easier :)</p>
<p>Like <a title="Quest: AD Cmdlets" href="http://www.quest.com/activeroles-server/arms.aspx">Quest&#8217;s AD Cmdlet&#8217;s</a> I think <em>SpecOps Command</em> is likely to have a big impact on the way we use PowerShell going forwards.</p>
<p>[Update 2 Nov]<br />
Magnus just gave me the link to the SpecOps website for <a title="SpecOps Command" href="http://www.specopssoft.com/powershell/">Command</a>. This will be the product page when it releases. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/specops-command/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GPO Settings with PowerShell and GPExpert Scripting Toolkit</title>
		<link>http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit#comments</comments>
		<pubDate>Tue, 14 Aug 2007 20:33:07 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Tools]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit</guid>
		<description><![CDATA[In this post we&#8217;re going to take a look at changing some basic Group Policy Settings through the GPexpert Scripting Toolkit. The toolkit is accessed as a PowerShell Snapin, and can make changes to the following GPO branches: In this example, we&#8217;re going to make a change to the Max password age located within the [...]]]></description>
			<content:encoded><![CDATA[<p>In this post we&#8217;re going to take a look at changing some basic Group Policy Settings through the <a title="SDM Software: GPexpert Scripting Toolkit" href="http://www.sdmsoftware.com/products2.php">GPexpert Scripting Toolkit</a>.</p>
<p>The toolkit is accessed as a PowerShell Snapin, and can make changes to the following GPO branches:<br />
<a href='http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit/attachment/gpexpert-scripting-toolkit-documentation/' rel='attachment wp-att-157' title='GPexpert Scripting Toolkit Documentation'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpexpert-branches.thumbnail.PNG' alt='GPexpert Scripting Toolkit Documentation' /></a></p>
<p>In this example, we&#8217;re going to make a change to the <em>Max password age</em> located within the <em>Account Policies / Password Policy</em> branch.</p>
<p>This is a shot of the <em>Default Domain Policy</em> with the default Password Policy settings. We&#8217;re going to change the <em>Max password age</em> setting from 24 to 7 because we like to make users lives difficult ;)<br />
<a href='http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit/attachment/default-domain-policy-password-policy-settings/' rel='attachment wp-att-155' title='Default Domain Policy - Password Policy Settings'><img src='http://www.leadfollowmove.com/wp-content/uploads/defaultdompol-before.thumbnail.PNG' alt='Default Domain Policy - Password Policy Settings' /></a></p>
<p><strong>[Note]</strong> The blank spaces in the following pictures are where I&#8217;ve had to remove the domain name. This should be in FQDN format: <em>MyDomain.tld</em><br />
<a href='http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit/attachment/password-policy-max-password-age/' rel='attachment wp-att-158' title='Password Policy - Max password age'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpexpert-maxpwdage.thumbnail.png' alt='Password Policy - Max password age' /></a></p>
<p>A quick check in GPMC, confirms that the setting has changed.<br />
<a href='http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit/attachment/default-domain-policy-password-policy-settings-2/' rel='attachment wp-att-156' title='Default Domain Policy - Password Policy Settings #2'><img src='http://www.leadfollowmove.com/wp-content/uploads/defaultdompol-after.thumbnail.PNG' alt='Default Domain Policy - Password Policy Settings #2' /></a></p>
<p>Walking through the code, we can see how easy it is.</p>
<div class="quickcodenoclick"><code><br />
Add-PSSnapin GetGPOObjectPSSnapin<br />
$gpo = Get-SDMgpobject -gpoName &quot;gpo://example.com/Default Domain Policy&quot; -openByName $true;<br />
</code></div>
<p>We add the snapin to the Shell so that we can use the GPO cmdlets.<br />
The second line binds to the GPO we are going to change.</p>
<p>If we perform a <strong>Get-Method</strong> on the <strong>$gpo</strong> object we get an insight into some of the methods we have access to:<br />
<a href='http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit/attachment/displaying-a-get-method-on-the-gpo-object/' rel='attachment wp-att-159' title='Displaying a Get-Method on the $gpo object'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpo-getmethod.thumbnail.PNG' alt='Displaying a Get-Method on the $gpo object' /></a></p>
<p>Here we create the <strong>$setting</strong> object to the setting we wish to change.</p>
<div class="quickcodenoclick"><code><br />
$setting = $gpo.GetObject(&quot;Computer Configuration/Windows Settings/Security Settings/Account Policies/Password Policy/Maximum password age&quot;);<br />
</code></div>
<p>Using the <strong>Put()</strong> method we change the attributes to what&#8217;s required. This is a similar way that certain AD attributes are modified too.</p>
<div class="quickcodenoclick"><code><br />
$setting.Put(&quot;Defined&quot;, $true);<br />
$setting.Put(&quot;Value&quot;, 7);<br />
$setting.Save();<br />
</code></div>
<p>We&#8217;ll be having a look at other settings and methods that can be changed through these cmdlets soon. In the mean time here&#8217;s the completed code snippet:<br />
<a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode1544');">Set-MaxPwdAge</a></p>
<div id="quickcode1544" class="quickcode"><code><br />
Add-PSSnapin GetGPOObjectPSSnapin<br />
&nbsp;<br />
$gpo = Get-SDMgpobject -gpoName &quot;gpo://example.com/Default Domain Policy&quot; -openByName $true;<br />
$setting = $gpo.GetObject(&quot;Computer Configuration/Windows Settings/Security Settings/Account Policies/Password Policy/Maximum password age&quot;);<br />
$setting.Put(&quot;Defined&quot;, $true);<br />
$setting.Put(&quot;Value&quot;, 7);<br />
$setting.Save();<br />
</code></div>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/gpo-settings-with-powershell-and-gpexpert-scripting-toolkit/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change Group Policy Settings through PowerShell</title>
		<link>http://www.leadfollowmove.com/archives/powershell/group-policy-settings-changed-through-powershell</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/group-policy-settings-changed-through-powershell#comments</comments>
		<pubDate>Mon, 30 Jul 2007 21:29:08 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Tools]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/group-policy-settings-changed-through-powershell</guid>
		<description><![CDATA[If you&#8217;ve done any kind of GPO management before, you&#8217;ll be aware that the one thing you can&#8217;t do (that I&#8217;ve ever been able to find) is actually change explicit settings. Well today I stumbled across GPExpert™ Scripting Toolkit for PowerShell. This product apparently exposes GPO settings to PowerShell, allowing specific changes to be made, [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve done any kind of GPO management before, you&#8217;ll be aware that the one thing you can&#8217;t do (that I&#8217;ve ever been able to find) is actually change explicit settings.</p>
<p>Well today I stumbled across <a title="SDM Software: GPExpert" href="http://www.sdmsoftware.com/products2.php">GPExpert™ Scripting Toolkit for PowerShell</a>. This product apparently exposes GPO settings to PowerShell, allowing specific changes to be made, rather than importing backed up GP objects.</p>
<p>I&#8217;ve not had the opportunity to take it for a test drive yet, but I do have an eval version and will be having a closer look later this week.I&#8217;ll let you know how it shapes up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/group-policy-settings-changed-through-powershell/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linking a GPO using GPMC and PowerShell</title>
		<link>http://www.leadfollowmove.com/archives/powershell/linking-a-gpo-using-gpmc-and-powershell</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/linking-a-gpo-using-gpmc-and-powershell#comments</comments>
		<pubDate>Tue, 29 May 2007 10:42:50 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/linking-a-gpo-using-gpmc-and-powershell</guid>
		<description><![CDATA[Previously we have gone through the process of creating a Group Policy Object, and importing a backed up GPO into the directory. In this post we&#8217;ll take a look at linking our GPO to an OU. We will use the GPO from the previous examples: &#8220;New GPO Test&#8221;, and we will link it to the [...]]]></description>
			<content:encoded><![CDATA[<p>Previously we have gone through the process of creating a Group Policy Object, and importing a backed up GPO into the directory. In this post we&#8217;ll take a look at linking our GPO to an OU.</p>
<p>We will use the GPO from the previous examples: &#8220;New GPO Test&#8221;, and we will link it to the <em>Domain Controllers</em> OU.</p>
<p>As usual, we start by creating a reference to the domain (<em>$root</em>), instantiating the GPMC COM object (<em>$gpm</em>), and by binding to the domain through GPMC (<em>$domain</em>).<br />
<a href='http://www.leadfollowmove.com/archives/powershell/linking-a-gpo-using-gpmc-and-powershell/attachment/creating-a-gpo-link-with-gpmc-and-powershell/' rel='attachment wp-att-136' title='Creating a GPO link with GPMC and PowerShell'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpolink.thumbnail.png' alt='Creating a GPO link with GPMC and PowerShell' /></a><br />
After searching AD for a policy called <em>New GPO Test</em>, we check to see if we have found a match by looking at <em>$GPOlist.count</em>. We have only found one here so we have no problems to proceed.</p>
<p>The <em>$SOM</em> object refers to the <a title= "MSDN: IGPMSOM" href="http://msdn2.microsoft.com/en-us/library/aa814272.aspx">Scope of Management</a>, which is where we specify our target for the link. The -1 refers to the <a title="MSDN: GPMSOM.CreateGPOLink" href="http://msdn2.microsoft.com/en-us/library/aa814277.aspx">link order</a>, which in this example will append our GPO to the end of the list.<br />
<a href='http://www.leadfollowmove.com/archives/powershell/linking-a-gpo-using-gpmc-and-powershell/attachment/methods-available-to-the-gpmlink-object/' rel='attachment wp-att-137' title='Methods available to the GPMlink object'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpmlink.thumbnail.png' alt='Methods available to the GPMlink object' /></a><br />
Here we have the available methods on the <em>GPMlink</em> object, in particular we can set the enforcement of the policy. In the example above we can see that the newly linked policy has a link order of 3 showing us that there are 2 other policies linked to the <em>Domain Controllers</em> OU.</p>
<p>There&#8217;s a lot of automated administration that we can apply to Group Policies through the GPMC COM object and PowerShell. For more ideas I&#8217;d recommend checking out the scripts provided with GPMC, and the <a title="MSDN: GPMC object model" href="http://msdn2.microsoft.com/en-us/library/aa814148.aspx">GPMC object model</a></p>
<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode1061');">create-gpolink</a></p>
<div id="quickcode1061" class="quickcode"><code><br />
#&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-<br />
function Create-GPOLink<br />
#&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-<br />
# Depends on Convert-DNtoFQDN function from Code Samples Page<br />
{<br />
Param (<br />
&nbsp;&nbsp;$GPOname,<br />
&nbsp;&nbsp;[int]$GPOlinkPos,<br />
&nbsp;&nbsp;$DSlocation<br />
&nbsp;&nbsp;)<br />
&nbsp;&nbsp;# Make the connection to the domain through GPMC COM<br />
&nbsp;&nbsp;$domain = $gpm.GetDomain( (Convert-DNtoFQDN $root.distinguishedName[0]), $null, $gpm.GetConstants().UseAnyDC )<br />
&nbsp;<br />
&nbsp;&nbsp;# Build a GPMC search object to locate the GPO (in both the backup directory and AD)<br />
&nbsp;&nbsp;$searcher = $gpm.CreateSearchCriteria()<br />
&nbsp;&nbsp;$searcher.Add( $gpm.GetConstants().SearchPropertyGPODisplayName, `<br />
&nbsp;&nbsp;&nbsp;&nbsp;$gpm.GetConstants().SearchOpEquals, $GPOname )<br />
&nbsp;<br />
&nbsp;&nbsp;$GPOlist = $domain.SearchGPOs( $searcher )<br />
&nbsp;&nbsp;# This would be a good place to check that our GPOlist.count is as desired!<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;#Define our Scope Of Management (SoM)<br />
&nbsp;&nbsp;$SOM = $domain.GetSOM( $DSlocation &quot;,&quot;+$root.distinguishedName)<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;# Create the actual link<br />
&nbsp;&nbsp;$GPMlink = $SOM.CreateGPOLink( $GPOlinkPos, $GPOlist.Item(1) )<br />
}<br />
# Sample calling:<br />
Create-GPOlink &quot;New GPO Test&quot; -1 &quot;ou=domain controllers&quot; <br />
</code></div>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/linking-a-gpo-using-gpmc-and-powershell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft TechNet article on GPO management with PowerShell</title>
		<link>http://www.leadfollowmove.com/archives/powershell/microsoft-technet-article-on-gpo-management-with-powershell</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/microsoft-technet-article-on-gpo-management-with-powershell#comments</comments>
		<pubDate>Thu, 10 May 2007 08:49:49 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/microsoft-technet-article-on-gpo-management-with-powershell</guid>
		<description><![CDATA[There&#8217;s a good article on the Microsoft TechNet website on Group Policy using GPMC and PowerShell. There&#8217;s also some nice code examples included! Well worth a look!]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a good <a title="Microsoft TechNet: Simplify Group Policy Administration with Windows PowerShell" href="http://www.microsoft.com/technet/technetmag/issues/2007/05/GroupPolicy/default.aspx">article</a> on the Microsoft TechNet website on Group Policy using GPMC and PowerShell.</p>
<p>There&#8217;s also some nice code examples included! Well worth a look!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/microsoft-technet-article-on-gpo-management-with-powershell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing a GPO using GPMC and PowerShell</title>
		<link>http://www.leadfollowmove.com/archives/powershell/importing-a-gpo-using-gpmc-and-powershell</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/importing-a-gpo-using-gpmc-and-powershell#comments</comments>
		<pubDate>Fri, 04 May 2007 21:07:16 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/importing-a-gpo-using-gpmc-and-powershell</guid>
		<description><![CDATA[Previously we discussed how to create a GPO using the COM object exposed by using GPMC. This time I thought we&#8217;d take a look at the next step of importing a GPO into our newly created policy. The general principle behind this is that you import a policy that has been backed up using GPMC [...]]]></description>
			<content:encoded><![CDATA[<p>Previously we discussed how to <a title="LFM: Creating a GPO with GPMC and PowerShell" href="http://www.leadfollowmove.com/archives/powershell/creating-a-gpo-with-gpmc-and-powershell">create a GPO</a> using the COM object exposed by using GPMC.</p>
<p>This time I thought we&#8217;d take a look at the next step of importing a GPO into our newly created policy.</p>
<p>The general principle behind this is that you import a policy that has been backed up using GPMC previously. If the policy is not from the same domain as the one you&#8217;re importing into, then any domain specific data such as SID&#8217;s will need to be dealt with using a Migration Table. </p>
<p>In our example though, we will simply be importing a GPO that was exported through right-clicking the Group Policy Objects container and stepping through the back up wizard.<br />
<img src='http://www.leadfollowmove.com/wp-content/uploads/gpmc-clickmenu.PNG' alt='Right-click menu from within GPMC' /></p>
<p>Just like when we created a new GPO, we search the AD to see if we can find a GPO matching our <em>displayName</em>. This time a match is what we are looking for. We also use the same<strong> $searcher</strong> object to search the backup directory for a matching policy.<br />
<a href='http://www.leadfollowmove.com/wp-content/uploads/gpoimport-search.PNG' title='GPO Import using GPMC and PowerShell - Searching the Backup Directory and AD'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpoimport-search.thumbnail.PNG' alt='GPO Import using GPMC and PowerShell - Searching the Backup Directory and AD' /></a><br />
Important to note here that we have exactly one match returned in each of the two searches.</p>
<p><a href='http://www.leadfollowmove.com/wp-content/uploads/gpoimport-result.PNG' title='GPO Import using GPMC and PowerShell - Importing the policy and checking the results'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpoimport-result.thumbnail.PNG' alt='GPO Import using GPMC and PowerShell - Importing the policy and checking the results' /></a><br />
Selecting <strong>$GPOlist.Item(1)</strong> gives you an idea how you can reference different policies located in the previous search. The list of methods (<em>gm</em>) available also gives you an idea of the type of things you can do with it. We are interested in the <em>Import()</em> method.</p>
<p>As you can see with the <strong>$Result</strong> object, we can verify that the policy was successful. And checking with GPMC:<br />
<a href='http://www.leadfollowmove.com/wp-content/uploads/gpo-newtest.PNG' title='GPO Import using GPMC and PowerShell - The contents of New GPO Test in GPMC'><img src='http://www.leadfollowmove.com/wp-content/uploads/gpo-newtest.thumbnail.PNG' alt='GPO Import using GPMC and PowerShell - The contents of New GPO Test in GPMC' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/importing-a-gpo-using-gpmc-and-powershell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a GPO with GPMC and PowerShell</title>
		<link>http://www.leadfollowmove.com/archives/powershell/creating-a-gpo-with-gpmc-and-powershell</link>
		<comments>http://www.leadfollowmove.com/archives/powershell/creating-a-gpo-with-gpmc-and-powershell#comments</comments>
		<pubDate>Thu, 19 Apr 2007 10:14:33 +0000</pubDate>
		<dc:creator>Adam Bell</dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.leadfollowmove.com/archives/powershell/creating-a-gpo-with-gpmc-and-powershell</guid>
		<description><![CDATA[If you have GPMC installed then you have the ability to manage your Group Policy objects via the COM object that the software exposes. Microsoft provide a good set of example scripts located in the Scripts folder in the GPMC install directory. There is also a pretty decent help file (CHM format). Both the help [...]]]></description>
			<content:encoded><![CDATA[<p>If you have <a title="Microsoft: Enterprise Management with the Group Policy Management Console" href="http://www.microsoft.com/windowsserver2003/gpmc/default.mspx">GPMC</a> installed then you have the ability to manage your Group Policy objects via the COM object that the software exposes.</p>
<p>Microsoft provide a good set of example scripts located in the <strong>Scripts</strong> folder in the GPMC install directory. There is also a pretty decent help file (CHM format). Both the help and samples are well worth a look.</p>
<p>Through the COM object we can perform any of the management tasks in PowerShell that can be done in VBScript or JScript etc.</p>
<p><a href='http://www.leadfollowmove.com/wp-content/uploads/create-gpo-1.PNG' title='Create a GPO with PowerShell - Screen shot 1'><img src='http://www.leadfollowmove.com/wp-content/uploads/create-gpo-1.thumbnail.PNG' alt='Create a GPO with PowerShell - Screen shot 1' /></a><br />
We instantiate the object, and after binding to the Directory, search for any GPO&#8217;s that match our displayName of &#8220;New GPO Test&#8221;. Receiving a count of 0 shows us that no conflict will occur. You can actually have two GPO&#8217;s with the same displayName, but this would just add a level of confusion in your environment that you just don&#8217;t need!</p>
<p>You might notice that I have a function dot sourced in my profile here: <em>ConvertDNtoFQDN</em>. This allows me to dynamically lookup data and change the format as needed.</p>
<p><img src='http://www.leadfollowmove.com/wp-content/uploads/create-gpo-2.PNG' alt='Create a GPO with PowerShell - Screen shot 2' /><br />
GPMC shows what a new GPO looks like.At this stage it is just an empty GPO, with no attributes set.</p>
<p><a href='http://www.leadfollowmove.com/wp-content/uploads/create-gpo-3.PNG' title='Create a GPO with PowerShell - Screen shot 3'><img src='http://www.leadfollowmove.com/wp-content/uploads/create-gpo-3.thumbnail.PNG' alt='Create a GPO with PowerShell - Screen shot 3' /></a><br />
The commands to create the object. We can also see the methods and property&#8217;s available to the GPO object. And then finally we set the displayName.</p>
<p><img src='http://www.leadfollowmove.com/wp-content/uploads/create-gpo-4.PNG' alt='Create a GPO with PowerShell - Screen shot 4' /><br />
GPMC shows our updated object with the displayName configured.</p>
<p>For the GPO to become useful, at a minimum, we would need to actually import settings and link it to the directory. </p>
<p>I am not aware of any programmatic method of actually configuring settings at the moment. What I have personally seen is people exporting backup of the GPO&#8217;s from a reference system, and then importing them into the target environment using a <a title="Microsoft: Migration tables" href="http://technet2.microsoft.com/WindowsServer/en/library/b98e4746-da0d-4da5-9fa8-1b2d69c9cad81033.mspx?mfr=true">Migration Table</a> to handle any domain specific references.</p>
<p>Below is a sample function to create a new GPO.<br />
<a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode771');">Create-NewGPO.ps1</a></p>
<div id="quickcode771" class="quickcode"><code><br />
# Globals and Constants<br />
$gpm&nbsp;&nbsp;= New-Object -com gpmgmt.gpm<br />
&nbsp;<br />
#&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-<br />
function Create-NewGPO<br />
#&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-<br />
{<br />
Param (<br />
&nbsp;&nbsp;$GPOname,<br />
&nbsp;&nbsp;$FQDName<br />
&nbsp;&nbsp;)<br />
&nbsp;&nbsp;$domain = $gpm.GetDomain( $FQDName), $null, $gpm.GetConstants().UseAnyDC )<br />
&nbsp;&nbsp;$searcher = $gpm.CreateSearchCriteria()<br />
&nbsp;&nbsp;$searcher.Add( $gpm.GetConstants().SearchPropertyGPODisplayName, `<br />
&nbsp;&nbsp;&nbsp;&nbsp;$gpm.GetConstants().SearchOpEquals, $GPOname )<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;$GPOlist = $domain.SearchGPOs( $Searcher )<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;If ($GPOlist.count -eq 0)<br />
&nbsp;&nbsp;{&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$GPO = $domain.CreateGPO()<br />
&nbsp;&nbsp;&nbsp;&nbsp;$GPO.DisplayName = $GPOname<br />
&nbsp;&nbsp;}<br />
}<br />
#&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;-&#45;&#45;&#45;-<br />
Create-NewGPO &quot;New Test GPO&quot; &quot;dc=rig1, dc=testlab,dc=tld&quot;<br />
&nbsp;<br />
</code></div>
]]></content:encoded>
			<wfw:commentRss>http://www.leadfollowmove.com/archives/powershell/creating-a-gpo-with-gpmc-and-powershell/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

