<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>ldap389</title>
	
	<link>http://www.ldap389.info/en/</link>
	<description>Active Directory Blog</description>
	<lastBuildDate>Thu, 19 Apr 2012 20:56:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Ldap389" /><feedburner:info uri="ldap389" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Powershell: Enable ActiveSync for users member of an AD group</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/QlMM8wnDXSk/</link>
		<comments>http://www.ldap389.info/en/2012/04/19/powershell-enable-disable-activesync-ad-group-rbac-exchange-scheduled-task/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 20:56:38 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[tools @en]]></category>
		<category><![CDATA[ActiveSync @en]]></category>
		<category><![CDATA[Exchange @en]]></category>
		<category><![CDATA[PowerShell @en]]></category>
		<category><![CDATA[rbac @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1768</guid>
		<description><![CDATA[We will describe in this post how to enable the mobile access to your mail system for only some employees. Only users who belong to the LDAP389-ACTIVESYNC will be able to use the ActiveSync protocol and set up their mailbox on their smartphone. This authorization will be managed by a Powershell script launched by a [...]]]></description>
			<content:encoded><![CDATA[<p>We will describe in this post how to enable the mobile access to your mail system for only some employees. Only users who belong to the <em>LDAP389-ACTIVESYNC</em> will be able to use the <a href="http://www.microsoft.com/about/legal/en/us/IntellectualProperty/IPLicensing/Programs/ExchangeActiveSyncProtocol.aspx">ActiveSync</a> protocol and set up their mailbox on their smartphone. This authorization will be managed by a Powershell script launched by a scheduled task.<br />
<span id="more-1768"></span></p>
<p>The <em>LDAP389-ACTIVESYNC</em> group has two members: One group containing the users located in Paris, the second with the users located in London. Members of each group (<em>PAR-ALLOWACTIVESYNC</em> and <em>LON-ALLOWACTIVESYNC</em>) are managed by each local IT team:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/04/activesync-groups.jpg" rel="lightbox[1768]"><img class="aligncenter size-medium wp-image-1746" title="activesync-groups" src="http://www.ldap389.info/wp-content/uploads/2012/04/activesync-groups-300x82.jpg" alt="" width="300" height="82" /></a></p>
<p>In order to retrieve the users allowed to use the ActiveSync protocol we will get recursively the members of the <em>LDAP389-ACTIVESYNC</em> group:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$groupDN</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;CN=LDAP389-ACTIVESYNC,OU=Groups,OU=HQ,DC=ldap389,DC=local&quot;</span>
<span style="color: #800080;">$members</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>ADGroupMember <span style="color: pink;">-</span>Identity <span style="color: #800080;">$groupDN</span> <span style="color: pink;">-</span>Recursive <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>ADUser <span style="color: pink;">-</span>Properties mail</pre></div></div>

<p>We will also retrieve the mailboxes which are allowed to use the ActiveSync protocol:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$allcas</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>mailbox <span style="color: pink;">-</span>ResultSize:unlimited <span style="color: pink;">|</span> Get<span style="color: pink;">-</span>CASMailbox
<span style="color: #800080;">$users</span><span style="color: pink;">=</span> <span style="color: #800080;">$allcas</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-object</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.ActiveSyncEnabled <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$true</span><span style="color: #000000;">&#125;</span></pre></div></div>

<p>Firstly the script will browse the mailbox accounts which are allowed to use the ActiveSync protocol (<em>$users</em>), if one of these accounts is not a member of the <em>LDAP389-ACTIVESYNC</em> group then ActiveSync is disabled with the <em><a href="http://technet.microsoft.com/en-us/library/bb125264.aspx">Set-CASMailbox</a></em> cmdlet (<em>ActiveSyncEnabled</em> parameter).</p>
<p>Secondly the script will browse the members of the <em>LDAP389-ACTIVESYNC</em> group (<em>$members</em>), if for one of these accounts ActiveSync is disabled, the script enables it, with the <em>Set-CASMailbox</em> cmdlet as well.</p>
<p>To download the full script, just click on the link below:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/04/ManageActivesyncusers.txt"><img class="aligncenter size-full wp-image-83" title="tool" src="http://www.ldap389.info/wp-content/uploads/2010/03/tool1.png" alt="" width="48" height="48" /></a></p>
<p>Now we need to set up the scheduled task which will run with a service account, this user should have the following rights:</p>
<ul>
<li>Read the Active Directory objects.</li>
<li>Local administrator of the machine the task is running on.</li>
<li>Create a <a href="http://sysadmin-talk.org/2010/04/5-steps-to-heaven-creating-a-custom-rbac-role-in-exchange-2010/">custom RBAC</a> role, in order to grant only the necessary Exchange rights to achieve the task.</li>
</ul>
<p>In order to create the <em>&#8220;Disable ActiveSync&#8221;</em> role, we create a new management role using the default <em>&#8220;Mail Recipients&#8221;</em> role as a parent.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">New<span style="color: pink;">-</span>ManagementRole <span style="color: #008080; font-style: italic;">-Parent</span> <span style="color: #800000;">&quot;Mail Recipients&quot;</span> <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Disable ActiveSync&quot;</span></pre></div></div>

<p>The script uses only the three following cmdlets: <em>Get-Mailbox, Get-CASMailbox, Set-CASMailbox</em>. So we will remove all the cmdlets from the role except those three:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>ManagementRoleEntry <span style="color: #800000;">&quot;Disable ActiveSync\*&quot;</span> <span style="color: pink;">|</span> <span style="color: #0000FF;">Where</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #000080;">$_</span>.Name <span style="color: #FF0000;">-ne</span> <span style="color: #800000;">&quot;Get-Mailbox&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-and</span> <span style="color: #000000;">&#40;</span><span style="color: #000080;">$_</span>.Name <span style="color: #FF0000;">-ne</span> <span style="color: #800000;">&quot;Set-CASMailbox&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-and</span> <span style="color: #000000;">&#40;</span><span style="color: #000080;">$_</span>.Name <span style="color: #FF0000;">-ne</span> <span style="color: #800000;">&quot;Get-CASMailbox&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> Remove<span style="color: pink;">-</span>ManagementRoleEntry</pre></div></div>

<p>We will also remove some of the allowed parameters from the Set-CASMailbox cmdlet for the <em>&#8220;Disable ActiveSync&#8221;</em> role, except the parameters used by our script:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Set<span style="color: pink;">-</span>ManagementRoleEntry <span style="color: #800000;">&quot;Disable ActiveSync\Set-CASMailbox&quot;</span> <span style="color: pink;">-</span>Parameters Identity<span style="color: pink;">,</span>ActiveSyncEnabled<span style="color: pink;">,</span>whatif<span style="color: pink;">,</span>confirm</pre></div></div>

<p>Finally we create the management role AD group called <em>&#8220;EnableMobileAccess&#8221;</em> corresponding to the <em>&#8220;Disable ActiveSync&#8221;</em> role.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">New<span style="color: pink;">-</span>RoleGroup <span style="color: #008080; font-style: italic;">-Name</span> EnableMobileAccess
New<span style="color: pink;">-</span>ManagementRoleAssignment <span style="color: #008080; font-style: italic;">-Name</span> ManageMobileAccess <span style="color: #008080; font-style: italic;">-Role</span> <span style="color: #800000;">&quot;Disable ActiveSync&quot;</span> <span style="color: pink;">-</span>SecurityGroup EnableMobileAccess</pre></div></div>

<p>Just add the service account to the newly created group and set up your <a href="http://www.mikepfeiffer.net/2010/02/creating-scheduled-tasks-for-exchange-2010-powershell-scripts/">Exchange scheduled task</a> with this account. The connection to the Exchange remote shell is already included in the script. The scheduled task will run with a service account that will just have the necessary rights, no more.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Powershell%3A+Enable+ActiveSync+for+users+member+of+an+AD+group+http%3A%2F%2Fis.gd%2FpbxDZ2" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/QlMM8wnDXSk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2012/04/19/powershell-enable-disable-activesync-ad-group-rbac-exchange-scheduled-task/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2012/04/19/powershell-enable-disable-activesync-ad-group-rbac-exchange-scheduled-task/</feedburner:origLink></item>
		<item>
		<title>Powershell: VMWare and physical Windows server inventory</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/tEyxZiqI40g/</link>
		<comments>http://www.ldap389.info/en/2012/03/22/powershell-vmware-and-physical-windows-server-inventory-license-wmi-cpu-core-count/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 10:16:37 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[tools @en]]></category>
		<category><![CDATA[cpu @en]]></category>
		<category><![CDATA[PowerShell @en]]></category>
		<category><![CDATA[wmi @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1731</guid>
		<description><![CDATA[We will describe in this post how to make an inventory of your physical and VMWare virtual machines running Windows Server. For each virtual machine, we will also retrieve on which physical host the server is running. If you have a VMWare virtualized environment this script can be useful to help you decide which type [...]]]></description>
			<content:encoded><![CDATA[<p>We will describe in this post how to make an inventory of your physical and VMWare virtual machines running Windows Server. For each virtual machine, we will also retrieve on which physical host the server is running. If you have a VMWare virtualized environment this script can be useful to help you decide which type of Windows server edition you need to purchase in order to lower your costs. For more information on how to license MS Windows Server in a VMWare environment you can read this <a href="http://www.vmguru.nl/wordpress/2010/04/how-to-license-microsoft-windows-server-in-a-vmware-environment-%E2%80%93-part-1/">article</a>.<br />
<span id="more-1731"></span></p>
<p>For each machine (Physical server, Virtual Machine, ESX host) we retrieve:</p>
<ul>
<li>The machine name.</li>
<li>The machine physical model, if this is a Virtual Machine &#8220;VM&#8221; is returned.</li>
<li>The total number of CPUs of the machine.</li>
<li>The total number of Cores of the machine.</li>
<li>Total RAM of the machine.</li>
<li>OS of the machine. For the Windows Server machines, we also return the Edition (Enterprise, Standard, Datacenter). For the ESX hosts, &#8220;ESX&#8221; is returned.</li>
</ul>
<p>For each ESX host we return the Virtual Machines running on it. The Virtual Machines positions are a snapshot picture at the time the script is running. Your Virtual Machines might move later to another ESX host because of the <a href="http://www.vmware.com/products/drs/overview.html">DRS</a> mechanism. Below is an example of result file retrieved with the script:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/03/vm-inventory.jpg" rel="lightbox[1731]"><img class="aligncenter size-medium wp-image-1712" title="vm-inventory" src="http://www.ldap389.info/wp-content/uploads/2012/03/vm-inventory-300x85.jpg" alt="" width="300" height="85" /></a></p>
<p>In order to achieve this inventory we will use PowerCli, WMI and the AD Cmdlets. Firstly we will retrieve all the servers which have been active during the last 90 days:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$d</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>DateTime<span style="color: #000000;">&#93;</span>::Today.AddDays<span style="color: #000000;">&#40;</span><span style="color: pink;">-</span><span style="color: #804000;">90</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$servers</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>ADComputer <span style="color: pink;">-</span>searchbase <span style="color: #800000;">&quot;DC=ldap389,DC=info&quot;</span> <span style="color: pink;">-</span>Properties OperatingSystem<span style="color: pink;">,</span> OperatingSystemServicePack <span style="color: pink;">-</span><span style="color: #0000FF;">Filter</span> <span style="color: #800000;">'PasswordLastSet -ge $d'</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Where-Object</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.OperatingSystem <span style="color: #FF0000;">-like</span> ‘<span style="color: pink;">*</span>server<span style="color: pink;">*</span>’<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then we retrieve the Windows OS edition of each computer account. For Windows 2008 servers, that information is stored in the <em>OperatingSystem</em> account attribute. For other versions, the edition is retrieved by querying the server with the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394239(v=vs.85).aspx">Win32_OperatingSystem</a> WMI class. In order to compute the total number of CPUs and Cores of each Windows server we will use the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394373(v=vs.85).aspx">Win32_Processor</a> WMI class. Under Windows 2003, the computing method os different depending on wether or not you patched your OS with <a href="http://support.microsoft.com/kb/932370/en-us">KB932370</a>.</p>
<p>For Windows 2008 and patched Windows 2003 Operating systems:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$Win32_cpu</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-WmiObject</span> <span style="color: #008080; font-style: italic;">-class</span> win32_processor <span style="color: pink;">-</span>computer <span style="color: #800080;">$ServerName</span>
<span style="color: #800080;">$NbCPUs</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Win32_cpu</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">measure-object</span><span style="color: #000000;">&#41;</span>.count
<span style="color: #800080;">$Nbcores</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Win32_cpu</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">measure-object</span> NumberOfCores <span style="color: #008080; font-style: italic;">-sum</span><span style="color: #000000;">&#41;</span>.sum</pre></div></div>

<p>For non patched Windows 2003 OS (read this <a href="http://www.sql-server-pro.com/physical-cpu-count.html">post</a> for more details):</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$physCount</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> hashtable
<span style="color: #800080;">$Win32_cpu</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-WmiObject</span> <span style="color: #008080; font-style: italic;">-class</span> win32_processor <span style="color: pink;">-</span>computer <span style="color: #800080;">$ServerName</span>
<span style="color: #800080;">$Win32_cpu</span> <span style="color: pink;">|%</span><span style="color: #000000;">&#123;</span><span style="color: #800080;">$physCount</span><span style="color: #000000;">&#91;</span><span style="color: #000080;">$_</span>.SocketDesignation<span style="color: #000000;">&#93;</span> <span style="color: pink;">=</span> <span style="color: #804000;">1</span><span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$NbCPUs</span> <span style="color: pink;">=</span> <span style="color: #800080;">$physCount</span>.count
<span style="color: #800080;">$Nbcores</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Win32_cpu</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">measure-object</span><span style="color: #000000;">&#41;</span>.count</pre></div></div>

<p>If the <em>Manufacturer</em> value returned by the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394102(v=vs.85).aspx">Win32_ComputerSystem</a> WMI class is equal to <em>VMware, Inc.</em> the server is a VMWare virtual machine: In that case we retrieve the ESX host on which the VM is running. The virtual machines are sorted by ESX host: Thanks to a hashtable with the ESX hosts names containing hashtables with the Virtual machines of each ESX host. Read this <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/12/10/create-a-hash-table-in-powershell-that-contains-hash-tables.aspx">article</a> on how to manipulate a hashtable that contains hashtables. The common value between the AD computer object and the Virtual Machine PowerCli object is the <em>DNSHostname</em> AD attribute and the <em>Hostname</em> value stored in the <em>Guest</em> object of the VM (thanks <a href="www.hypervisor.fr/">NiTRo</a> for that tip). That way the script will run even if your Virtual Machine names are not equal to your server hostnames.</p>
<p>If the server is a physical machine, we write the result directly in the output file.</p>
<p>Once we have retrieved all the ESX hosts names and VMs information, we retrieve physical information (Model, total CPUs, total cores, RAM) for each ESX host by using PowerCli, as described in this <a href="http://saliano.net/2012/01/20/vsphere-host-information-via-powercli/">post</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$hard</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span>get<span style="color: pink;">-</span>vmhost <span style="color: #800080;">$esx</span><span style="color: #000000;">&#41;</span>.Extensiondata.Summary.Hardware
<span style="color: #800080;">$mem</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span><span style="color: #008080;">int</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$hard</span>.MemorySize<span style="color: pink;">/</span>1mb<span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$NbCPUs</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hard</span>.NumCpuPkgs
<span style="color: #800080;">$Nbcores</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hard</span>.NumCpuCores
<span style="color: #800080;">$model</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hard</span>.Model</pre></div></div>

<p>To download the full script just click on the link below:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/03/inventaire-OS-VM-PSH.txt"><img class="aligncenter size-fullwp-image-83" title="tool" src="http://www.ldap389.info/wp-content/uploads/2010/03/tool1.png" alt="" width="48" height="48" /></a></p>
<p>Launch the script in a PowerCli session and do not forget to import the AD module (<em>import-module ActiveDirectory</em>): There we go, we used WMI, PowerCli and the AD Cmdlets in a single script <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Powershell%3A+VMWare+and+physical+Windows+server+inventory+http%3A%2F%2Fis.gd%2FTy3oNO" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/tEyxZiqI40g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2012/03/22/powershell-vmware-and-physical-windows-server-inventory-license-wmi-cpu-core-count/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2012/03/22/powershell-vmware-and-physical-windows-server-inventory-license-wmi-cpu-core-count/</feedburner:origLink></item>
		<item>
		<title>Windows 8: Install and configure ADCS</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/hVwb2bL6ld0/</link>
		<comments>http://www.ldap389.info/en/2012/01/26/windows-8-install-configure-adcs-pki-powershell/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 11:36:10 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[Public Key Infrastructure @en]]></category>
		<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[pki @en]]></category>
		<category><![CDATA[PowerShell @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1703</guid>
		<description><![CDATA[We will describe in this post how to install ADCS on Windows 8 Developer Preview, and how to configure your PKI with Powershell. Firstly we will install the ADCS role with Server Manager: Select &#8220;Role-based installation or Feature-based installation&#8221; and click next. We now need to select the server on which you will install the [...]]]></description>
			<content:encoded><![CDATA[<p>We will describe in this post how to install ADCS on <em>Windows 8 Developer Preview</em>, and how to configure your PKI with Powershell.</p>
<p>Firstly we will install the ADCS role with <em>Server Manager</em>:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca1.jpg" rel="lightbox[1703]"><img class="aligncenter size-medium wp-image-1681" title="install-ca1" src="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca1-300x155.jpg" alt="" width="300" height="155" /></a><br />
<span id="more-1703"></span><br />
Select &#8220;<em>Role-based installation or Feature-based installation</em>&#8221; and click next. We now need to select the server on which you will install the role, under Windows 8 you can manage a <a href="http://www.windowsitpro.com/article/windowsserver8/server-management-windows-server-8-140938">remote server</a> <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca3.jpg" rel="lightbox[1703]"><img class="aligncenter size-medium wp-image-1682" title="install-ca3" src="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca3-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>Choose the <em>Active Directory Certificate Services</em> role:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca4.jpg" rel="lightbox[1703]"><img class="aligncenter size-medium wp-image-1683" title="install-ca4" src="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca4-300x130.jpg" alt="" width="300" height="130" /></a></p>
<p>Skip the <em>Features</em> screen, then under the <em>role services</em> screen, select only <em>Certification Authority</em>:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca5.jpg" rel="lightbox[1703]"><img class="aligncenter size-medium wp-image-1684" title="install-ca5" src="http://www.ldap389.info/wp-content/uploads/2012/01/install-ca5-300x139.jpg" alt="" width="300" height="139" /></a></p>
<p>On the next screen we start the role installation. Once it is done, open a Powershell session on the server on which the role is installed and launch the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>Module –ListAvailable</pre></div></div>

<p>We notice that a new module called <em>CertificateServicesCmdlets</em> shows up. We can list the cmdlets available in that module with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>get<span style="color: pink;">-</span>module CertificateServicesCmdlets<span style="color: #000000;">&#41;</span>.exportedcommands</pre></div></div>

<p>Here are the cmdlets:</p>
<blockquote><p>Get-AdcsCertificationAuthorityConfigurationDefaults<br />
Get-AdcsConfigurationState<br />
Get-AdcsEnrollmentPolicyWebServiceConfigurationDefaults<br />
Get-AdcsEnrollmentWebServiceConfigurationDefaults<br />
Get-AdcsNetworkDeviceEnrollmentConfigurationDefaults<br />
Get-SSLCertificates<br />
Import-AdcsCertificationAuthorityCACertificatePfx<br />
Install-AdcsCertificationAuthority<br />
Install-AdcsEnrollmentPolicyWebService<br />
Install-AdcsEnrollmentWebService<br />
Install-AdcsNetworkDeviceEnrollmentService<br />
Install-AdcsOnlineResponder<br />
Install-AdcsWebEnrollment<br />
Uninstall-AdcsCertificationAuthority<br />
Uninstall-AdcsEnrollmentPolicyWebService<br />
Uninstall-AdcsEnrollmentWebService<br />
Uninstall-AdcsNetworkDeviceEnrollmentService<br />
Uninstall-AdcsOnlineResponder<br />
Uninstall-AdcsWebEnrollment</p></blockquote>
<p>We will use the <em>Install-AdcsCertificationAuthority</em> in order to configure our Enterprise rootCA server. The script <a href="http://blogs.technet.com/b/pki/archive/2009/09/18/automated-ca-installs-using-vb-script-on-windows-server-2008-and-2008r2.aspx">setupCA.vbs</a> inspired us to launch the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Install<span style="color: pink;">-</span>AdcsCertificationAuthority <span style="color: pink;">-</span>CAType EnterpriseRootCA <span style="color: pink;">-</span>CACommonName LDAP389<span style="color: pink;">-</span>CA <span style="color: pink;">-</span>KeyLength <span style="color: #804000;">4096</span> <span style="color: pink;">-</span>HashAlgorithmName SHA256 <span style="color: pink;">-</span>CryptoProviderName <span style="color: #800000;">&quot;RSA#Microsoft Software Key Storage Provider&quot;</span></pre></div></div>

<p>Here we go, the Enterprise rootCA server is ready to use. We launch the <em>Certification Authority</em> console in order to check that the configuration matches the parameters we set up with Powershell:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/ca-certificate.jpg" rel="lightbox[1703]"><img class="aligncenter size-medium wp-image-1686" title="ca-certificate" src="http://www.ldap389.info/wp-content/uploads/2012/01/ca-certificate-300x212.jpg" alt="" width="300" height="212" /></a></p>
<p>Under Windows 8 you can configure your PKI with Powershell, but maybe not yet get rid of the excellent <a href="http://en-us.sysadmins.lv/Lists/Posts/Post.aspx?ID=58">PS PKI module</a> developed by the Powershell Crypto Guy, time will tell&#8230;</p>
<p><strong>N.B.:</strong> As it is a <em>Developer Preview</em> the cmdlets and installation procedure might change in the future.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Windows+8%3A+Install+and+configure+ADCS+http%3A%2F%2Fis.gd%2Fn9ZIdm" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/hVwb2bL6ld0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2012/01/26/windows-8-install-configure-adcs-pki-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2012/01/26/windows-8-install-configure-adcs-pki-powershell/</feedburner:origLink></item>
		<item>
		<title>Windows 8: Manage Active Directory replication topology with powershell</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/aEovNG3CTns/</link>
		<comments>http://www.ldap389.info/en/2012/01/11/windows-8-manage-active-directory-replication-topology-with-powershell/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 10:54:58 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[PowerShell @en]]></category>
		<category><![CDATA[repadmin @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1668</guid>
		<description><![CDATA[I finally managed to free some time to install my first Windows 8 Developer Preview domain controllers in a test lab (thanks Vmdude). In this ldap389.local domain I installed two RWDCs named ldap389-pdce and ldap389-dc2, each one located in their own AD site. For the DC&#8217;s promotion you can read this two part post (here [...]]]></description>
			<content:encoded><![CDATA[<p>I finally managed to free some time to install my first <em>Windows 8 Developer Preview </em>domain controllers in a test lab (thanks <a href="http://www.vmdude.fr/">Vmdude</a>). In this <em>ldap389.local</em> domain I installed two RWDCs named <em>ldap389-pdce</em> and <em>ldap389-dc2</em>, each one located in their own AD site. For the DC&#8217;s promotion you can read this two part post (<a href="http://jorgequestforknowledge.wordpress.com/2011/11/04/installing-and-uninstalling-ad-on-windows-server-8-as-an-rwdc-and-as-an-rodc-part-1/">here</a> and <a href="http://jorgequestforknowledge.wordpress.com/2011/11/04/installing-and-uninstalling-ad-on-windows-server-8-as-an-rwdc-and-as-an-rodc-part-2/">here</a>)</p>
<p>Once installation was completed, I launched the following Powershell command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span>get<span style="color: pink;">-</span>module ActiveDirectory<span style="color: #000000;">&#41;</span>.exportedcommands</pre></div></div>

<p><span id="more-1668"></span></p>
<p>In order to list all the Cmdlets available for the Active Directory module. We notice, among others, new Cmdlets for managing Active Directory replication topology:</p>
<blockquote><p>Get-ADReplicationAttributeMetadata</p>
<p>Get-ADReplicationConnection</p>
<p>Get-ADReplicationFailure</p>
<p>Get-ADReplicationPartnerMetadata</p>
<p>Get-ADReplicationQueueOperation</p>
<p>Get-ADReplicationSite</p>
<p>Get-ADReplicationSiteLink</p>
<p>Get-ADReplicationSiteLinkBridge</p>
<p>Get-ADReplicationSubnet</p>
<p>Get-ADReplicationUpToDatenessVectorTable</p>
<p>New-ADReplicationSite</p>
<p>New-ADReplicationSiteLink</p>
<p>New-ADReplicationSiteLinkBridge</p>
<p>New-ADReplicationSubnet</p>
<p>Remove-ADReplicationSite</p>
<p>Remove-ADReplicationSiteLink</p>
<p>Remove-ADReplicationSiteLinkBridge</p>
<p>Remove-ADReplicationSubnet</p>
<p>Set-ADReplicationConnection</p>
<p>Set-ADReplicationSite</p>
<p>Set-ADReplicationSiteLink</p>
<p>Set-ADReplicationSiteLinkBridge</p>
<p>Set-ADReplicationSubnet</p></blockquote>
<p>The <em>ldap389.local</em> domain replication topology is as follows:</p>
<p><img class="aligncenter size-medium wp-image-1649" title="toplogy-windows8" src="http://www.ldap389.info/wp-content/uploads/2012/01/toplogy-windows8-300x195.jpg" alt="" width="300" height="195" /></p>
<p>Firstly we will list the Active Directory sites with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>ADReplicationSite <span style="color: pink;">-</span><span style="color: #0000FF;">filter</span> <span style="color: #000000;">&#123;</span>cn <span style="color: #FF0000;">-like</span> <span style="color: #800000;">&quot;*&quot;</span><span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/get-adreplicationsite2.jpg" rel="lightbox[1668]"><img class="aligncenter size-medium wp-image-1650" title="get-adreplicationsite" src="http://www.ldap389.info/wp-content/uploads/2012/01/get-adreplicationsite2-300x189.jpg" alt="" width="300" height="189" /></a><br />
There are two sites in the domain: <em>HQ-LDAP389</em> and <em>BRANCH-LDAP389</em>. We also retrieve the <a href="http://support.microsoft.com/kb/224815">ISTG</a> of each site.</p>
<p>Secondly we list the Active Directory site links using the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>ADReplicationSiteLink <span style="color: pink;">-</span><span style="color: #0000FF;">filter</span> <span style="color: #000000;">&#123;</span>cn <span style="color: #FF0000;">-like</span> <span style="color: #800000;">&quot;*&quot;</span><span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/get-adreplicationsitelink1.jpg" rel="lightbox[1668]"><img class="aligncenter size-medium wp-image-1651" title="get-adreplicationsitelink" src="http://www.ldap389.info/wp-content/uploads/2012/01/get-adreplicationsitelink1-300x91.jpg" alt="" width="300" height="91" /></a><br />
The only site link is the default one: <em>DEFAULTIPSITELINK</em>. It is configured to launch a replication every 15 minutes between both sites.</p>
<p>Finally we will list every Active Directory replication connection with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>ADReplicationConnection <span style="color: pink;">-</span><span style="color: #0000FF;">filter</span> <span style="color: #000000;">&#123;</span>cn <span style="color: #FF0000;">-like</span> <span style="color: #800000;">&quot;*&quot;</span><span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://www.ldap389.info/wp-content/uploads/2012/01/get-adreplicationconnection.jpg" rel="lightbox[1668]"><img class="aligncenter size-medium wp-image-1652" title="get-adreplicationconnection" src="http://www.ldap389.info/wp-content/uploads/2012/01/get-adreplicationconnection-300x289.jpg" alt="" width="300" height="289" /></a></p>
<p>There are two connections: The first one to replicate from <em>ldap389-pdce</em> to <em>ldap389-dc2</em>, the second one to replicate in the opposite direction.<br />
I want to reassure you: The <em><a href="http://technet.microsoft.com/en-us/library/cc755360(WS.10).aspx">repadmin</a></em> command is not deprecated under <em>Windows 8 Developer Preview</em>, unlike the <em><a href="http://www.jackcobben.nl/?p=1659">dcpromo</a></em> which is replaced by the <em>ADDSDeployment</em> Powershell module.</p>
<p><strong>N.B.:</strong> As it is a <em>Developer Preview</em> those cmdlets might change in the future. But this post shows you that you will be able to manage ADDS replication with Powershell <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Windows+8%3A+Manage+Active+Directory+replication+topology+with+powershell+http%3A%2F%2Fis.gd%2FUtVkuY" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/aEovNG3CTns" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2012/01/11/windows-8-manage-active-directory-replication-topology-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2012/01/11/windows-8-manage-active-directory-replication-topology-with-powershell/</feedburner:origLink></item>
		<item>
		<title>Powershell: Export firewall rules on your TMG servers</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/JakzKruYF7U/</link>
		<comments>http://www.ldap389.info/en/2012/01/04/powershell-export-firewall-rules-on-your-tmg-servers/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 16:44:10 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[PowerShell @en]]></category>
		<category><![CDATA[tmg @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1626</guid>
		<description><![CDATA[In order to manage TMG with powershell you need to use the FPC.root COM object. For more details you can read this article. The purpose of this script is to export for each TMG server the Firewall Policies in XML format: In order to perform a connection on each TMG server we invoke the ConnectToConfigurationStorageServer [...]]]></description>
			<content:encoded><![CDATA[<p>In order to manage TMG with powershell you need to use the <a href="http://msdn.microsoft.com/en-us/library/ms826706.aspx">FPC.root</a> COM object. For more details you can read <a href="http://www.isaserver.org/tutorials/Forefront-TMG-Scripting-with-VBScript-Powershell.html">this article</a>. The purpose of this script is to export for each TMG server the <em>Firewall Policies</em> in XML format: </p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/12/firewallpolicies1.jpg" rel="lightbox[1626]"><img class="aligncenter size-medium wp-image-1606" title="firewallpolicies" src="http://www.ldap389.info/wp-content/uploads/2011/12/firewallpolicies1-300x169.jpg" alt="" width="300" height="169" /></a><br />
<span id="more-1626"></span></p>
<p>In order to perform a connection on each TMG server we invoke the <em><a href="http://msdn.microsoft.com/en-us/library/ms826310.aspx">ConnectToConfigurationStorageServer</a></em> method. Then we use the <em><a href="http://msdn.microsoft.com/en-us/library/aa491800.aspx">FPCPolicyRules</a></em> collection in order to browse the different firewall rules. For each TMG server is displayed:</p>
<ul>
<li>The rule name.</li>
<li>Wether the rule is enabled.</li>
<li>Action: Allow traffic (0), deny traffic (1).</li>
</ul>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/12/scriptresult.jpg" rel="lightbox[1626]"><img class="aligncenter size-medium wp-image-1607" title="scriptresult" src="http://www.ldap389.info/wp-content/uploads/2011/12/scriptresult-300x93.jpg" alt="" width="300" height="93" /></a><br />
Each firewall rule is exported in the current directory in a file named %TMGSERRVERNAME%_%RULENAME%.xml. In order to export the configuration in XML format we invoke the <em><a href="http://msdn.microsoft.com/en-us/library/ms826700.aspx">FPC.ExportToFile</a></em> method:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$oFPC</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-comObject</span> FPC.root
<span style="color: #800080;">$cArrays</span> <span style="color: pink;">=</span> <span style="color: #800080;">$oFPC</span>.Arrays
<span style="color: #0000FF;">Foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$oArray</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$cArrays</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$policyrules</span> <span style="color: pink;">=</span> <span style="color: #800080;">$oArray</span>.ArrayPolicy.policyrules
    <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$policyrule</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$policyrules</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        <span style="color: #800080;">$policyrule</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> name<span style="color: pink;">,</span>enabled<span style="color: pink;">,</span>action
        <span style="color: #800080;">$szOutFilePath</span> <span style="color: pink;">=</span> <span style="color: #800000;">'C:\'</span> <span style="color: pink;">+</span> <span style="color: #800080;">$policyrule</span>.name <span style="color: pink;">+</span> <span style="color: #800000;">'.xml'</span>
        <span style="color: #008000;">#See options for $iOptionalData at http://msdn.microsoft.com/en-us/library/aa490382.aspx</span>
        <span style="color: #800080;">$iOptionalData</span> <span style="color: pink;">=</span>  0x00000001 <span style="color: #FF0000;">-bor</span> 0x00000002 <span style="color: #FF0000;">-bor</span> 0x00000004 <span style="color: #FF0000;">-bor</span> 0x00000008
        <span style="color: #800080;">$szPassword</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;12345678&quot;</span>
        <span style="color: #800080;">$szComment</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;&quot;</span>
        <span style="color: #800080;">$policyrule</span>.ExportToFile<span style="color: #000000;">&#40;</span><span style="color: #800080;">$szOutFilePath</span><span style="color: pink;">,</span> <span style="color: #800080;">$iOptionalData</span><span style="color: pink;">,</span> <span style="color: #800080;">$szPassword</span><span style="color: pink;">,</span> <span style="color: #800080;">$szComment</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Just click on the link below to download the full script:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/12/export-fw-policy.txt"><img class="aligncenter size-full wp-image-83" title="tool" src="http://www.ldap389.info/wp-content/uploads/2010/03/tool1.png" alt="" width="48" height="48" /></a></p>
<p>Change the following default values:</p>
<ul>
<li>$servers: TMG server names.</li>
<li>$iOptionalData: Export type (Radius data&#8230;) See <a href="http://msdn.microsoft.com/en-us/library/aa490382.aspx">this link</a> for more details.</li>
<li>$szPassword: Password used to encrypt confidential data (e.g. Radius data&#8230;)</li>
</ul>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Powershell%3A+Export+firewall+rules+on+your+TMG+servers+http%3A%2F%2Fis.gd%2FG2zUQW" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/JakzKruYF7U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2012/01/04/powershell-export-firewall-rules-on-your-tmg-servers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2012/01/04/powershell-export-firewall-rules-on-your-tmg-servers/</feedburner:origLink></item>
		<item>
		<title>OWA published with a TMG array member of a domain located in the DMZ</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/P3d6rWHYkK8/</link>
		<comments>http://www.ldap389.info/en/2011/12/19/owa-published-tmg-enterprise-array-member-domain-located-in-dmz-perimeter-network/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 12:57:06 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[Public Key Infrastructure @en]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Exchange @en]]></category>
		<category><![CDATA[pki @en]]></category>
		<category><![CDATA[rodc @en]]></category>
		<category><![CDATA[tmg @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1585</guid>
		<description><![CDATA[We will describe in this post how to set up Threat Management Gateway in a domain located in the perimeter network (DMZ) in order to publish your Outlook Web Access external URL and ensure a secure SSL connection. The OWA site is installed on the CAS servers of your Exchange infrastructure. The internal URL, registered [...]]]></description>
			<content:encoded><![CDATA[<p>We will describe in this post how to set up Threat Management Gateway in a domain located in the perimeter network (DMZ) in order to publish your Outlook Web Access external URL and ensure a secure SSL connection. The OWA site is installed on the CAS servers of your Exchange infrastructure. The internal URL, registered in your private DNS, is being accessed by the computers in your internal network which are members of your domain. The external URL, registered in your public DNS, is being accessed by any computer connected to the internet, which obviously is not necessarily a member of your domain. To get both internal and external URL launch the following command on the Exchange Management Shell:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Get<span style="color: pink;">-</span>OwaVirtualDirectory <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">ft</span> server<span style="color: pink;">,</span>InternalURL<span style="color: pink;">,</span>externalURL</pre></div></div>

<p><span id="more-1585"></span><br />
In our example the internal URL is <em>mail.internal.ldap389.info</em>, the external URL is <em>mail.ldap389.info</em>. We want to ensure a secure SSL connection from the client to the OWA Website: To achieve that a SAN certificate issued by our enterprise PKI and including both URLs is installed on each member of the CAS array.</p>
<p>The network traffic of the computers located in your internal network, accessing the <em>mail.internal.ldap389.info</em> internal URL, is balanced across the CAS servers with a HLB device (represented by green arrows on the below diagram).</p>
<p>The clients connecting from the internet via the <em>mail.ldap389.info</em> internal URL first contact the TMG array, the traffic is balanced across the TMG server&#8217;s external NICs with a HLB device, those IPs are located in the public DMZ. The network traffic of the clients accessing your OWA from the internet is represented by red arrows on the below diagram and detailed in the next paragraphs:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/12/owa-tmg3.jpg" rel="lightbox[1585]"><img class="aligncenter size-medium wp-image-1577" title="owa-tmg" src="http://www.ldap389.info/wp-content/uploads/2011/12/owa-tmg3-229x300.jpg" alt="" width="229" height="300" /></a></p>
<p>I suggest you purchase a certificate from an external certificate authority and set it up on the TMG&#8217;s OWA web listener, by using this kind of certificate the computers which are not members of the <em>internal.ldap389.info</em> domain will perform an SSL connection with the TMG without any warning displayed on their web browser. If you use a certificate issued by your enterprise PKI, the certificate of the enterprise root CA will not be installed on the Trusted Root Certification Authorities store on the computers which are not members of your domain. For those computers you will get this kind of warning when connecting to the Outlook Web Access:</p>
<p>&nbsp;</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/12/certificate-not-trusted-internet-explorer2.jpg" rel="lightbox[1585]"><img class="aligncenter size-thumbnail wp-image-1602" title="certificate-not-trusted-internet-explorer" src="http://www.ldap389.info/wp-content/uploads/2011/12/certificate-not-trusted-internet-explorer2-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p>Communication is also secured with SSL between the TMG&#8217;s internal NICs (located in the &#8220;private DMZ&#8221;) and the CAS servers. In order to perform a secure communication by using the SAN enterprise certificate installed on the CAS servers, you have to install the certificate of the enterprise root CA as a trusted root CA certificate on your TMG servers.</p>
<p>TMG presents an HTML Form in which the user enters a user name and password, which TMG can then authenticate against Active Directory over LDAP secure protocol. LDAPs connection is performed on a Windows 2008R2 Core <a href="http://blogs.technet.com/b/activedirectoryua/archive/2009/01/15/planning-and- deploying-rodcs.aspx">RODC</a> which is a member of your internal network domain (DNS name <em>rodc.internal.ldap389.info</em>). You can configure more than one RODC in the <em>LDAP Server Set</em> in order to provide redundancy. You <a href="http://technet.microsoft.com/en-us/library/cc730883(WS.10).aspx">can </a>cache credentials on the RODCs for users using the OWA from the internet, in that case you need to configure one <a href="http://technet.microsoft.com/fr-fr/library/cc730693(WS.10).aspx">AD site per RODC</a>. Your TMG OWA listener will be set up as below:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/12/tmg-rodc.jpg" rel="lightbox[1585]"><img class="aligncenter size-medium wp-image-1560" title="tmg-rodc" src="http://www.ldap389.info/wp-content/uploads/2011/12/tmg-rodc-300x113.jpg" alt="" width="300" height="113" /></a></p>
<p>In order to perform an LDAP over SSL connection with your internal RODC, the TMG must resolve the <em>rodc.internal.ldap389.info</em> name by using a host file. In the same host file, the <em>mail.ldap389.info</em> name points to the HLB which balances the traffic across the CAS servers (see <em>host file </em>on the diagram).</p>
<p>If you want to get all the benefits of a <a href="http://technet.microsoft.com/en-us/library/ee207137.aspx">TMG Enterprise</a> array, including the <a href="http://araihan.wordpress.com/2010/06/10/install-and-configure- forefront-tmg-2010-enterprise-management-server-ems-for-centralized-management-step-by-step/">EMS</a> replication, it needs to be member of a <a href="http://technet.microsoft.com/en-us/library/dd897048.aspx">domain</a> (<em>dmz.local</em>). I suggest you read this <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=3957">document</a> on how to set up a domain in a DMZ. In our case there is neither trust relationship nor DNS forwarders between the two domains <em>dmz.local</em> and <em>internal.ldap389.info</em> (that is why we use host files). We only allow SSL connections between the private DMZ network and the internal network.</p>
<p>Securing your <em>dmz.local</em> domain is very important because it is located close to the internet, here are a few leads on how to secure it: The domain controllers should be located in a dedicated subnet in your private DMZ. TMG servers only authenticate against Windows 2008R2 RODCs, they should only communicate with a RWDC on the <a href="http://technet.microsoft.com/en-us/library/cc754956(WS.10).aspx">DNS TCP 53</a> port, in order to allow DNS update (see <em>How does the client DNS update referral mechanism work?</em>). In order to join a TMG server through a RODC perform the steps described in this <a href="http://blogs.dirteam.com/blogs/jorge/archive/2009/01/02/domain-join-through-an-rodc-instead-of-an-rwdc.aspx">article</a>. You can also set up <a href="http://technet.microsoft.com/fr-fr/library/cc755310(WS.10).aspx">administrator role separation </a>on the RODCs and deny password caching for domain administrators. Finally, you can set up the <em><a href="http://support.microsoft.com/kb/172931/en-us">CachedLogonCounts</a></em> value to 0 on the TMG servers, but you will not able log on with a domain account if no domain controller is available. In that configuration your TMG array is member of a secured domain and you can enjoy all the features of the enterprise version.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=OWA+published+with+a+TMG+array+member+of+a+domain+located+in+the+DMZ+http%3A%2F%2Fis.gd%2Fr64cMu" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/P3d6rWHYkK8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2011/12/19/owa-published-tmg-enterprise-array-member-domain-located-in-dmz-perimeter-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2011/12/19/owa-published-tmg-enterprise-array-member-domain-located-in-dmz-perimeter-network/</feedburner:origLink></item>
		<item>
		<title>Powershell: Blackberry and Activesync mobile devices inventory</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/0BQDr0ku3As/</link>
		<comments>http://www.ldap389.info/en/2011/11/21/powershell-sql-ems-mobile-device-inventory-blackberry-activesync-exchange/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 17:10:52 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[tools @en]]></category>
		<category><![CDATA[ActiveSync @en]]></category>
		<category><![CDATA[Blackberry @en]]></category>
		<category><![CDATA[Exchange @en]]></category>
		<category><![CDATA[PowerShell @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1517</guid>
		<description><![CDATA[When you setup a corporate Exchange mail system users can access their mailbox on most mobile devices (iPhone, Android, Windows Phone&#8230;) through the ActiveSync protocol. For blackberry owners to access your mail system, you need to setup a BES infrastructure. The purpose of this Powershell script is to make an inventory of all the mobile [...]]]></description>
			<content:encoded><![CDATA[<p>When you setup a corporate Exchange mail system users can access their mailbox on most mobile devices (iPhone, Android, Windows Phone&#8230;) through the <a href="http://www.microsoft.com/about/legal/en/us/IntellectualProperty/IPLicensing/Programs/ExchangeActiveSyncProtocol.aspx">ActiveSync protocol</a>. For blackberry owners to access your mail system, you need to setup a <a href="http://us.blackberry.com/apps-software/server/exchange/">BES</a> infrastructure.<br />
<span id="more-1517"></span></p>
<p>The purpose of this Powershell script is to make an inventory of all the mobile devices accessing your Exchange mail system. First we will retrieve BlackBerry devices information by querying the BES SQL configuration database, then the other devices using the ActiveSync protocol by querying the Active Directory.   </p>
<p><span style="text-decoration: underline;"><strong>BlackBerry Inventory:</strong></span></p>
<p>Your BackBerry system configuration is stored in the BESMGMT SQL database, among other things you will find information about the Blackberry devices connecting to your mail system. We will query three tables in that database:
<ul>
<li>UserConfig: Contains among others the user&#8217;s Email address (<em>MailboxSMTPAddr</em> value).</li>
<li>SyncDeviceMgmtSummary: Blackberry model and OS version (<em>ModelName</em> and <em>AppsVer</em>).</li>
<li>UserStats: Time the last message was received by the BlackBerry (<em>LastFwdTime</em>).</li>
</ul>
<p>If you browse the database with SQL Management Studio you can see all that information:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/11/besmgmt.jpg" rel="lightbox[1517]"><img class="aligncenter size-medium wp-image-1496" title="besmgmt" src="http://www.ldap389.info/wp-content/uploads/2011/11/besmgmt-300x200.jpg" alt="" width="300" height="200" /></a><br />
You just need to use Powershell to connect to the SQL database and retrieve those values for each user. The primary key between the three tables is the <em>ID</em> value. We will filter only the users who received an Email during the last 60 days (<em>LastFwdTime</em>).</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$days</span> <span style="color: pink;">=</span> <span style="color: #804000;">60</span>
<span style="color: #800080;">$dbServer</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;SQLBES-SRV&quot;</span>
<span style="color: #800080;">$db</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;BESMgmt&quot;</span>
&nbsp;
<span style="color: #008000;">#If you use SA account to connect database, change pwd=XXXXXX!, or use Windows Authentication, see below</span>
<span style="color: #800080;">$connString</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Server=$dbServer;Database=$db;uid=sa;pwd=XXXXXX&quot;</span>
&nbsp;
<span style="color: #008000;">#If you use Windows Authentication to connect BESMGMT SQL Database, need setup the database</span>
<span style="color: #008000;">#$connString = &quot;Server=$dbServer;Database=$db;Integrated Security=True&quot;</span>
&nbsp;
<span style="color: #008000;">#SQL Query to retrieve BB devices Info (only devices who  recieved mail in the last $days)</span>
<span style="color: #800080;">$Query</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Select UserConfig.DisplayName,MailboxSMTPAddr,ModelName,LastFwdTime,AppsVer from UserConfig,SyncDeviceMgmtSummary,UserStats where UserConfig.ID=SyncDeviceMgmtSummary.UserConfigID AND UserConfig.ID=UserStats.UserConfigID AND DeviceType &lt;&gt; 0 AND ModelName &lt;&gt; '' AND DateDiff(dd,LastFwdTime,GETDATE()) &lt; &quot;</span><span style="color: pink;">+</span><span style="color: #800080;">$days</span>
&nbsp;
<span style="color: #008000;">#Connect to Database, run Query, Disconnect</span>
&nbsp;
<span style="color: #800080;">$SqlConnection</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> 
&nbsp;
System.Data.SqlClient.SqlConnection
<span style="color: #800080;">$SqlConnection</span>.ConnectionString <span style="color: pink;">=</span> <span style="color: #800080;">$connString</span>
<span style="color: #800080;">$SqlCmd</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Data.SqlClient.SqlCommand
<span style="color: #800080;">$SqlCmd</span>.CommandText <span style="color: pink;">=</span> <span style="color: #800080;">$Query</span>
<span style="color: #800080;">$SqlCmd</span>.Connection <span style="color: pink;">=</span> <span style="color: #800080;">$SqlConnection</span>
<span style="color: #800080;">$SqlAdapter</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Data.SqlClient.SqlDataAdapter
<span style="color: #800080;">$SqlAdapter</span>.SelectCommand <span style="color: pink;">=</span> <span style="color: #800080;">$SqlCmd</span>
<span style="color: #800080;">$DataSet</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Data.DataSet
<span style="color: #800080;">$SqlAdapter</span>.Fill<span style="color: #000000;">&#40;</span><span style="color: #800080;">$DataSet</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$SqlConnection</span>.Close<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$bbs</span> <span style="color: pink;">=</span> <span style="color: #800080;">$DataSet</span>.Tables<span style="color: #000000;">&#91;</span><span style="color: #804000;">0</span><span style="color: #000000;">&#93;</span></pre></div></div>

<p>If you need more details on how to query the BESMGMT database you can read this <a href="http://www.jigsawboys.com/2008/04/04/sql-query-to-exportlist-all-users-in-your-blackberry-server-farm/">post</a> or this <a href="http://www.blackberryforums.com/bes-admin-corner/178896-powershell-bes.html">forum</a> topic, which discusses how to query the database with SQL 2008 CmdLets (you will need to install the Microsoft <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&#038;id=8824">SQL Server 2008 Feature Pack</a>.) The above script uses the .NET <em><a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.aspx">System.Data.SqlClient</a></em> Namespace, so you won&#8217;t need any additional installation. All the information about your user&#8217;s Blackberry devices is retrieved in the <em>$bbs</em> variable.</p>
<p><span style="text-decoration: underline;"><strong>ActiveSync Inventory:</strong></span></p>
<p>For other mobile devices connecting to your mail system it is more simple because they use the ActiveSync protocol, and all the information you need is stored in the Active Directory. Florian&#8217;s blog <a href="http://www.frickelsoft.net/blog/?p=285">post</a> explains that <em>msExchActiveSyncDevice</em> objects are a subcontainer of your AD account. Just open <em>dsa.msc</em> to check this out:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/11/activesync-device.jpg" rel="lightbox[1517]"><img class="aligncenter size-medium wp-image-1498" title="activesync-device" src="http://www.ldap389.info/wp-content/uploads/2011/11/activesync-device-300x117.jpg" alt="" width="300" height="117" /></a></p>
<p>Thanks to the Exchange Management Shell (2007 and 2010), the <em><a href="http://technet.microsoft.com/en-us/library/aa996908(EXCHG.80).aspx">Get-ActiveSyncDeviceStatistics </a></em> cmdlet gives you all the information you need about the <em>msExchActiveSyncDevice</em> objects. You can read <a href="http://www.simple-talk.com/sysadmin/exchange/identifying-exchange-activesync-users-with-powershell/">Ben Lye&#8217;s post</a> to know how to identify ActiveSync users. With that Cmdlet we will retrieve the following values:</p>
<ul>
<li>DeviceType: Mobile type (Iphone, WP, Android&#8230;)</li>
<li>DeviceModel: Mobile model (HTC, LG, Samsung, Iphone&#8230;)</li>
<li>DeviceUserAgent: OS build is displayed in that value (Iphone, WP, Android&#8230;)</li>
<li>LastSuccessSync: Last successful device synchronization, like BlackBerry devices we will filter only users who successfully synchronized during the last 60 days</li>
</ul>
<p>We retrieve more or less the same information as the one retrieved with the SQL query for Blackberry devices.</p>
<p><span style="text-decoration:underline;"><strong>How the script works:</strong></span></p>
<p>We will describe how to aggregate both queries. First we query the BESMGMT SQL database to retrieve Blackberry devices information. For each Email address <em>MailboxSMTPAddr </em>we also check if the user has a device using the ActiveSync protocol (when you are a real VIP you have a Blackberry and an iPad <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) by using the following Powershell command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$acts</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>ActiveSyncDeviceStatistics <span style="color: pink;">-</span>Mailbox <span style="color: #800080;">$bb</span>.MailboxSMTPAddr
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$acts</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-object</span><span style="color: #000000;">&#41;</span>.count <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span> 
<span style="color: #000000;">&#123;</span>User has just one BB no ActiveSync device<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">else</span> <span style="color: #000000;">&#123;</span>User has one ActiveSync device <span style="color: #0000FF;">in</span> addition to BB<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Once the Blackberry inventory is done we load every Exchange mailbox with this command:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$Mailboxes</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>Mailbox <span style="color: pink;">-</span>RecipientTypeDetails UserMailbox <span style="color: pink;">-</span>ResultSize Unlimited</pre></div></div>

<p>Then we compare the <em>PrimarySmtpAddress</em> value (retrieved with the get-mailbox Cmdlet) with every <em>MailboxSMTPAddr</em> value (stored in the <em>$BESsmtpArray</em> variable) in order to exclude the users already processed during the BlackBerry devices inventory. For each remaining user we check if they have any devices using the ActiveSync protocol. The result of the inventory is written in a CSV file containing the following information:</p>
<ul>
<li>User&#8217;s Email address.</li>
<li>Number of mobile devices (ActiveSync + BlackBerry).</li>
<li>Device type: BlackBerry, IPhone, WP, Android&#8230;</li>
<li>Device model: BlackBerry model, Samsung, HTC, LG&#8230;</li>
<li>OS version.</li>
<li>Last connection: Last mail received on the BlackBerry device, last ActiveSync synchronization.</li>
</ul>
<p>Here is an example of inventory result imported in Excel:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/11/output.jpg" rel="lightbox[1517]"><img class="aligncenter size-medium wp-image-1499" title="output" src="http://www.ldap389.info/wp-content/uploads/2011/11/output-300x65.jpg" alt="" width="300" height="65" /></a></p>
<p>Just modify the following variables in the script and launch it from the Exchange management shell:</p>
<ul>
<li>$days: Inactivity threshold in days (default is 60).</li>
<li>$dbServer: Name of the server hosting the SQL BES configuration database.</li>
<li>$connString: Authentication to the SQL database (Windows integrated or with SA account).</li>
</ul>
<p>To download the full script, just click below:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/11/countMobile.ps1"><img class="aligncenter size-full wp-image-83" title="tool" src="http://www.ldap389.info/wp-content/uploads/2010/03/tool1.png" alt="" width="48" height="48" /></a><br />
PS: The script was tested under Exchange 2010 and BES 5.02, thanks for your feedback on other versions.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Powershell%3A+Blackberry+and+Activesync+mobile+devices+inventory+http%3A%2F%2Fis.gd%2FxAebgL" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/0BQDr0ku3As" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2011/11/21/powershell-sql-ems-mobile-device-inventory-blackberry-activesync-exchange/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2011/11/21/powershell-sql-ems-mobile-device-inventory-blackberry-activesync-exchange/</feedburner:origLink></item>
		<item>
		<title>Powershell: Compare WSUS target groups</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/0U6Wqk9uyc8/</link>
		<comments>http://www.ldap389.info/en/2011/11/04/powershell-compare-wsus-target-groups/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 19:45:47 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[scripts @en]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[PowerShell @en]]></category>
		<category><![CDATA[wsus @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1470</guid>
		<description><![CDATA[This script compares the updates approved between two WSUS target groups. It can ben useful when you want to get the differences between a test and a production group, you can read this Group Policy Central article to get more details on how to set up a WSUS test group using GPO (chapter Implement a WSUS [...]]]></description>
			<content:encoded><![CDATA[<p>This script compares the updates approved between two WSUS target groups. It can ben useful when you want to get the differences between a <em>test</em> and a <em>production</em> group, you can read this <a href="http://www.grouppolicy.biz/2011/06/best-practices-group-policy-for-wsus/">Group Policy Central</a> article to get more details on how to set up a WSUS test group using GPO (chapter <em>Implement a WSUS Update Test Group of Computers</em>).<br />
<span id="more-1470"></span><br />
In order to get the approval status of a patch we will use the <em>Microsoft.UpdateServices.Administration</em> namespace (<em><a href="http://msdn.microsoft.com/en-us/library/microsoft.updateservices.administration.updateapprovalaction(v=VS.85).aspx">UpdateApprovalAction</a></em> enumeration), the following code enumerates all the KB updates and returns its approval status for all target groups:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>void<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>reflection.assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">LoadWithPartialName</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.UpdateServices.Administration&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$wsus</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.AdminProxy<span style="color: #000000;">&#93;</span>::getUpdateServer<span style="color: #000000;">&#40;</span><span style="color: #800080;">$wsusserver</span><span style="color: pink;">,</span><span style="color: #800080;">$False</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$updateScope</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.UpdateServices.Administration.UpdateScope;
<span style="color: #800080;">$updateScope</span>.UpdateApprovalActions <span style="color: pink;">=</span><span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.UpdateApprovalActions<span style="color: #000000;">&#93;</span>::Install <span style="color: #FF0000;">-bor</span> <span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.UpdateApprovalActions<span style="color: #000000;">&#93;</span>::Uninstall <span style="color: #FF0000;">-bor</span> <span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.UpdateApprovalActions<span style="color: #000000;">&#93;</span>:: All <span style="color: #FF0000;">-bor</span> <span style="color: #000000;">&#91;</span>Microsoft.UpdateServices.Administration.UpdateApprovalActions<span style="color: #000000;">&#93;</span>::NotApproved
&nbsp;
<span style="color: #800080;">$updates</span> <span style="color: pink;">=</span> <span style="color: #800080;">$wsus</span>.GetUpdates<span style="color: #000000;">&#40;</span><span style="color: #800080;">$updateScope</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$groups</span> <span style="color: pink;">=</span> <span style="color: #800080;">$wsus</span>.GetComputerTargetGroups<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span> <span style="color: #800080;">$update</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$updates</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$groups</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
    <span style="color: #800080;">$status</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Pending&quot;</span>
&nbsp;
    <span style="color: #008000;">#MSDN update status:</span>
    <span style="color: #008000;">#All: Use to query all updates, regardless of their action.</span>
    <span style="color: #008000;">#Install: Client installs the update.</span>
    <span style="color: #008000;">#NotApproved :The Update will not be available for clients. This value can be used in a simple targeting ComputerTargetGroup to &quot;override&quot; a UpdateApproval made to the &quot;All Computers&quot; ComputerTargetGroup.</span>
    <span style="color: #008000;">#Uninstall: Client removes the update.</span>
&nbsp;
        <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$update</span>.GetUpdateApprovals<span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span><span style="color: #000000;">&#41;</span>.Count <span style="color: #FF0000;">-ne</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span><span style="color: #800080;">$status</span> <span style="color: pink;">=</span> <span style="color: #800080;">$update</span>.GetUpdateApprovals<span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #804000;">0</span><span style="color: #000000;">&#93;</span>.Action<span style="color: #000000;">&#125;</span>
    <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$update</span>.Title <span style="color: pink;">+</span> <span style="color: #800000;">';'</span> <span style="color: pink;">+</span> <span style="color: #800080;">$group</span>.Name <span style="color: pink;">+</span> <span style="color: #800000;">';'</span> <span style="color: pink;">+</span> <span style="color: #800080;">$status</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Both <em>test</em> and <em>production</em> target groups inherit from the <em>&#8220;All Computers&#8221;</em> group:<br />
<img class="aligncenter size-medium wp-image-1449" title="wsus-hierarchy" src="http://www.ldap389.info/wp-content/uploads/2011/10/wsus-hierarchy-215x300.jpg" alt="" width="215" height="300" /></p>
<p>We need to retrieve the update approval status for the following target groups:</p>
<ul>
<li>$Allstatus: Approval status for the &#8221;<em>All computers</em>&#8221; group, default value &#8220;<em>Not Approved</em>&#8220;.</li>
<li>$statusprod: Approval status for the <em>production</em> target group, default value &#8220;<em>Pending</em>&#8220;, in this case the approval status inherits from the &#8220;<em>All computers</em>&#8221; group.</li>
<li>$statusqualif: Approval status for the <em>test</em> target group, default value &#8220;<em>Pending</em>&#8220;, in this case the approval status inherits from the &#8220;<em>All computers</em>&#8221; group.</li>
</ul>
<p>For a given patch, if <em>$statusprod</em> is different from <em>$statusqualif</em> then the status of each group is returned, if one of the two groups has no value (status <em>pending</em>) then the <em>All computers</em> group approval status is returned.</p>
<p>Download the full script here:</p>
<p><a href="http://www.ldap389.info/wp-content/uploads/2011/10/compare-wsus-groups.ps1"><img class="aligncenter size-full wp-image-83" title="tool" src="http://www.ldap389.info/wp-content/uploads/2010/03/tool1.png" alt="" width="48" height="48" /></a></p>
<p>The script returns a CSV file with the following information:</p>
<ul>
<li>KB update name.</li>
<li>Approval status for the <em>production</em> target group, inheritance from the <em>All Computers</em> group is displayed if needed.</li>
<li>Approval status for the <em>test</em> target group, inheritance from the <em>All Computers</em> group is displayed if needed.</li>
<li>MSRC severity of the patch (see this <a href="http://msdn.microsoft.com/en-us/library/microsoft.updateservices.administration.msrcseverity(v=VS.85).aspx">MSDN article</a> to get more information on the possible values), this concerns security patches.</li>
<li>MS Security bulletin the patch is related to, this concerns security patches.</li>
<li>Products concerned by this update.</li>
</ul>
<p>In the script, change the following default values:</p>
<ul>
<li><em>$wsusserver</em>: WSUS server name.</li>
<li><em>$grqualif</em>: WSUS Target group name for the test computers.</li>
<li><em>$grprod</em>: WSUS Target group name for the production computers.</li>
</ul>
<p>If you want more Powershell scripts about WSUS server management, visit the <a href="http://gallery.technet.microsoft.com/scriptcenter/?f%5B0%5D.Type=RootCategory&amp;f%5B0%5D.Value=windowsupdate&amp;f%5B0%5D.Text=Windows%20Update&amp;f%5B1%5D.Type=SubCategory&amp;f%5B1%5D.Value=serverside&amp;f%5B1%5D.Text=Server-Side%20Management">technet script center</a>.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Powershell%3A+Compare+WSUS+target+groups+http%3A%2F%2Fis.gd%2FV7mENP" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/0U6Wqk9uyc8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2011/11/04/powershell-compare-wsus-target-groups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2011/11/04/powershell-compare-wsus-target-groups/</feedburner:origLink></item>
		<item>
		<title>@ldap389 :-)</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/VLgVi6CMJlc/</link>
		<comments>http://www.ldap389.info/en/2011/11/01/ldap389/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 20:17:20 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[Uncategorized @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1482</guid>
		<description><![CDATA[A quick word to tell you that I (finally) signed up on twitter. You will also find @ldap389 latest tweets on the blog&#8217;s sidebar (Twitter Updates widget), it replaces the old &#8220;Latest AD news&#8221; sidebar.]]></description>
			<content:encoded><![CDATA[<p>A quick word to tell you that I (finally) signed up on twitter. You will also find <a href="http://twitter.com/#!/ldap389">@ldap389</a> latest tweets on the blog&#8217;s sidebar (<em>Twitter Updates</em> widget), it replaces the <a href="http://www.ldap389.info/en/2010/07/05/sidebar-add-on-latest-ad-news/">old <em>&#8220;Latest AD news&#8221;</em></a> sidebar.</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=%40ldap389+%3A-%29+http%3A%2F%2Fis.gd%2FFffob3" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/VLgVi6CMJlc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2011/11/01/ldap389/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2011/11/01/ldap389/</feedburner:origLink></item>
		<item>
		<title>ADDS 2008 migration: Before migrating to windows 8 server…</title>
		<link>http://feedproxy.google.com/~r/Ldap389/~3/r6SNV_rjtMw/</link>
		<comments>http://www.ldap389.info/en/2011/09/24/adds-2008-migration-before-windows-8-server/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 23:14:51 +0000</pubDate>
		<dc:creator>ldap389</dc:creator>
				<category><![CDATA[Disaster recovery @en]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[troubleshooting @en]]></category>
		<category><![CDATA[adprep @en]]></category>
		<category><![CDATA[login @en]]></category>
		<category><![CDATA[rodc @en]]></category>
		<category><![CDATA[schema @en]]></category>
		<category><![CDATA[vdc @en]]></category>

		<guid isPermaLink="false">http://www.ldap389.info/?p=1427</guid>
		<description><![CDATA[You can&#8217;t wait to install Windows server 8 developer preview in order to test it in the event of a future deployment&#8230; But you might want to finish your migration to ADDS 2008R2 before thinking about all that Bellow is a tab showing some client compatibility issues and the important steps when migrating your domain [...]]]></description>
			<content:encoded><![CDATA[<p>You can&#8217;t wait to <a href="http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2011/09/14/how-to-install-windows-server-8-build-8102.aspx">install Windows server 8</a> developer preview in order to test it in the event of a future deployment&#8230; But you might want to finish your migration to ADDS 2008R2 before thinking about all that <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Bellow is a tab showing some client compatibility issues and the important steps when migrating your domain controllers to Windows server 2008R2:</p>
<p><span id="more-1427"></span></p>
<table style="width: 500px;" border="1">
<tbody>
<tr>
<td width="25%">Prepare AD: adprep.exe or adprep32.exe</td>
<td width="25%">Install the first Windows 2008R2 <em>RWDC</em> (not fsmo holder).</td>
<td width="25%">Migrate the <em>PDCe</em> to Windows 2008R2.</td>
<td width="25%">Migrate the <em>schema master</em> to Windows 2008: enable <em>Filtered Attribute Set</em> when installing a RODC.</td>
</tr>
<tr>
<td width="25%">1\ Minimum domain functional level: 2000.Recommended: 2003.</p>
<p>See this <a href="http://blogs.technet.com/b/askds/archive/2008/11/11/so-you-want-to-upgrade-to-windows-2008-domain-controllers-adprep.aspx">askDS post</a> for more details on running adprep</p>
<p>&nbsp;</p>
<p>2\ Deploying a RODC:</p>
<p><em>adprep /rodcprep:</em></p>
<p>Minimum domain functional level: <a href="http://technet.microsoft.com/en-us/library/cc754629%28WS.10%29.aspx#bkmk_raiseforestlevel">2003</a>.</td>
<td width="25%">1\ NT4.0 and old CIFS servers will not authenticate against a <a href="http://support.microsoft.com/kb/942564/en-us">Windows 2008R2 domain controller</a>.Symptom 4:</p>
<p><em>A SMB storage device may be unable to use weak cryptography algorithms to establish a security channel to a Windows Server 2008-based domain controller.</em></p>
<p>Here is an example if your EMC Celerra <a href="http://ecn-staging.emc.com/servlet/JiveServlet/previewBody/4724-102-2-15824/Celerra_Network_Server_5-6-46-%204_RN_300-004-151_a17.pdf;jsessionid=8BE2E66E9B324A416227F054E311CC6E.node0">target version is lower than 5.6</a>:</p>
<p><em>As of version 5.6.42.5, Celerra Network Server supports Microsoft’s new SMB 2 protocol.<br />
</em></p>
<p>&nbsp;</p>
<p>2\ Applications using Data Encryption Standard (DES) encryption for Kerberos authentication to a Windows 2008R2 domain controller <a href="http://support.microsoft.com/kb/977321/en-us">will fail to authenticate</a>.</p>
<p>Because this old cryptography algorithm is disabled by default.</p>
<p>Have a look a this example describing an <a href="http://www.jonathanmedd.net/2011/06/sap-single-sign-on-issues-with-windows-server-2008-r2-domain-controllers.html">SSO problem with SAP and a Windows 2008R2 DC.</a></td>
<td width="25%">1\ Active directory trust with a Windows NT4.0 domain, still <a href="http://support.microsoft.com/kb/942564/en-us">in the same KB</a>:Symptom 5:<br />
<em><br />
Servers that are running Windows Server 2008 R2 cannot be accessed by using a Windows NT 4.0-based domain trust.</em></p>
<p><strong>As a bonus</strong>: The trust relationship breaks when the 2008R2 PDCe is renewing the trust password with a NT4.0 DC, a few days later. See <em>TDO passwords</em> chapter of <a href="http://technet.microsoft.com/en-us/library/cc773178%28WS.10%29.aspx">this article</a>.</p>
<p>&nbsp;</p>
<p>2\ Deploying a RODC:</p>
<p>It will not advertise as a time source untill the PDCe is migrated to Windows server 2008, have a look at <a href="http://technet.microsoft.com/en-us/library/cc753966%28WS.10%29.aspx">this article for information and a possible workaround.</a></td>
<td width="25%">1\ The Schema master holder must be running Windows 2008 before using <a href="http://technet.microsoft.com/en-%20us/library/cc755310%28WS.10%29.aspx">Filtered Attribute Set</a>:<em>Make sure that the domain controller that holds the schema operations master (also known as flexible single master operations or FSMO) role is running Windows Server 2008 when you add attributes to the RODC FAS so that the attributes are verified to not be system critical.</em></p>
<p>&nbsp;</p>
<p>2\ Another important point about FAS from the same <a href="http://technet.microsoft.com/en-us/library/cc755310%28WS.10%29.aspx">article</a>:</p>
<p><em></em><em>A rogue RODC can replicate RODC FAS data from a domain controller that runs Windows Server 2003 by making a replication request.</em></p>
<p>Do not configure a Windows 2003 DC as a replication partner of a Windows 2008 DC. Use <em>dssite.msc</em> and/or firewall rules to make sure it doesn&#8217;t happen.</td>
</tr>
</tbody>
</table>
<p>Ok now you migrated to ADDS 2008R2 you can enjoy <a href="http://technet.microsoft.com/en-us/library/understanding-active-directory-functional- levels%28WS.10%29.aspx">many new features</a> like the active directory recycle bin when you forest functional level is 2008R2&#8230;</p>
<p>Well when you will start migrating to Windows server 8 ADDS you will get a new feature to make your disaster recovery plan even faster: The ability to <a href="http://www.windowsitpro.com/article/windowsserver8/windows-server-8-active-directory-140571">do snapshots of a V-DC.</a> <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I am sure my colleagues <a href="http://www.hypervisor.fr/">Hypervisor</a> and <a href="http://www.vmdude.fr/">VMDude</a> will appreciate that quote:</p>
<p><em>Microsoft is working with other virtualization vendors to make sure they include this technology in the latest version of their hypervisors as well. It’s in their interest to do so.</em></p>
<p> <img src='http://www.ldap389.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=ADDS+2008+migration%3A+Before+migrating+to+windows+8+server%E2%80%A6+http%3A%2F%2Fis.gd%2FOGcIRl" title="Post to Twitter"><img class="nothumb" src="http://www.ldap389.info/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter-micro3.png" alt="Post to Twitter" /></a></p></div><img src="http://feeds.feedburner.com/~r/Ldap389/~4/r6SNV_rjtMw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ldap389.info/en/2011/09/24/adds-2008-migration-before-windows-8-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.ldap389.info/en/2011/09/24/adds-2008-migration-before-windows-8-server/</feedburner:origLink></item>
	</channel>
</rss>

