<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.proexchange.be/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Exchange 2010 : Powershell</title><link>http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx</link><description>Tags: Powershell</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Working with Disconnected Mailboxes in Exchange Server 2010, Office 365 and Hybrid–Part 2</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2012/05/13/working-with-disconnected-mailboxes-in-exchange-server-2010-office-365-and-hybrid-part-2.aspx</link><pubDate>Sun, 13 May 2012 21:22:06 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1453</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1453</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2012/05/13/working-with-disconnected-mailboxes-in-exchange-server-2010-office-365-and-hybrid-part-2.aspx#comments</comments><description>&lt;h4&gt;&lt;font style="font-weight:bold;"&gt;Introduction&lt;/font&gt;&lt;/h4&gt;  &lt;p&gt;In the &lt;a href="http://www.pro-exchange.be/blogs/exchange2010/archive/2012/04/29/working-with-disconnected-mailbox-in-exchange-server-2010-office-365-and-hybrid-part-1.aspx"&gt;previous part&lt;/a&gt; of this article, we covered some of the basics about what disconnected mailboxes are and showed how to ‘work’ with them in an on-premise deployment of Exchange Server 2010.    &lt;br /&gt;This second (short) part will focus mostly on disconnected mailboxes and archives in Office 365 (Exchange Online). As you will see, since Exchange Online is also based on Exchange Server 2010, differences are rather small and mostly due to the limitation of being a “shared platform”.&lt;/p&gt;  &lt;h4&gt;&lt;font style="font-weight:bold;"&gt;Locating disconnected/deleted mailboxes&lt;/font&gt;&lt;/h4&gt;  &lt;p&gt;Before, I showed you how you could find disconnected mailboxes in your environment. Working with disconnected mailboxes in Office 365 is pretty much the same. However, the example script from the previous part uses the &lt;a href="http://technet.microsoft.com/EN-US/library/838bc72a-e3bb-4583-934f-d93a7c93252c(EXCHG.141).aspx"&gt;Get-MailboxServer&lt;/a&gt; cmdlet which isn’t available in Exchange Online. Alternatively, you could/should use the Exchange Control Panel and navigate to the following page:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_41D01F79.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0F6C4BFA.png" width="503" height="193" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;By clicking the highlighted button, a new window will appear which will provide you a list of all (soft) deleted mailboxes:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3A44B00C.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0F001905.png" width="456" height="253" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;From this window, you also have the options to recover a mailbox. &lt;/p&gt;  &lt;h4&gt;&lt;font style="font-weight:bold;"&gt;Cloud-based Archives&lt;/font&gt;&lt;/h4&gt;  &lt;p&gt;Cloud-based archives (or Online Archives) are also a bit special. They exist online while the user’s mailbox can be located on-premise. If that is the case, you’ll be somehow limited in how you can treat disconnected archives.   &lt;br /&gt;You will only be able to reconnect the archive, by re-enabling it. For example, re-enabling the Online Archive for an on-premise user:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/58de5b3c-05c3-4a1f-84c6-f082d990f22b(EXCHG.141).aspx"&gt;&lt;font face="Courier New"&gt;Enable-Mailbox&lt;/font&gt;&lt;/a&gt;&lt;font face="Courier New"&gt; &amp;lt;Identity&amp;gt; –RemoteArchive –ArchiveDomain&amp;lt;servicedomain&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If a disconnected archive exists, it will be reconnected. If not, a new archive will be created. Disconnected/Deleted archives will stay in Exchange Online for 30 days. After that, they are deleted and not recoverable.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&amp;#160;&amp;#160; disconnected archives will stay in Exchange Online for 30 days. After that, they are deleted and not recoverable.&lt;/p&gt;  &lt;h4&gt;&lt;font style="font-weight:bold;"&gt;Cheating to restore an (on-premise) Archive&lt;/font&gt;&lt;/h4&gt;  &lt;p&gt;As stated earlier, you can only restore an Archive to the user account it previously belonged to. But what if you (accidentally) deleted that account and cannot recover it from a backup? The answer is simple: you’ll have to cheat Exchange into believe that the new account you created is actually the old one. To do this, you change the legacyExchangeDN-attribute for the new user account into the value of the old user account. If you don’t know what the old value was; try reconnecting the archive: the command will fail and provide you the legacyExchangeDN it is looking for. The error will look something like this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#ff0000" face="Courier New"&gt;The legacy DN &amp;#39;/O=COMPANY/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=&amp;lt;USERACCOUNT&amp;gt;&amp;#39; of disconnec&lt;/font&gt;&lt;font color="#ff0000" face="Courier New"&gt;ted mailbox does not match user legacy DN &amp;#39;/o=COMPANY/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipie&lt;/font&gt;&lt;font color="#ff0000" face="Courier New"&gt;nts/cn=&amp;lt;USERACCOUNT_OLD&amp;gt;&amp;#39;.&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#ff0000" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; + CategoryInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : NotSpecified: (Microsoft.Excha...ilboxStatistics:MailboxStatistics) [Connect-Mailbox], M&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ff0000" face="Courier New"&gt;dbAdminTaskException&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ff0000" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; + FullyQualifiedErrorId : 13614534,Microsoft.Exchange.Management.MapiTasks.ConnectMailbox&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;To work around this issue, do the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open ADSI Edit and connect to the default naming context     &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_20DCACD2.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_2EAEF2CD.png" width="244" height="166" /&gt;&lt;/a&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Navigate to the new user’s object, and open the properties. Located the legacyExchangeDN-attribute and enter the value that was attributed to the old account. Write down the value that is currently in there so that you can change it back afterwards.     &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_129E33E2.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_4E5DCC95.png" width="320" height="350" /&gt;&lt;/a&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Now, try connecting the archive to the new user account. This time, the command should succeed. (&lt;a href="http://technet.microsoft.com/EN-US/library/48757062-abe5-4c61-acc5-5884569c1d8b(EXCHG.141).aspx"&gt;&lt;em&gt;Connect-Mailbox&lt;/em&gt;&lt;/a&gt;&lt;em&gt; –Identity &amp;lt;id&amp;gt; –Archive –user &amp;lt;(Alternative_)user&amp;gt;)&lt;/em&gt;&lt;/li&gt;    &lt;li&gt;Either export the archive to a PST or import the content temporarily back into the primary mailbox.&lt;/li&gt;    &lt;li&gt;Disable the archive.&lt;/li&gt;    &lt;li&gt;Change the legacyExchangeDN value back to the value you wrote down.&lt;/li&gt;    &lt;li&gt;Create a new archive for the user.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Changing back the the legacyExchangeDN value on the new user account avoids possible issues further down the road. Alternatively, you can run the steps above against a (service) account that you created only for this purpose. That way, you don’t have to change attributes on a user-account that is in use.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note&amp;#160;&amp;#160; &lt;/strong&gt;since you cannot alter this attribute for online users; you will not be able to run this cheat in Exchange Online. Also note that this ‘cheat’ is &lt;font color="#ff0000"&gt;&lt;strong&gt;not supported&lt;/strong&gt;&lt;/font&gt;! &lt;img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style:none;border-bottom-style:none;border-right-style:none;border-left-style:none;" alt="Winking smile" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/wlEmoticon_2D00_winkingsmile_5F00_0E27B31B.png" /&gt;&lt;/p&gt;  &lt;p&gt;Have fun!&lt;/p&gt;  &lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1453" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Archiving/default.aspx">Archiving</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Mailbox/default.aspx">Mailbox</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+Management+Shell/default.aspx">Exchange Management Shell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Disconnected/default.aspx">Disconnected</category></item><item><title>Working with Disconnected Mailboxes in Exchange Server 2010, Office 365 and Hybrid–Part 1</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2012/04/29/working-with-disconnected-mailbox-in-exchange-server-2010-office-365-and-hybrid-part-1.aspx</link><pubDate>Sun, 29 Apr 2012 21:29:00 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1443</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1443</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2012/04/29/working-with-disconnected-mailbox-in-exchange-server-2010-office-365-and-hybrid-part-1.aspx#comments</comments><description>&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Introduction&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;In this article, I will try to explain what Disconnected mailboxes are. How a mailbox becomes disconnected and how you can identify and work with disconnected mailboxes in Exchange Server 2010 on-premise, Exchange Online and in a combination of both (Hybrid).&lt;/p&gt;
&lt;p&gt;First, to understand what disconnected mailboxes are we need to take a (quick) look at what &amp;lsquo;mailbox&amp;rsquo; actually is. The object that you see when running Get-Mailbox or through the Exchange Management Console is actually called a user-mailbox. In fact, that name literally states what it represents: a user and a mailbox. A user mailbox is thus a &amp;ldquo;combination&amp;rdquo; of an AD User Account and an Exchange Mailbox:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_59738621.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_5907532C.png" border="0" height="191" width="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All information on the user&amp;rsquo;s Exchange mailbox is stored in the user&amp;rsquo;s AD-attributes whereas the data itself is stored within the mailbox in Exchange. Using either ADSIEdit or PowerShell, you can view these attributes. The following list shows a common set of attributes for a user with an Exchange mailbox. Note that all Exchange-related attributes start with &amp;ldquo;msExch*&amp;rdquo;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;i&gt;msExchAddressBookFlags&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 1        &lt;br /&gt;msExchArchiveQuota&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 52428800         &lt;br /&gt;msExchArchiveWarnQuota&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 47185920         &lt;br /&gt;msExchBypassAudit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False         &lt;br /&gt;msExchDumpsterQuota&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 31457280         &lt;br /&gt;msExchDumpsterWarningQuota&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 20971520         &lt;br /&gt;msExchHomeServerName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : /o=Exchange/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=E14-EX10-01         &lt;br /&gt;msExchMailboxAuditEnable&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False         &lt;br /&gt;msExchMailboxAuditLogAgeLimit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 7776000         &lt;br /&gt;msExchMailboxGuid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {70, 147, 162, 91...}         &lt;br /&gt;msExchMailboxSecurityDescriptor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : System.DirectoryServices.ActiveDirectorySecurity         &lt;br /&gt;msExchMDBRulesQuota&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 64         &lt;br /&gt;msExchModerationFlags&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 6         &lt;br /&gt;msExchPoliciesIncluded&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {1429c9fb-4d64-45c2-84f5-fa61dfa1a19c, {26491cfc-9e50-4857-861b-0cb8df22b5d7}}         &lt;br /&gt;msExchProvisioningFlags&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 0         &lt;br /&gt;msExchRBACPolicyLink&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : CN=Default Role Assignment Policy,CN=Policies,CN=RBAC,CN=Exchange,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=EXCH14,DC=local         &lt;br /&gt;msExchRecipientDisplayType&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 1073741824         &lt;br /&gt;msExchRecipientTypeDetails&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 1         &lt;br /&gt;msExchTextMessagingState&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {302120705, 16842751}         &lt;br /&gt;msExchTransportRecipientSettingsFlags : 0         &lt;br /&gt;msExchUMDtmfMap&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {emailAddress:6484, lastNameFirstName:64242358264673623325, firstNameLastName:64242358264673623325}         &lt;br /&gt;msExchUMEnabledFlags2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : -1         &lt;br /&gt;msExchUserAccountControl&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 0         &lt;br /&gt;msExchVersion&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 44220983382016         &lt;br /&gt;msExchWhenMailboxCreated&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 29/04/2012 11:34:09&lt;/i&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The above list is what you see under normal circumstances. However, it is possible that a user&amp;rsquo;s mailbox gets &amp;ldquo;disconnected&amp;rdquo; from the user&amp;rsquo;s object. This means that the User Object and the Exchange Mailbox are no longer &amp;lsquo;linked&amp;rsquo; together. There are two ways this can happen:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When you disable a user&amp;rsquo;s mailbox, the Exchange mailbox itself does not get deleted immediately. The mailboxes are retained in the environment for the duration of the deleted mailbox retention period (by default 30 days) unless you permanently delete the mailbox deliberately. &lt;/li&gt;
&lt;li&gt;Whenever a soft-delete occurs. This is usually the case where a user&amp;rsquo;s mailbox is moved from one database to another. After the move, Exchange will not delete the source mailbox from the source database. Instead, it will mark the source mailbox as &amp;ldquo;soft-deleted&amp;rdquo;. Just as with disabled mailboxes, they are kept within the database for the duration of the deleted mailbox retention period unless deleted permanently on purpose.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Whenever a user&amp;rsquo;s mailbox is disconnected the user account attributes also change. For example: disabling a user&amp;rsquo;s mailbox might result in only the following attributes still having a value: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;i&gt;msExchAddressBookFlags&amp;nbsp;&amp;nbsp; : 1        &lt;br /&gt;msExchBypassAudit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False         &lt;br /&gt;msExchProvisioningFlags&amp;nbsp; : 0         &lt;br /&gt;msExchUMDtmfMap&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : {emailAddress:6484, lastNameFirstName:64242358264673623325, firstNameLastName:64242358264673623325}         &lt;br /&gt;msExchWhenMailboxCreated : 29/04/2012 11:34:09&lt;/i&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As you can see neither msExchangeHomeServerName or msExchangeMailboxGuid are present. These attributes represent the user&amp;rsquo;s mailbox and the Exchange server where the mailbox is located. They are unique to a mail-enabled account. But because it&amp;rsquo;s disabled, the values are now empty.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note&amp;nbsp;&amp;nbsp; &lt;/b&gt;to retrieve these attributes using PowerShell, you can e.g. run the following command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;color:#000000;"&gt;Get-ADUser &amp;lt;username&amp;gt; &amp;ndash;properties *&amp;nbsp; | Select-Object MSExch*&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Retrieving Disconnected Mailboxes&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Disconnected mailboxes show up in the Disconnected Mailboxes container under Recipient Management in the Exchange Management Console:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_11B1FD3A.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0373844A.png" border="0" height="83" width="565" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Although this is the easiest way to identify any existing disconnected mailboxes, the Management Console is limited in the actions that you can perform on these mailboxes. For the remainder of this article, I&amp;rsquo;ll continue showing how you can work with disconnected mailboxes from the Exchange Management Shell.&lt;/p&gt;
&lt;p&gt;To retrieve a list of disconnected mailboxes using PowerShell, you must run the following command. This command will only return mailboxes that have been disabled.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/8a5a6eb9-4a75-47f9-ae3b-a3ba251cf9a8(EXCHG.141).aspx"&gt;&lt;span style="font-family:Courier New;"&gt;Get-Mailbox&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Courier New;"&gt; | &lt;/span&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/cec76f70-941f-4bc9-b949-35dcc7671146(EXCHG.141).aspx"&gt;&lt;span style="font-family:Courier New;"&gt;Get-MailboxStatistics&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Courier New;"&gt; | ? {$_.DisconnectReason &amp;ndash;eq &amp;ldquo;Disabled&amp;rdquo;}&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Retrieving a list of &lt;span style="text-decoration:underline;"&gt;all&lt;/span&gt; disconnected mailboxes is a bit more &amp;ldquo;tricky&amp;rdquo;. You could either combine to conditions:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/8a5a6eb9-4a75-47f9-ae3b-a3ba251cf9a8(EXCHG.141).aspx"&gt;&lt;span style="font-family:Courier New;"&gt;Get-Mailbox&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Courier New;"&gt; | &lt;/span&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/cec76f70-941f-4bc9-b949-35dcc7671146(EXCHG.141).aspx"&gt;&lt;span style="font-family:Courier New;"&gt;Get-MailboxStatistics&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Courier New;"&gt; | ? {($_.DisconnectReason &amp;ndash;eq &amp;ldquo;Disabled&amp;rdquo;) &amp;ndash;or ($_.DisconnectReason &amp;ndash;eq &amp;ldquo;SoftDeleted&amp;rdquo;)}&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;b&gt;Additional Info&lt;/b&gt;&amp;nbsp;&amp;nbsp; MVP Mike Pfeiffer created a &lt;a href="http://www.mikepfeiffer.net/2010/06/managing-disconnected-exchange-mailboxes-with-powershell/"&gt;script&lt;/a&gt; that uses a slightly different approach: instead of looking at DisconnectReason, it will rather look at the &amp;ldquo;DisconnectDate&amp;rdquo; attribute. If the attribute contains a value, the mailbox is considered in a disconnected state (no matter how it got disconnected). &lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note&amp;nbsp;&amp;nbsp; &lt;/b&gt;It is entirely possible that not all disconnected mailboxes show up when running the commands above: if you disabled the mailbox only recently, it might be possible that the mailbox isn&amp;rsquo;t marked as disconnected in the Exchange store yet. To &amp;ldquo;force&amp;rdquo; the detection of disconnected mailboxes, you would then use the &lt;a href="http://technet.microsoft.com/EN-US/library/a68d31b6-4f32-4a73-b9d9-5d5a6fc1c2f0(EXCHG.141).aspx"&gt;Clean-Mailboxdatabase&lt;/a&gt; command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Clean-MailboxDatabase &amp;ndash;Identity &amp;lt;mailboxdatabase&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Working with Disconnected mailboxes&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;In case of a disabled mailbox, there are three actions that you can perform:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Connect it to an existing user account in Active Directory &lt;/li&gt;
&lt;li&gt;Restore it to a new or existing user account in Active Directory &lt;/li&gt;
&lt;li&gt;Permanently delete it from the Exchange mailbox database &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;On mailboxes that are in a soft-deleted state, you can only perform the following two actions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Restore the mailbox &lt;/li&gt;
&lt;li&gt;Permanently delete it from the Exchange mailbox database &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Reconnecting disconnected mailboxes&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;By default, when running the &lt;a href="http://technet.microsoft.com/EN-US/library/48757062-abe5-4c61-acc5-5884569c1d8b(EXCHG.141).aspx"&gt;Connect-Mailbox&lt;/a&gt; command, the disconnected mailbox will be reconnected to the matching user account. Alternatively, you can also use the &lt;a href="http://technet.microsoft.com/EN-US/library/0b67defd-3c6c-4470-acfa-7f22a6c1d2bd(EXCHG.141).aspx"&gt;New-MailboxRestoreRequest&lt;/a&gt; command which is only available through the EMS. The latter will leverage the Mailbox Replication Service (MRS) to recover mailbox data from the mailbox into an existing, connected, mailbox.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note&amp;nbsp;&amp;nbsp; &lt;/b&gt;you can only reconnect a mailbox using Connect-Mailbox to a user account that has currently no mailbox connected.&lt;/p&gt;
&lt;p&gt;To reconnect a mailbox, run the following command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Connect-Mailbox &amp;ndash;Identity &amp;lt;identity&amp;gt; &amp;ndash;Database &amp;lt;database&amp;gt; &amp;ndash;user &amp;lt;user&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3813E085.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_44355AAC.png" border="0" height="105" width="610" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Restoring disconnected mailboxes&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Restoring a disconnected mailbox is different from reconnecting one. Instead of reconnecting the mailbox to a user accounts that does not have a mailbox it will use MRS to copy contents from the disconnected mailbox into a target mailbox. Note that this is also your only option in case of a soft-deleted mailbox. They cannot be reconnected using the connect-mailbox command.&lt;/p&gt;
&lt;p&gt;You will need to have the correct permissions (Recipient Provisioning Permissions) in order to run this command. For more information, please have a look here: &lt;a title="http://technet.microsoft.com/en-us/library/dd638132.aspx" href="http://technet.microsoft.com/en-us/library/dd638132.aspx"&gt;http://technet.microsoft.com/en-us/library/dd638132.aspx&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;a href="http://technet.microsoft.com/en-us/library/ff829875.aspx"&gt;New-MailboxRestoreRequest&lt;/a&gt; &amp;ndash;SourceDatabase &amp;lt;database&amp;gt; &amp;ndash;SourceStoreMailbox &amp;lt;disconnectedmailbox&amp;gt; &amp;ndash;TargetMailbox &amp;lt;targetmailbox&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_03930E3D.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_3C3DB84A.png" border="0" height="263" width="620" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;b&gt;Note&amp;nbsp;&amp;nbsp; &lt;/b&gt;if you are restoring to an alternate user account, the command will throw an error (see screenshot for more details). In that case, you will need to add the &amp;ndash;AllowLegacyDNMismatch parameter in order to complete the command successfully. The check whether or not the LegacyDN matches on both source and target mailbox is performed is to prevent you to accidentally restore the mailbox to the wrong target mailbox.&lt;/p&gt;
&lt;p&gt;Optionally, you can also restore a disconnected mailbox to an archive mailbox:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;New-MailboxRestoreRequest &amp;ndash;SourceDatabase &amp;lt;database&amp;gt; &amp;ndash;SourceStoreMailbox &amp;lt;mailboxGuid&amp;gt; &amp;ndash;TargetMailbox &amp;lt;targetmailbox&amp;gt; &amp;ndash;TargetIsArchive&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As you can see from this command, the parameter &amp;ldquo;-TargetIsArchive&amp;rdquo; is used to determine that we&amp;rsquo;re restoring an archive.&lt;/p&gt;
&lt;p&gt;From an end-user perspective, he (or she) will see the contents from the disconnected mailbox merged into the existing mailbox. Using different switches with the New-MailboxRestoreRequest command, you can control what and where mails are restored. For more information, please visit: &lt;a title="http://technet.microsoft.com/en-us/library/ff829875.aspx" href="http://technet.microsoft.com/en-us/library/ff829875.aspx"&gt;http://technet.microsoft.com/en-us/library/ff829875.aspx&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Permanently Deleting a Disconnected Mailbox&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;To permanently remove a disconnected mailbox, you use either the &lt;a href="http://technet.microsoft.com/EN-US/library/0477708c-768c-4040-bad2-8f980606fcf4(EXCHG.141).aspx"&gt;Remove-Mailbox&lt;/a&gt; or &lt;a href="http://technet.microsoft.com/EN-US/library/d5cb00f2-f475-45cf-b72e-0962e5eed070(EXCHG.141).aspx"&gt;Remove-StoreMailbox&lt;/a&gt; command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To remove both the mailbox and user account immediately, run the following command:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Remove-Mailbox &amp;ndash;Identity &amp;lt;mailbox&amp;gt; &amp;ndash;Permanent $true&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Alternatively, you can remove a previously disconnected mailbox using the following command:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;a href="http://technet.microsoft.com/en-us/library/gg181092.aspx"&gt;Remove-StoreMailbox&lt;/a&gt; &amp;ndash;Database &amp;lt;database&amp;gt; &amp;ndash;Identity &amp;lt;name&amp;gt; &amp;ndash;MailboxState &amp;lt;SoftDeleted/Disabled&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;&amp;nbsp;&amp;nbsp; the identity of the mailbox to be deleted can either be the mailbox&amp;#39;s name or GUID.&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Personal Archives&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Personal Archives behave quite similar to regular mailboxes. When an archive is disabled, it also becomes disconnected and it will also remain in the database until the deleted mailbox retention period has elapsed. The process of reconnecting a personal archive is also pretty similar to reconnecting a regular disconnected mailbox:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Connect-Mailbox &amp;ndash;Identity &amp;lt;name or Guid&amp;gt; &amp;ndash;Archive &amp;ndash;User &amp;lt;user&amp;gt; &amp;ndash;Database &amp;lt;database&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note the &amp;ndash;Archive switch. Adding this parameter &amp;lsquo;tells&amp;rsquo; the command that you&amp;rsquo;re reconnecting an archive.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note&amp;nbsp;&amp;nbsp; &lt;/b&gt;you cannot reconnect an archive to another user. It must be reconnected to the user it was previously connected to.&lt;/p&gt;
&lt;h3&gt;&lt;span style="font-weight:bold;"&gt;Conclusion&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;This concludes the first part of this article in which we covered the most important actions regarding Disconnected Mailboxes. In the next part of this article we are going to have a look at what you can do with Disconnected Mailboxes in Office 365 and/or a hybrid deployment.&lt;/p&gt;
&lt;p&gt;For more information on Disconnected Mailboxes, have a look at the following TechNet-article: &lt;a title="http://technet.microsoft.com/en-us/library/bb232039.aspx" href="http://technet.microsoft.com/en-us/library/bb232039.aspx"&gt;http://technet.microsoft.com/en-us/library/bb232039.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1443" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Archiving/default.aspx">Archiving</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Mailbox/default.aspx">Mailbox</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+Management+Shell/default.aspx">Exchange Management Shell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Disconnected/default.aspx">Disconnected</category></item><item><title>PowerShell 101 – bulk actions with PowerShell</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2012/03/05/powershell-101-bulk-actions-with-powershell.aspx</link><pubDate>Sun, 04 Mar 2012 23:05:03 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1369</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1369</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2012/03/05/powershell-101-bulk-actions-with-powershell.aspx#comments</comments><description>&lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Introduction&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;As a consultant, I’m frequently confronted with all sorts of questions. Some of them have already been subject of one of my posts, but there’s still the number one questions that I haven’t blogged about: how do you perform bulk-actions via PowerShell? Microsoft is screaming: “Learn PowerShell” for quite a while now, still a lot of IT Pro’s haven’t found their way to it yet. Mostly this is because they’re not confronted with PowerShell yet or – so I have been told – the learning-curve to start with PowerShell is quite steep.&lt;/p&gt;  &lt;p&gt;I must admit that when I was first facing PowerShell I thought to myself: how on earth am I going to grasp this. Only to find myself a short while later working almost exclusively in PowerShell. The only thing to get you going are some of the key concepts and a good will. The rest will follow automatically.&lt;/p&gt;  &lt;p&gt;In this article I will go through some of the basics that you will need to perform most common (bulk) actions.&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Pipeline&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;PowerShell is all about (.NET) objects. Every cmdlet you run, will return objects. These object can either be attributed to a variable (e.g. in a script) or they can be sent through “the pipeline” to another cmdlet which will use those objects as input for processing. Let’s use an example to clarify things:&lt;/p&gt;  &lt;p&gt;The cmdlet &lt;a href="http://technet.microsoft.com/EN-US/library/8a5a6eb9-4a75-47f9-ae3b-a3ba251cf9a8(EXCHG.141).aspx"&gt;Get-Mailbox&lt;/a&gt; will return a list of all mailboxes in your organization:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_2C08A35C.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_12A0A022.png" width="387" height="98" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;For styling-purposes, I omitted a part of the results from the screenshot.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Now, let’s say you would want to change the quota for all of these mailboxes, you could simply “pipe” the results to another cmdlet. For instance, you would want to change the ProhibitSendQuota for each mailbox to 3GB:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Get-Mailbox | &lt;/font&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/a0d413b9-d949-4df6-ba96-ac0906dedae2(EXCHG.141).aspx"&gt;&lt;font color="#0000ff" face="Courier New"&gt;Set-Mailbox&lt;/font&gt;&lt;/a&gt;&lt;font color="#0000ff" face="Courier New"&gt; –ProhibitSendQuota 3GB&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3D790434.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_64471A74.png" width="472" height="62" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;A quick check (Get-Mailbox) will indeed confirm the settings has been changed for each mailbox:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_241100FA.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_7CD6B7C4.png" width="505" height="119" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As you can see, sending object through the pipeline is relatively simple. We will come back to this a bit later when we will be bulk-importing users.&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Filtering&lt;/font&gt;&lt;/h3&gt;        &lt;p&gt;There are a few ways of filtering the results of a cmdlet in PowerShell: you could use the –Filter parameter that is available with some cmdlets or you pipe the results from your cmdlet to a where-clause. The difference between both is that using the filter-parameter will actually narrow down the scope of the cmdlet which results in less objects returned in the output, whereas the other method will return all object after which they are filtered by the where-clause. Therefore the first approach usually consumes less resources as fewer results are actually returned. Let’s use the example where we want only mailboxes returned that have a specific value in a custom attribute.   &lt;br /&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Using the filter-parameter:     &lt;br /&gt;&lt;font color="#0000ff" face="Courier New"&gt;Get-Mailbox –Filter {CustomAttribute1 –eq “Example”}&lt;/font&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_31771400.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_754B4857.png" width="465" height="121" /&gt;&lt;/a&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Using the where-clause after the pipeline:     &lt;br /&gt;&lt;font color="#0000ff" face="Courier New"&gt;Get-Mailbox | &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=113423"&gt;&lt;font color="#0000ff" face="Courier New"&gt;Where-Object&lt;/font&gt;&lt;/a&gt;&lt;font color="#0000ff" face="Courier New"&gt; {$_.CustomAttribute1 –eq “Example”}&lt;/font&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_14FA2220.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_1BAD2BA3.png" width="472" height="115" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;As you can see, the results for both cmdlets are identical. To clarify the results, I also added &lt;font color="#0000ff" face="Courier New"&gt;“| FT Name,CustomAttribute1&lt;/font&gt;” to the cmdlet. This sends the results from previous cmdlets through the pipeline where they are formatted. FT stands for &lt;a href="http://go.microsoft.com/fwlink/?LinkID=113303"&gt;Format-Table&lt;/a&gt;. This will format the results in a table. By specifying properties immediately behind the Format-Table, I limited the output to only those properties. For more information on formatting the output of a cmdlet, have a look here: &lt;a title="Using Format Commands to Change Output View" href="http://technet.microsoft.com/en-us/library/dd347677.aspx"&gt;Using Format Commands to Change Output View&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To filter results, in this example, I the “-eq” operator which stands for “equals”. There are other operators that you could use as well. More information can be found through the PowerShell help: ‘&lt;a href="http://go.microsoft.com/fwlink/?LinkID=113316"&gt;&lt;font face="Courier New"&gt;Get-Help&lt;/font&gt;&lt;/a&gt;&lt;font face="Courier New"&gt; About_Operators’&lt;/font&gt;,&amp;#39; ‘&lt;font face="Courier New"&gt;Get-Help About_Logical_Operators’&lt;/font&gt; and ‘&lt;font face="Courier New"&gt;Get-Help About_Comparison_Operators’&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Passwords&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;PowerShell treats passwords a bit different than most other object. Passwords obviously need to be secure. Usually, when a cmdlet allows you to provide a password (e.g. New-ADUser or New-Mailbox) it requires that the value for that property is a secured string (not just plain text).&lt;/p&gt;  &lt;p&gt;Entering the following would just not work. I will omit all other parameters, just for clarity:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;New-Mailbox –Password “thisisthepassword”&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In order to get “around” this, you can do either of the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Leverage the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=113311"&gt;Get-Credential&lt;/a&gt; cmdlet:      &lt;br /&gt;      &lt;br /&gt;&lt;font color="#0000ff" face="Courier New"&gt;New-Mailbox –Password (Get-Credential).password       &lt;br /&gt;        &lt;br /&gt;        &lt;p&gt;&lt;font color="#000000" face="Calibri"&gt;Alternatively, you could assign the password to a variable and use that variable in the cmdlet:           &lt;br /&gt;&lt;/font&gt;          &lt;br /&gt;$password = (Get-Credential).Password          &lt;br /&gt;&lt;/p&gt;       &lt;font color="#0000ff" face="Courier New"&gt;$New-Mailbox –Password $password         &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Courier New"&gt;         &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_22603526.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_343CC8F3.png" width="244" height="189" /&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;font face="Calibri"&gt;&lt;font color="#000000"&gt;Use&lt;/font&gt; &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=113291"&gt;&lt;font face="Calibri"&gt;ConvertTo-Securestring&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;:         &lt;br /&gt;&lt;/font&gt;        &lt;br /&gt;New-Mailbox –Password (ConvertTo-SecureString –AsPlainText “Password” –Force)&lt;/font&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt; The first approach is more secure as you will be prompted to enter credentials (=password not visible). The second approach requires you to write down the password in clear text in the script and makes it visible to anyone who can read the script.&lt;/em&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt; &lt;/ol&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Example: Bulk importing&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;One of the tasks that PowerShell significantly facilitates is bulk importing objects like e.g. users. Using the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=113341"&gt;Import-CSV&lt;/a&gt; cmdlet, PowerShell allows you to easily import contents from a CSV file. Let’s say we would like to bulk-import a couple of new users. First, we start off by creating a new (simple) CSV file. The &lt;a href="http://technet.microsoft.com/EN-US/library/42dbb25a-0b23-4775-ae15-7af62c089565(EXCHG.141).aspx"&gt;New-Mailbox&lt;/a&gt; cmdlet (which we will be using to create a new mailbox) has some required parameters which we will add to the CSV file. The only one we’re not adding right now is the password because it would be entered in clear text in the CSV-file and therefore be visible to everyone who opens the CSV:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;FirstName,LastName,UserPrincipalName&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;User1,Test,user1@domain.com       &lt;br /&gt;User2,Test,user2@domain.com        &lt;br /&gt;…&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now, import the CSV:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Import-CSV &amp;lt;path_to_csv&amp;gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_68DD252E.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_41A2DBF9.png" width="521" height="90" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;u&gt;Note:&lt;/u&gt; PowerShell recognizes that you’re trying to import objects and will create an object per line in your CSV file. &lt;/p&gt;  &lt;p&gt;We still haven’t actually created new mailboxes right now. In order to create new mailboxes, we need to do something with the objects from the CSV file. By piping the results from the Import-Csv cmdlet to the New-Mailbox cmdlet we will create new mailboxes:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Import-Csv &amp;lt;path_to_csv&amp;gt; | &lt;a href="http://go.microsoft.com/fwlink/?LinkID=113300"&gt;Foreach-Object&lt;/a&gt; {New-Mailbox &amp;lt;parameters&amp;gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;How does PowerShell know what value to give to what property for the new mailbox? Actually, you will have to tell PowerShell which properties to use. You do this by assigning a property that went through the pipeline to an attribute of the New-Mailbox cmdlet.    &lt;br /&gt;For instance:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Import-Csv &amp;lt;path_to_csv&amp;gt; | Foreach-Object {New-Mailbox –FirstName $_.&amp;lt;propertyname&amp;gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The names of the properties are the headers that you used in your CSV file (make sure that your headers do not contain spaces). In the example from above this would be FirstName, Lastname and UserPrincipalName:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Import-Csv c:\import.csv | Foreach-Object {New-Mailbox –FirstName $_.FirstName}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt; The “$_” refers to the object that is currently being passed through the pipeline. Each line in your CSV file is represented by an object (PowerShell automatically creates an object for each line). The values you’ve provided in your CSV are the properties for that given object.Thus, $_.FirstName stands for the property with name “FirstName” of the object that is currently coming through the pipeline. In this example this is either User1 or User2.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;When we bring things together, we would get the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Import-Csv c:\import.csv | Foreach-Object {New-Mailbox –FirstName $_.FirstName –LastName $_.LastName –UserPrincipalName $_.UserPrincipalName}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt; sometimes you’ll see something like this: &lt;font color="#0000ff" face="Courier New"&gt;Import-Csv &amp;lt;csv&amp;gt; | &lt;strong&gt;foreach&lt;/strong&gt;{&amp;lt;action&amp;gt;}&lt;/font&gt; or even &lt;font color="#0000ff" face="Courier New"&gt;Import-Csv &amp;lt;csv&amp;gt; | &lt;strong&gt;%&lt;/strong&gt;{&amp;lt;action&amp;gt;}&lt;/font&gt;. Both “foreach” and “ %” are abbreviations for Foreach-Object. You can also abbreviate Where-Object with either “where” or “?”.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;We’re not completely there yet. We’re still missing Name and Password.&lt;/p&gt;  &lt;p&gt;The Name-property specifies the user’s name as it will appear in Active Directory Users and Computers and on the Recipient Properties and User Information tab. In this example we’ll combine the user’s first name and last name by assigning these values to a new variable:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;$name = $_.FirstName+” “$_.LastName&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The password – as explained before requires a somewhat different approach. We will create a new variable and assign a password to it:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;$password = (Get-Credential).password&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt; If we would use the Get-Credential cmdlet within the foreach-loop, we would be prompted for a password for each new object that passes through the pipeline. In our example that would only be two times, but imagine importing a few hundred items…&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Bringing everything together generates the following script:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;$password = (Get-Credential).password&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Import-Csv c:\import.csv | Foreach-Object{&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; $name = $_.Firstname+” “+$_.LastName&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; New-Mailbox –Name $name –FirstName $_.FirstName –LastName $_.LastName –UserPrincipalName $_.UserPrincipalName –Password $password&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1369" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Exchange 2010: User Permission Enumeration Script</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2012/02/27/exchange-2010-permissions-enumeration-script.aspx</link><pubDate>Mon, 27 Feb 2012 21:40:09 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1361</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1361</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2012/02/27/exchange-2010-permissions-enumeration-script.aspx#comments</comments><description>&lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Introduction&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;Recently, someone asked me if it was possible to get an overview of all the permissions one might have been granted on other mailboxes. The first thing that popped up in my mind was to use the &lt;a href="http://technet.microsoft.com/EN-US/library/56bcc678-1598-4c9b-8b4f-4fa11c89ec41(EXCHG.141).aspx"&gt;Get-MailboxPermission&lt;/a&gt; cmdlet, but soon I realized there were some limitations.&lt;/p&gt;  &lt;p&gt;First of all, the cmdlet appears to only take into consideration explicitly granted permission. Thus if a user would be granted access through means of a group, those permissions would not show up. Secondly, the cmdlet would not return all permissions one might have over a mailbox. To overcome that, I would also need to run the &lt;a href="http://technet.microsoft.com/EN-US/library/f20251dc-ab54-4dd5-b80c-de0808fd4dc2(EXCHG.141).aspx"&gt;Get-AdPermission&lt;/a&gt; cmdlet.&lt;/p&gt;  &lt;p&gt;As you will notice, the script is not very performing. One might ask why I created it then. Well, first of all there was the question that got me to write the script. And secondly (probably the most important reason) was that I wanted to prove that PowerShell could handle virtually anything. I hope by sharing this script, you maybe pick up some ideas or learn a few tricks. Either way, there’s still a lot room left for improvement and I’m eagerly awaiting your feedback. If you have any comments, suggestions or you found a bug: please let me know!&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;The Script&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;The script will&amp;#160; create a HTML-report listing either all Mailbox- or all AD Permissions (on a mailbox) for a given user. The script will also take into account that permissions might have been granted through group membership. However; this currently goes only one level deep. Groups that are within the top-level group are disregarded.&lt;/p&gt;  &lt;p&gt;You can download the script from here: &lt;a title="http://www.pro-exchange.be/media/p/1362.aspx" href="http://www.pro-exchange.be/media/p/1362.aspx"&gt;http://www.pro-exchange.be/media/p/1362.aspx&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Requirements&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;Due to some restrictions, the script can – for now – only be run from an Exchange Server. It needs both the AD Module for PowerShell as well as the Exchange Management Shell. The script takes into account that the AD Module for PowerShell isn’t loaded by default and will do so – if available:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; Get-Module -ListAvailable | foreach{ if($_.Name -eq &amp;quot;ActiveDirectory&amp;quot;){$module = &amp;quot;true&amp;quot;} }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if($module -eq &amp;quot;true&amp;quot;){      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Import-Module ActiveDirectory      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; else{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // end script and notify      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Write-Output &amp;quot;This script requires AD DS Remote Server Administration Tools to be installed&amp;quot;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Exit      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;How does it work?&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;When taking a look at the logic behind the script it’s all very simple:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_575193DA.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_49131AEA.png" width="244" height="244" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;How to use the script&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;I have tried making the usage of the script as easy as possible. To be honest,&amp;#160; &lt;a href="http://www.jasonhelmick.com/"&gt;Jason Helmick&lt;/a&gt; inspired me during one of his presentations @ TechDays 2012; so that is why I chose to create a “tool”-alike script. When dot-sourcing the script, you will actually be able to start the process by running the &lt;font face="Courier New"&gt;Get-UserMailboxPermission&lt;/font&gt; cmdlet.&lt;/p&gt;  &lt;p&gt;First, dot-source the script:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;. .\Get-UserMailboxPermissions.ps1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;After doing this, the Get-UserMailboxPermission cmdlet will be available, allowing you to kick of the processing: &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff" face="Courier New"&gt;Get-UserMailboxPermission –User &amp;lt;username&amp;gt; –path &amp;lt;path_to_report&amp;gt; –query &amp;lt;AD/Mailbox&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000"&gt;About the arguments:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font color="#000000"&gt;The &lt;em&gt;User&lt;/em&gt;-parameter is used to indicate which user you want to look for permissions for. In other words: “what permissions does this user have on all other mailboxes?”. Enter a users’ alias here.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#000000"&gt;The &lt;em&gt;Path&lt;/em&gt;-parameter is just the location where the report will be stored. It only needs a path as the filename is – at this time – chosen by the script.&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#000000"&gt;The &lt;em&gt;Query&lt;/em&gt;-parameter is used to indicate whether to look for mailbox permissions or for AD permissions on mailboxes. Hence either to use “AD” or “Mailbox”.&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font color="#000000"&gt;Running &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=113316"&gt;&lt;font color="#000000"&gt;Get-Help&lt;/font&gt;&lt;/a&gt;&lt;font color="#000000"&gt; Get-UserMailboxPermission will provide you with more information about the script:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_0F418399.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_6EBA43E6.png" width="531" height="221" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;The result&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;After processing, a HTML-report is generated which provides you with a table that lists all the users’ permissions for other mailboxes. Different colors are used to indicate whether a permission was granted (or denied) explicitly or through group membership:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_0E691DAF.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_394181C1.png" width="530" height="223" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Performance&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;Unfortunately (but not totally unexpected) the script is not very performing. This is largely due to the fact that it will enumerate &lt;u&gt;all&lt;/u&gt; permissions for &lt;u&gt;all&lt;/u&gt; mailboxes. It goes without saying that the more mailboxes you have, the more time it will take to process. As a reference: I used the script in a medium-sized environment with about 750 mailboxes and it took a little over a half our to complete processing the mailbox permissions. Given the fact that going through the AD permissions is an even bigger task, one might expect that it could run well over a few hours. However; at this point I haven’t been able to test the report for AD-permissions on such a scale yet. I expect it to run at least twice as long (if not even longer…).&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;      &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;The future&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;I’m planning on continuing to develop this script and maybe add some features over time. &lt;/p&gt;  &lt;p&gt;The next release I should have fixed/added:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Allow the user-argument to accept values from the pipeline&lt;/li&gt;    &lt;li&gt;Combine both AD- and mailbox permissions in a single report&lt;/li&gt;    &lt;li&gt;Better error handling&lt;/li&gt;    &lt;li&gt;….&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Don’t forget to check back regularly for updates!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1361" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>The Exchange 2010 Scripts</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/12/18/the-exchange-2010-scripts.aspx</link><pubDate>Sun, 18 Dec 2011 20:58:41 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1275</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1275</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/12/18/the-exchange-2010-scripts.aspx#comments</comments><description>&lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Introduction&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;Both Exchange 2007 and Exchange 2010 are accompanied by a bunch of pre-created scripts that allow you to perform various tasks ranging from configuring some extra services to some basic reporting. These scripts reside in a “scripts”-folder within the Exchange installation folder and can easily be reached using the “$exscripts”-variable (which contains the path to the folder) from the Exchange Management Shell:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_6B8F1AF6.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_4454D1C1.png" width="475" height="69" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Almost every Service Pack that was released introduced some new scripts. Because Exchange 2010 SP2 recently hit the road, I decided to create an overview of the new scripts that shipped with it along with the existing ones. In the overview I will try to gather the available information and explain the script’s purpose. I will also try to keep this list up to date if newer scripts would be released in the future.&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;Did you know?&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;The TechNet website offers a lot of scripts with various purposes that can be used with different versions of Exchange. The repository contains scripts from both the MS Exchange Team as other Exchange professionals and are freely available for download. Check out the &lt;a href="http://gallery.technet.microsoft.com/scriptcenter/site/search?f%5B0%5D.Type=RootCategory&amp;amp;f%5B0%5D.Value=Exchange&amp;amp;f%5B0%5D.Text=Exchange&amp;amp;f%5B1%5D.Type=SubCategory&amp;amp;f%5B1%5D.Value=exchange2010&amp;amp;f%5B1%5D.Text=Exchange%202010&amp;amp;f%5B2%5D.Type=User&amp;amp;f%5B2%5D.Value=The%20Exchange%20Team&amp;amp;f%5B2%5D.Text=The%20Exchange%20Team"&gt;TechNet Script Repository&lt;/a&gt; for more fancy scripts!&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight:bold;"&gt;The “stars” of the scripts folder&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;The following list contains all scripts from the Exchange 2010 Scripts folder with information I gathered from various resources (mostly TechNet) as well as personal experiences. Sources and additional information are always mentioned under “More information:”&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;&lt;b&gt;Purpose&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;AddReplicaToPFRecursive.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script will add replicas to existing Public Folders and is often used during migrations from one Exchange version to another (e.g. Exchange 2003 to Exchange 2010).&lt;/p&gt;          &lt;p&gt;To execute the script, use the following syntax:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;AddReplicaToPFRecursive.ps1 –Server &amp;lt;oldservername&amp;gt; –ServerToAdd &amp;lt;newservername&amp;gt; –TopPublicFolder &amp;lt;pfname&amp;gt;&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;AddUsersToPFRecursive.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script will add user permissions to Public Folders.            &lt;br /&gt;            &lt;br /&gt;&lt;i&gt;&lt;u&gt;Note:&lt;/u&gt; &lt;/i&gt;If you use the script, but a user has already access to a specific Public Folder, the script will throw a warning.             &lt;br /&gt;&lt;i&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/i&gt; &lt;a href="http://technet.microsoft.com/en-us/library/aa998834.aspx"&gt;http://technet.microsoft.com/en-us/library/aa998834.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;AggregatePFData.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;The script aggregates and captures information collected from three cmdlets:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Get-PublicFolderItemStatistics &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Get-PublicFolderStatistics &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Get-PublicFolder &lt;/em&gt;&lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;The following information is aggregated at the public folder level, and not at the item level:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Last user access and last user modification times &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Owner of the public folder &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Properties such as MailEnabled, HasRules, ItemCount, FolderType, HasModerator, and TotalItemSize&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;         &lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/ee633474.aspx" href="http://technet.microsoft.com/en-us/library/ee633474.aspx"&gt;http://technet.microsoft.com/en-us/library/ee633474.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;AntispamCommon.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script is referenced by other anti-spam scripts in Exchange 2007 and is not intended to be used directly. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CheckDatabaseRedundancy.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;Checks the redundancy of databases by validating that they have at least N configured and &amp;quot;healthy&amp;quot; copies. Active and passive copies are both counted.&lt;/p&gt;          &lt;p&gt;           &lt;br /&gt;To use this script you need to provide either $MailboxDatabaseName or $MailboxServerName.To generate events for Monitoring, you need to provide -MonitoringContext switch.&lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; This scripts will only provide an output if a DAG is present in the environment.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CheckInvalidRecipients.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script is designed to return information on invalid recipient objects and possible attempt to fix them.            &lt;br /&gt;            &lt;br /&gt;The script will attempt to fix two classes of errors:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;u&gt;Primary SMTP Address Problems:&lt;/u&gt;&amp;#160;&amp;#160;&amp;#160; If a recipient has multiple SMTP addresses listed as primary or the primary SMTP is invalid, the script will try to set the WindowsEmailAddress as the primary SMTP address, since that is the address Exchange 2003 would have recognized as the primary (although E12 does not) &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;&lt;u&gt;Distribution Group Hidden Membership:&lt;/u&gt;&amp;#160;&amp;#160;&amp;#160; If a distribution group has HideDLMembershipEnabled set to true, but ReportToManagerEnabled, ReportToOriginatorEnabled and/or SendOofMessageToOriginatorEnabled are set to true, then the membership is not actually securely hidden. The script will set ReportToManagerEnabled, ReportToOriginatorEnabled and SendOofMessageToOriginatorEnabled to false to fix the distribution group.&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; to automatically try fixing reported problems, the –FixErrors switch needs to be provided.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CITSConstants.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This file contains global constants used by CI Troubleshooter library&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CITSLibrary.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This file contains Content Index Troubleshooter functions&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CITSTypes.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This file contains additional types used by CI troubleshooter library&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CollectOverMetrics.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script reads DAG member event logs to gather information about database operations (such as database mounts, moves, and failovers) over a specific time period. For each operation, the script records the following information:&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Identity of the database &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Time at which the operation began and ended &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Servers on which the database was mounted at the start and finish of the operation &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Reason for the operation &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;If the operation was successful, including the error details if the operation failed&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;The script writes this information to .csv files with one operation per row. It writes a separate .csv file for each DAG.&lt;/p&gt;          &lt;p&gt;&lt;u&gt;&lt;em&gt;More information:&lt;/em&gt;&lt;/u&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd351258.aspx#CollectOver" href="http://technet.microsoft.com/en-us/library/dd351258.aspx#CollectOver"&gt;http://technet.microsoft.com/en-us/library/dd351258.aspx#CollectOver&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;CollectReplicationMetrics.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script provides an active form of monitoring because it collects metrics in real time, while the script is running. It collects data from performance counters related to database replication. The script gathers counter data from multiple Mailbox servers, writes each server&amp;#39;s data to a .csv file, and can then report various statistics across all of this data (for example, the amount of time each copy was failed or suspended, the average copy or replay queue length, or the amount of time that copies were outside of their failover criteria).&lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd351258.aspx#CollectRep" href="http://technet.microsoft.com/en-us/library/dd351258.aspx#CollectRep"&gt;http://technet.microsoft.com/en-us/library/dd351258.aspx#CollectRep&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;configure-SMBIPsec.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script is to be used to help add the necessary IPsec configuration to protect SMB (File Share) communication.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ConfigureAdam.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;You can use the ConfigureAdam.ps1 script in the Shell to modify the default configuration of the Active Directory Lightweight Directory Services (AD LDS) on the Edge Transport server.          &lt;br /&gt;          &lt;p&gt;After you install the Edge Transport server role, you can use the ConfigureAdam.ps1 script provided with Exchange 2010 to modify the ports and directories that AD LDS uses. The ConfigureAdam.ps1 script invokes the dsdbutil command to change the registry settings for AD LDS. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ConfigureNetworkProtocolParameters.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;Configures a Global Catalog running on the machine on which the script is run to listen on the standard NSPI Rpc-over-Http port 6004. This would enable Rpc-over-Http connections from Outlook clients to a GC, RpcProxy&amp;#39;ed by CAS boxes.&lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/bb124159(EXCHG.65).aspx" href="http://technet.microsoft.com/en-us/library/bb124159(EXCHG.65).aspx"&gt;http://technet.microsoft.com/en-us/library/bb124159(EXCHG.65).aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ConvertOABVDir.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script will convert the OAB virtual directory to an IIS web application, as well as, create a new application pool, MSExchangeOabAppPool. Converting the OAB virtual directory is necessary to support different authentication methods like Kerberos and Certificate authentication. &lt;/p&gt;          &lt;p&gt;&lt;i&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/i&gt;&lt;i&gt; &lt;/i&gt;You need to execute this script on each Client Access Server.             &lt;br /&gt;&lt;i&gt;&lt;u&gt;More Information:&lt;/u&gt;&lt;/i&gt; &lt;a href="http://gallery.technet.microsoft.com/scriptcenter/525fb1dc-b612-4998-a2d1-55f32a6c35ac"&gt;http://gallery.technet.microsoft.com/scriptcenter/525fb1dc-b612-4998-a2d1-55f32a6c35ac&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ConvertTo-MessageLatency.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script enables you to get latency information any email still in the Message Tracking Logs. This can be useful in troubleshooting scenarios where you have to deal e.g. with slow email delivery.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;DagCommonLibrary.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;A collection of DAG-related functions for use by other scripts.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;DatabaseMaintSchedule.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;Random generates maintenance and quota notification schedule time based on the specified criteria.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;DiagnosticScriptCommonLibrary.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;Library file used by scripts in the Management Pack for Exchange 2010 (SCOM)&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Disable-InMemoryTracing.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will undo the changes made by the Enable-InMemoryTracing.ps1 script.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\Disable-InMemoryTracing.ps1&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;enable-CrossForestConnector.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;When you want to establish direct mail flow with servers that are running Exchange in a different Active Directory forest, you must configure both Send- and Receive connector with.          &lt;br /&gt;          &lt;br /&gt;This script will adjust the permissions on a Send Connector (add ‘ANONYMOUS LOGON’ to the Send Connector)           &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/bb123546.aspx" href="http://technet.microsoft.com/en-us/library/bb123546.aspx"&gt;http://technet.microsoft.com/en-us/library/bb123546.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Enable-InMemoryTracing.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will enable In-Memory tracing by changing the InMemoryTracing value from $false to $true in the EnabledInMemoryTraces.config in the bin directory, found under the the Exchange Install Folder.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\Enable-InMemoryTracing.ps1&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;enable-OutlookCertificateAuthentication.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will configure the different virtual directories so that Outlook can used Smart Card Authentication.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/hh227263.aspx" href="http://technet.microsoft.com/en-us/library/hh227263.aspx"&gt;http://technet.microsoft.com/en-us/library/hh227263.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ExchUCUtil.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;Script that makes necessary changes so that OCS/Lync can read UM data from Exchange.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd572267(office.13).aspx" href="http://technet.microsoft.com/en-us/library/dd572267(office.13).aspx"&gt;http://technet.microsoft.com/en-us/library/dd572267(office.13).aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Export-OutlookClassification.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;Script that exports your message classifications so that they can be imported into Outlook. The script will generate an XML-file.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa998271.aspx" href="http://technet.microsoft.com/en-us/library/aa998271.aspx"&gt;http://technet.microsoft.com/en-us/library/aa998271.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Export-RetentionTags.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script is used in conjunction with the &lt;font face="Courier New"&gt;Import-RetentionTags.ps1&lt;/font&gt; script and exports existing Retention Policy Tags to an xml file. It has proven to be useful in deployments where also Exchange Online (Office 365) is used.&amp;#160; &lt;br /&gt;If a user applied Retention Policy Tags prior to moving his mailbox to the cloud, they need to be exported from the on-premise environment and imported to Office 365. This has to be done &lt;u&gt;prior&lt;/u&gt; to moving the mailbox.&amp;#160; &lt;br /&gt;          &lt;br /&gt;Running the script is relatively easy:           &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\Export-RetentionTags.ps1 &amp;lt;path_to_xml_file&amp;gt;&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;         &lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd297955.aspx" href="http://technet.microsoft.com/en-us/library/dd297955.aspx"&gt;http://technet.microsoft.com/en-us/library/dd297955.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamFilteringReport.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;You can run this script to draw a report for the Exchange Anti Spam Agents. The following values are accepted as command parameters:          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;messagesrejected&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;messagesdeleted&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;connections&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;messagesquarantined&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\Get-AntispamFilteringReport.ps1 &amp;lt;command&amp;gt; –report &amp;lt;path&amp;gt;&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamSCLHistogram.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will output the total number of emails calculated for every SCL Rating.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\Get-AntispamSCLHistogram.ps1&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;font color="#000000"&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa995744.aspx" href="http://technet.microsoft.com/en-us/library/aa995744.aspx"&gt;http://technet.microsoft.com/en-us/library/aa995744.aspx&lt;/a&gt;&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamTopBlockedSenderDomains.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will show you which domains have the largest share in the amount of spam sent to you.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; this information can sometimes be misleading because spammers tend to spoof real email addresses. This script cannot and does not take this into account. However, for domains that you are absolutely sure you don’t want to get emails from, this might prove very useful.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamTopBlockedSenderIPs.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will show the top 10 IP addresses that have sent you spam. This can be useful for building up a list of IP’s to blacklist.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamTopBlockedSenders.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will provide the top 10 of email addresses that have sent you spam.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamTopRBLProviders.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script can be used for “monitoring” the RBL provides that are configured for your environment. It will provide you an overview of the configured RBL’s and the amount of “hits” they have provided you with.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-AntispamTopRecipients.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will provide you with an overview of the email addresses within your organization that are prone to receiving spam.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;get-setuplog.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will “parse” the Exchangesetup.log and show it on screen in a more readable way. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Get-UCPool.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will query Active Directory and report back on any UC Pools that might have been configured for OCS/Lync&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;GetDatabaseForSearchIndex.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will return the database that is associated with a set of catalog files.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;           &lt;br /&gt;To use the script, run a &lt;a href="http://go.microsoft.com/fwlink/?LinkID=113308"&gt;Get-Childitem&lt;/a&gt; of the directory containing the catalog files and pipe it through to the script.           &lt;br /&gt;          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;Get-ChildItem &amp;lt;path&amp;gt; | GetDatabaseForSearchIndex.ps1&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;GetSearchIndexForDatabase.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script does exactly the opposite of the GetDatabaseforSearchIndex.ps1 script. It will provide you the path to the catalog files for the database you provided with the script.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; to use this script add the database name after the script. E.g.: &lt;font face="Courier New"&gt;GetSearchIndexForDatabase.ps1 “Mailbox Database”&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Import-RetentionTags.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will import Retention Tags that have previously been exported with the Export-Retentiontags.ps1 script.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;install-AntispamAgents.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will install and enable the following Anti-Spam agents on a Hub Transport Server:          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Connection filtering&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Content filtering&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Sender ID &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Sender filtering&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Recipient filtering&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Sender reputation&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; after running the script the Microsoft Exchange Transport services needs to be restarted.           &lt;br /&gt;&lt;em&gt;&lt;u&gt;For more information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/bb201691.aspx" href="http://technet.microsoft.com/en-us/library/bb201691.aspx"&gt;http://technet.microsoft.com/en-us/library/bb201691.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;LargeToken-IIS_EWS.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script was released with Exchange 2010 SP1 RU4 in order to solve the following issue:          &lt;br /&gt;&lt;a title="http://support.microsoft.com/kb/2491354" href="http://support.microsoft.com/kb/2491354"&gt;http://support.microsoft.com/kb/2491354&lt;/a&gt;           &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; This script requires PowerShell v2. It uses Remote Registry Service &amp;amp; WS-Management on E2K10 CAS Servers.&amp;#160; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;LargeToken-Kerberos.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script was also released with Exchange 2010 SP1 RU4 in order to solve the following issue:          &lt;br /&gt;&lt;a title="http://support.microsoft.com/kb/2491354" href="http://support.microsoft.com/kb/2491354"&gt;http://support.microsoft.com/kb/2491354&lt;/a&gt;           &lt;br /&gt;          &lt;br /&gt;The script will change the value for the MaxTokenSize registry key.           &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://support.microsoft.com/kb/327825" href="http://support.microsoft.com/kb/327825"&gt;http://support.microsoft.com/kb/327825&lt;/a&gt; &amp;amp; &lt;a title="http://support.microsoft.com/kb/263693" href="http://support.microsoft.com/kb/263693"&gt;http://support.microsoft.com/kb/263693&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;MailboxDatabaseReseedUsingSpares.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script is used for reference only. Executing the script will fail as a referenced library is missing. This library is actually used within Microsoft but is not available for the public.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; &lt;em&gt;A big thanks to Tonino for helping me out with this one.&lt;/em&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ManageScheduledTask.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script allows to add/modify/remove scheduled tasks through PowerShell.          &lt;br /&gt;          &lt;br /&gt;The following parameters are accepted:           &lt;br /&gt;          &lt;table border="0" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;             &lt;tr&gt;               &lt;td valign="top" width="200"&gt;                 &lt;li&gt;Install &lt;/li&gt;                  &lt;li&gt;DeleteExisting &lt;/li&gt;                  &lt;li&gt;ServerName &lt;/li&gt;                  &lt;li&gt;TaskName &lt;/li&gt;                  &lt;li&gt;PsScriptPath &lt;/li&gt;                  &lt;li&gt;PsScriptArgs &lt;/li&gt;               &lt;/td&gt;                &lt;td valign="top" width="200"&gt;                 &lt;li&gt;Uninstall &lt;/li&gt;                  &lt;li&gt;Disabled &lt;/li&gt;                  &lt;li&gt;Enable &lt;/li&gt;                  &lt;li&gt;TestExistence &lt;/li&gt;                  &lt;li&gt;RunFromSetup &lt;/li&gt;               &lt;/td&gt;             &lt;/tr&gt;           &lt;/tbody&gt;&lt;/table&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;To create a new scheduled task that will run a custom script called “custom.ps1”, run the following cmdlet:           &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;ManageScheduledTask.ps1 –Install –ServerName &amp;lt;servername&amp;gt; –PsScriptPath .\custom.ps1 –TaskName “Custom Script”&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;MigrateUMCustomPrompts.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script is used to migrate a copy of the UM custom prompts in Exchange 2007 (UM) to Exchange 2010 (UM). Custom prompts are audio files used in the Exchange UM Role that contain customized welcome-messages and –announcements.          &lt;br /&gt;          &lt;br /&gt;          &lt;p&gt;&lt;u&gt;&lt;em&gt;More information:&lt;/em&gt;&lt;/u&gt; &lt;a title="http://technet.microsoft.com/en-us/library/gg309147.aspx" href="http://technet.microsoft.com/en-us/library/gg309147.aspx"&gt;http://technet.microsoft.com/en-us/library/gg309147.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Move-TransportDatabase.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will move the Transport Database (mail.que) and log files to a new location. Next to moving the files, the script takes also care of stopping/starting the necessary services and it will create the target folder (including permissions) if it does not exist yet.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;           &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;Move-TransportDatabase –queueDatabasePath &amp;lt;path&amp;gt; –queueDatabaseLoggingPath &amp;lt;path&amp;gt;&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;MoveAllReplicas.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;When you are migrating Public Folders (e.g. when transitioning from Exchange 2003 to Exchange 2007 or 2010) all replicas must be moved off the legacy environment before you can decommission it.          &lt;br /&gt;          &lt;br /&gt;Although you could perform this action manually as well, the script will allow you to easily perform the action of moving all existing replicas to the (new) server that you define.           &lt;br /&gt;          &lt;br /&gt;&lt;u&gt;&lt;strong&gt;Usage: &lt;/strong&gt;            &lt;br /&gt;&lt;/u&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;Moveallreplicas.ps1 –server&amp;lt;sourceserver&amp;gt; -newserver&amp;lt;destinationserver&amp;gt;&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;MoveMailbox.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;By default, Exchange 2010 performs mailbox moves asynchronously. However; in some cases an Administrator might require moves to be executed synchronously. In that case ,this script can be used.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;&amp;#160; &lt;br /&gt;The script accepts pretty much the same parameters used with the &lt;a href="http://technet.microsoft.com/EN-US/library/c28ca2ce-963f-4676-81c3-cef3c290ee7b(EXCHG.141).aspx"&gt;New-MoveRequest&lt;/a&gt; cmdlet           &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;.\MoveMailbox.ps1 –Identity &amp;lt;id&amp;gt; –TargetDatabase &amp;lt;targetdb&amp;gt;&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;         &lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd876878.aspx" href="http://technet.microsoft.com/en-us/library/dd876878.aspx"&gt;http://technet.microsoft.com/en-us/library/dd876878.aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;new-TestCasConnectivityUser.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;In order to use some of the end-to-end diagnostic cmdlet in Exchange 2010, you need to create a test-user that can be used to execute the cmdlets.          &lt;br /&gt;          &lt;br /&gt;A good example where this is needed, if when you deploy System Center Operations Manager. The cmdlets executed by SCOM to check the Exchange’s health require, the test user to be present.           &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;.\New-TestCasConnectivityUser.ps1&lt;/em&gt;&lt;strong&gt;&amp;#160;&lt;/strong&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;         &lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd638082.aspx" href="http://technet.microsoft.com/en-us/library/dd638082.aspx"&gt;http://technet.microsoft.com/en-us/library/dd638082.aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Prepare-MoveRequest.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;Before you can run the New-MoveRequest to move mailboxes across forests, a mail use needs to exist in the target forest. This script will create a mail user in the target forest (based on the user in the source forest) and will also copy the AD attributes from the source object to the target object.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/ee861103.aspx" href="http://technet.microsoft.com/en-us/library/ee861103.aspx"&gt;http://technet.microsoft.com/en-us/library/ee861103.aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;RedistributeActiveDatabases.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;A Database Availability Group is an active environment in which database can (and will) be moved from one mailbox server to another for various reasons:          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Maintenance&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Failure&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Corruption&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;…&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;Over time, databases could be active on servers other than the ones that you had foreseen initially. This script will allow you to “rebalance” your active databases on servers participating in your DAG, based on the db’s activation preference.&lt;/p&gt;          &lt;p&gt;&lt;u&gt;&lt;em&gt;More information:&lt;/em&gt;&lt;/u&gt;&amp;#160;&lt;a title="http://technet.microsoft.com/en-us/library/dd335158.aspx" href="http://technet.microsoft.com/en-us/library/dd335158.aspx"&gt;http://technet.microsoft.com/en-us/library/dd335158.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Reenable-AuditLoggingAgent.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;When upgrading to Exchange 2010 SP1, in Exchange 2010 RTM, running “Setup.com /prepareAD” the Admin Audit Log Agent gets disabled. It will not be running until the installation is completed. Run this script to fix this issue. The script will roll back the msExchangeVersion of the Agent.&lt;/p&gt;          &lt;p&gt;&lt;u&gt;Note&lt;/u&gt;: the issue goes away automatically once SP1 is completely installed.&lt;/p&gt;          &lt;p&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;.\Reenable-AuditLoggingAgent.ps1&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ReinstallDefaultTransportAgents.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will reinstall the default Transport Agents for a Hub Transport or Edge Server. It can for instance be used to recover from an issue with transport agents.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font color="#0000ff" face="Courier New"&gt;&lt;em&gt;.\ReinstallDefaultTransportAgents.ps1&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;font color="#000000"&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; the MS Exchange Transport services needs to be restarted after running this cmdlet.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;RemoveReplicaFromPFRecursive.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;The script will remove a server from the replication list of a Public Folder and it’s subfolders. If the server isn’t listed, nothing is changed as well as when the server holds the only replica.&lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa997966.aspx" href="http://technet.microsoft.com/en-us/library/aa997966.aspx"&gt;http://technet.microsoft.com/en-us/library/aa997966.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;RemoveUserFromPFRecursive.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script removes a user from the client permissions list for a public folder and from all the folders beneath it in the hierarchy.          &lt;br /&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa997966.aspx" href="http://technet.microsoft.com/en-us/library/aa997966.aspx"&gt;http://technet.microsoft.com/en-us/library/aa997966.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ReplaceReplicaOnPFRecursive.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will replace a server listed as a replica by a new server for all public folders and the folders beneath it in the hierarchy. If the server to replace isn’t listed, nothing will be changed for that particular folder.          &lt;br /&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa997966.aspx" href="http://technet.microsoft.com/en-us/library/aa997966.aspx"&gt;http://technet.microsoft.com/en-us/library/aa997966.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ReplaceUserPermissionOnPFRecursive.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script replace permissions of a user in the permission list for a public folder and the folders beneath it in the hierarchy with new permissions. If no permissions for the user can be found, nothing will be changed on that particular folder.          &lt;br /&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa997966.aspx" href="http://technet.microsoft.com/en-us/library/aa997966.aspx"&gt;http://technet.microsoft.com/en-us/library/aa997966.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ReplaceUserWithUserOnPFRecursive.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script replaces a user with another user in the permissions list for a public folder or the folders beneath it in the hierarchy. If no permission entries can be found, nothing will be changed. Note that existing permissions will not be removed.          &lt;br /&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/aa997966.aspx" href="http://technet.microsoft.com/en-us/library/aa997966.aspx"&gt;http://technet.microsoft.com/en-us/library/aa997966.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Reset-AntispamUpdates.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script resets baseline antispam data to original out-of-box state          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\Reset-AntiSpamUpdates.ps1&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ResetAttachmentFilterEntry.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;This script is used to reset the list of attachment-types that are blocked by the attachment-filtering feature, to the factory set defaults. It will do this by first removing the existing entries and then adding the default ones. If needed additional filenames or extensions can be added to the script.&lt;/p&gt;          &lt;p&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;ResetAttachmentFilterEntry.ps1&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ResetCasService.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will reset and recreate the virtual directory for the service that you define.          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;             &lt;br /&gt;Usage:               &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\ResetCasService.ps1 &amp;lt;service&amp;gt; “&amp;lt;identity&amp;gt;”&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;font color="#000000"&gt;for example:&lt;/font&gt;&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\ResetCasServices.ps1 owavirtualdirectory “owa (default web site)”&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ResetSearchIndex.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will remove the Search Index Catalog associated with the specified Mailbox Database.          &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\ResetSearchIndex.ps1 &amp;lt;databasename&amp;gt;&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;font color="#000000"&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; optionally the –force parameter can be passed to the script as well. If –force is used, the script will not prompt for confirmation when deleting the Catalog directory.&lt;/font&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;ResumeMailboxDatabaseCopy.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will resume activation and log file replication (copy and replay) for the specified mailbox database.          &lt;br /&gt;          &lt;br /&gt;The script accepts the following parameters:           &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#000000" face="Courier New"&gt;Datacenter&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;&lt;font color="#000000" face="Courier New"&gt;MailboxServer&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;&lt;font color="#000000" face="Courier New"&gt;Database&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;         &lt;strong&gt;&lt;u&gt;Usage:              &lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;&lt;font color="#0000ff" face="Courier New"&gt;.\ResumeMailboxDatabaseCopy.ps1 –database &amp;lt;dbname&amp;gt;&lt;/font&gt;&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;RollAlternateServiceAccountPassword.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;         &lt;p&gt;In a setup where Kerberos Authentication is used for MAPI client connectivity, a so-called Alternative Service Account (ASA) is used. You can use this script to generate a new password for the service account and propagate it to the Client Access Servers.&lt;/p&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/ff808311.aspx" href="http://technet.microsoft.com/en-us/library/ff808311.aspx"&gt;http://technet.microsoft.com/en-us/library/ff808311.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;StartDagServerMaintenance.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;Whenever you need to do some patching on a server that is part of a DAG, there are some actions that you need to take to make sure that the node you are working on is temporarily disregarded by the DAG:          &lt;br /&gt;          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Move active databases to another DAG member &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Pause the node in the cluster &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Block the Database Copy Auto Activation on the mailbox server &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Block replication and replay activities for each database hosted by the server &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Optionally move cluster core resources to another server in the DAG&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;Instead of manually performing the tasks above, the StartDagServerMaintenance.ps1 script will perform all of the steps automatically.&lt;/p&gt;          &lt;p&gt;The script is used together with the –Servername parameter which defines what server to put in ‘maintenance mode’.&lt;/p&gt;          &lt;p&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;         &lt;u&gt;           &lt;ul&gt;             &lt;li&gt;&lt;font face="Courier New"&gt;&lt;em&gt;&lt;font color="#0000ff"&gt;StartDagServerMaintenance.ps1 –ServerName &amp;lt;servername&amp;gt;&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/li&gt;           &lt;/ul&gt;         &lt;/u&gt;&lt;u&gt;&lt;em&gt;More information:&lt;/em&gt;&lt;/u&gt;&amp;#160;&lt;a title="http://technet.microsoft.com/en-us/library/dd298065.aspx" href="http://technet.microsoft.com/en-us/library/dd298065.aspx"&gt;http://technet.microsoft.com/en-us/library/dd298065.aspx&lt;/a&gt;           &lt;br /&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;StopDagServerMaintenance.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will reverse the action performed by the StartDagServerMaintenance.ps1 script.          &lt;br /&gt;          &lt;br /&gt;More specifically, it will perform the following actions:           &lt;br /&gt;          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Run the &lt;/em&gt;&lt;a href="http://technet.microsoft.com/en-us/library/dd335220.aspx"&gt;&lt;em&gt;Resume-MailboxDatabaseCopy&lt;/em&gt;&lt;/a&gt;&lt;em&gt; cmdlet for each database copy hosted by the server &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Resume the node in the cluster &lt;/em&gt;&lt;/li&gt;            &lt;li&gt;&lt;em&gt;Re-enable Database Copy Auto Activation (sets the DatabaseCopyAutoActivationPolicy to Unrestricted)&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;This script is also run with the –Servername parameter.&lt;/p&gt;          &lt;p&gt;&lt;strong&gt;&lt;u&gt;Usage:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;          &lt;ul&gt;           &lt;li&gt;&lt;font face="Courier New"&gt;&lt;em&gt;&lt;font color="#0000ff"&gt;StopDagServerMaintenance.ps1 –ServerName &amp;lt;servername&amp;gt;&lt;/font&gt;&lt;/em&gt;&lt;/font&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;u&gt;&lt;em&gt;More information:&lt;/em&gt;&lt;/u&gt; &lt;a title="http://technet.microsoft.com/en-us/library/dd298065.aspx" href="http://technet.microsoft.com/en-us/library/dd298065.aspx"&gt;http://technet.microsoft.com/en-us/library/dd298065.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;StoreTSConstants.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This file/script stores the default settings used by the Troubleshoot-DatabaseLatency.ps1 script.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt;&lt;/em&gt; &lt;a title="http://technet.microsoft.com/en-us/library/ff798271.aspx" href="http://technet.microsoft.com/en-us/library/ff798271.aspx"&gt;http://technet.microsoft.com/en-us/library/ff798271.aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;StoreTSLibrary.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;A collection of Store Troubleshooter functions for use by other scripts like:          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;Troubleshoot-DatabaseLatency.ps1 &lt;/li&gt;            &lt;li&gt;Troubleshoot-DatabaseSpace.ps1 &lt;/li&gt;         &lt;/ul&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Troubleshoot-CI.ps1&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script monitors (and performs) troubleshooting on the Content Index catalogs. It detects and resolves the following issues:          &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Deadlocks&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Corruption&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Stalls&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Backlog&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;This troubleshooter can be used against the server or just a database, and can be used to detect as well as resolve problems. It can also be used in just a monitoring context to log warnings and failure events in the app log. &lt;/p&gt;          &lt;p&gt;For an usage example, check out on of my earlier blog posts: &lt;a title="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/11/21/troubleshooting-a-mailbox-database-copy-in-failedandsuspended-state.aspx" href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/11/21/troubleshooting-a-mailbox-database-copy-in-failedandsuspended-state.aspx"&gt;http://www.pro-exchange.be/blogs/exchange2010/archive/2011/11/21/troubleshooting-a-mailbox-database-copy-in-failedandsuspended-state.aspx&lt;/a&gt;&lt;/p&gt;         &lt;u&gt;&lt;em&gt;More information:&lt;/em&gt;&lt;/u&gt; &lt;a title="http://blogs.technet.com/b/exchange/archive/2011/01/18/3411844.aspx" href="http://blogs.technet.com/b/exchange/archive/2011/01/18/3411844.aspx"&gt;http://blogs.technet.com/b/exchange/archive/2011/01/18/3411844.aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Troubleshoot-DatabaseLatency.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script is used by System Center Operations Manager (SCOM) to detect (and correct) latency issues on a database. Alternatively you can also create a scheduled task to run this script at predefined times.          &lt;br /&gt;          &lt;br /&gt;The scripts executes the following tasks:           &lt;br /&gt;          &lt;ul&gt;           &lt;li&gt;&lt;em&gt;Checks whether database latencies are above the latency threshold of 70ms.&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Checks whether the disk&amp;#39;s transfers-per-second rate is less than the DiskReadRateThreshold performance counter and whether the disk&amp;#39;s seconds-per-transfer rate is greater than the DiskReadLatencyThreshold performance counter. If this is the case, the script determines that the disk must be replaced because it&amp;#39;s under low-load conditions but is exhibiting high latencies.&lt;/em&gt; &lt;/li&gt;            &lt;li&gt;&lt;em&gt;Checks whether a single user is using more than one thread over the last 10 minute period for longer than the value specified by the TimeInServerThreshold parameter. If this is the case, the user is likely contributing to the high latencies, and, as a result, the user&amp;#39;s mailbox is quarantined. The user&amp;#39;s mailbox is quarantined for six hours, during which the user won&amp;#39;t have access to e-mail.&lt;/em&gt; &lt;/li&gt;         &lt;/ul&gt;          &lt;p&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt; &lt;/em&gt;&lt;a title="http://technet.microsoft.com/en-us/library/ff798271.aspx" href="http://technet.microsoft.com/en-us/library/ff798271.aspx"&gt;http://technet.microsoft.com/en-us/library/ff798271.aspx&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;Troubleshoot-DatabaseSpace.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;Just as the Troubleshoot-DatabaseLatency.ps1-script, this script is used by SCOM 2007 to detect and correct any abnormal growth of either log files or database file (.edb). Alternatively, you can schedule a task to execute this script at predefined intervals.          &lt;br /&gt;          &lt;br /&gt;The script executes the following tasks:           &lt;ul&gt;           &lt;li&gt;Keeps track of log generation rate for the highest log generators per database. &lt;/li&gt;            &lt;li&gt;Keeps track of the available disk space for both the database and the log files. &lt;/li&gt;            &lt;li&gt;Keeps track of the log generation rate. If it appears that the disk is going to run out of space within the value specified by the &lt;em&gt;HourThreshold&lt;/em&gt; parameter (based on the log generation rate), further action must be taken. &lt;/li&gt;            &lt;li&gt;If all of the preceding conditions are fulfilled, the script determines the list of top 25 users who accessed the database during the last one-hour period. The script then quarantines the top high-usage mailboxes for which the sum of the log generation rate is greater than the difference between the current generation rate and the sustainable generation rate that would allow tiding over the configurable time threshold. These users are quarantined for six hours, during which they won&amp;#39;t have access to e-mail. &lt;/li&gt;            &lt;li&gt;If the troubleshooter is unsuccessful at dropping the log generation rate to below the threshold level, it will write out events that translate into health model alerts. At this point, the script removes the database from provisioning by running the &lt;a href="http://technet.microsoft.com/en-us/library/bb123971.aspx"&gt;Set-MailboxDatabase&lt;/a&gt; cmdlet with the &lt;em&gt;ExcludeFromProvisioning&lt;/em&gt; parameter set to &lt;code&gt;$true&lt;/code&gt; against the specified database. You may need to move mailboxes to a new server to rebalance space. &lt;/li&gt;            &lt;li&gt;If the troubleshooter quarantines more than 10 users, this indicates a systemic issue, which you need to follow up on. The health model will trigger an urgent alert from this condition. &lt;/li&gt;         &lt;/ul&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;More information:&lt;/u&gt; &lt;/em&gt;&lt;a title="http://technet.microsoft.com/en-us/library/ff477617.aspx" href="http://technet.microsoft.com/en-us/library/ff477617.aspx"&gt;http://technet.microsoft.com/en-us/library/ff477617.aspx&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="343"&gt;         &lt;p&gt;uninstall-AntispamAgents.ps1 &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="726"&gt;This script will reverse the actions performed by the Install-AntiSpamAgents.ps1 script and uninstall the Exchange Anti Spam Agents from the Hub Transport Server.          &lt;br /&gt;          &lt;br /&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/em&gt; the Microsoft Exchange Transport Service needs to be restarted after running this script. To verify that the transport agents have been uninstalled successfully, you can run the &lt;a href="http://technet.microsoft.com/EN-US/library/83417504-5d52-43b2-8cf5-e48acae72e3a(EXCHG.141).aspx"&gt;Get-TransportAgent&lt;/a&gt; cmdlet. Otherwise, you can also make sure that the Anti-spam tab is removed from the Exchange Management Console.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1275" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Using Exchange Web Services (EWS) to add entries in a calendar</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/11/12/using-exchange-web-services-ews-add-entries-in-a-calendar.aspx</link><pubDate>Sat, 12 Nov 2011 17:17:00 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1194</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1194</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/11/12/using-exchange-web-services-ews-add-entries-in-a-calendar.aspx#comments</comments><description>&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;A while back, I was at a customer that was looking for a way to add calendar items to all his user&amp;rsquo;s calendars. &lt;br /&gt;Calendars can easily be manipulated using Exchange Web Services. The script I created, is built upon a &lt;a target="_blank" href="http://www.mikepfeiffer.net/2011/01/creating-calendar-items-with-powershell-and-the-ews-managed-api/"&gt;script I&amp;rsquo;ve downloaded&lt;/a&gt; a while back from &lt;a target="_blank" href="http://www.mikepfeiffer.net/about/"&gt;Mike Pfeiffer&lt;/a&gt;. For instance, his script uses parameters to provide details for the entries to create in the calendars. Also, his script uses AutoDiscover to retrieve the EWS-url. However; since this wasn&amp;rsquo;t a requirement for the customer, I omitted both AutoDiscover as the input through parameters in my script.&lt;/p&gt;
&lt;h3&gt;A word on the managed API&lt;/h3&gt;
&lt;p&gt;Before &amp;lsquo;diving&amp;rsquo; a bit deeper, I just have to point out that I&amp;rsquo;m not a developer. So please &amp;ndash; bear with me &amp;ndash; if I don&amp;rsquo;t always use the 100% correct terminology &lt;img src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/wlEmoticon_2D00_winkingsmile_5F00_21674FD6.png" alt="Winking smile" class="wlEmoticon wlEmoticon-winkingsmile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;&lt;/p&gt;
&lt;p&gt;The managed API is an object model that you can use to develop applications (and scripts) that make use of the Exchange Web Services (EWS). It is significantly easier than the legacy way of interacting with Exchange like e.g. WebDAV. &lt;br /&gt;&lt;br /&gt;In November 2011, Microsoft introduced version 1.2 of the API. However, at time of writing version 1.1 is the latest version available for &lt;a target="_blank" href="http://www.microsoft.com/download/en/details.aspx?id=13480"&gt;download&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The following link provides an overview of all the features included in the API and the differences between the latest version (1.2) and earlier versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd633678(v=exchg.80).aspx" title="http://msdn.microsoft.com/en-us/library/dd633678(v=exchg.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/dd633678(v=exchg.80).aspx&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Building the solution&lt;/h3&gt;
&lt;p&gt;Before starting: if you need more information on how to use the Managed API, MSDN offers a ton of information on this topic. Have a look at the following URL and start from there: &lt;a href="http://msdn.microsoft.com/en-us/library/dd633709(v=EXCHG.80).aspx" title="Microsoft Exchange Web Services Managed API 1.2"&gt;Microsoft Exchange Web Services Managed API 1.2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want your PowerShell script to use the Managed API, we need to make the API available to PowerShell (and thus the script) by importing it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=135195"&gt;Add-Type&lt;/a&gt; -Path &amp;quot;C:\Program Files\Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Next, we need to create an instance of Exchange WebService .NET object:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$service = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList ([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1)&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: in the cmdlet, you also need to specify the version of Exchange you are connecting to. Obviously in this example, I was connecting to a server running Exchange 2007 SP1.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After we&amp;rsquo;ve created the instance, we need to connect to Exchange. This can be done various ways (for instance using AutoDiscover), but in this example, we&amp;rsquo;ll provide the web-services URL directly:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$service.Url = [system.URI] &amp;quot;https://servername.domain.local/ews/exchange.asmx&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now that we&amp;rsquo;ve connected to Exchange through the specified URL, it&amp;rsquo;s time to add some functionality to the script. Because I want the script to be re-usable, I needed a way of providing info to the script. You could use parameters, but because you might want to add multiple items at once, using a CSV-file seemed the best option to me. So, I had to import the csv-file:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$calendaritems = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113341"&gt;import-csv&lt;/a&gt; &amp;quot;calendaritems.csv&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In this script, the customer was looking for a way to add simple &amp;ldquo;informational&amp;rdquo; calendar items (such as public holidays from different countries), therefore I kept the amount of info provided through the csv-file as simple as possible. The content of the csv-file looks like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Subject,Body,Start,End,AllDayEvent &lt;br /&gt;Event1,&amp;rdquo;This is event 1&amp;rdquo;,01/01/2011,01/01/2011,True &lt;br /&gt;Event2,&amp;rdquo;This is event 2&amp;rdquo;,&amp;rdquo;Wednesday, November 02, 2011 1:00:00 PM&amp;rdquo;,&amp;rdquo;Wednesday, November 02, 2011 2:00:00 PM&amp;rdquo;,False&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As you can see from the input above, there are different way in which you can define the contents. You can keep the start- and end date simple (useful for all-day events), but you could also add a more complex time-notation for events that take up a certain amount of time.&lt;/p&gt;
&lt;p&gt;Now that we have the contents to add to the calendar(s), we now need to know to what calendar(s) to add them to. If you have to target all your users you could add the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$users = &lt;/span&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/8a5a6eb9-4a75-47f9-ae3b-a3ba251cf9a8(EXCHG.141).aspx"&gt;&lt;span style="font-family:Courier New;"&gt;Get-Mailbox&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;But because I wanted to have full control (without having to built another query) over who gets the new calendar items, I again make use of a csv-file. The CSV is &amp;ndash; again &amp;ndash; extremely simple: I only need the user&amp;rsquo;s SMTP Address (PrimartySMTPAddress):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$users = &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=113341"&gt;&lt;span style="font-family:Courier New;"&gt;import-csv&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Courier New;"&gt; &amp;ldquo;users.csv&amp;rdquo;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Next, we&amp;rsquo;re going to loop through the array $users (the list of all users that need to get the content of the &amp;ldquo;calendaritems.csv&amp;rdquo;-file) and add the items to their calendar. To loop through the array we use the following cmdlet:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;foreach($user in $users){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Before we can add an item to a user&amp;rsquo;s calendar, the account that is used to run this script needs to impersonate the user. That&amp;rsquo;s why we need the Primary SMTP Address for the user. This also means that we have to give that account &amp;ldquo;Application Impersonation&amp;rdquo; rights. Check out the following URL for more information: &lt;a href="http://msdn.microsoft.com/en-us/library/bb204095%28v=exchg.140%29.aspx" title="http://msdn.microsoft.com/en-us/library/bb204095%28v=exchg.140%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb204095%28v=exchg.140%29.aspx&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$service.ImpersonatedUserId = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.ImpersonatedUserId -ArgumentList([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$user.PrimarySMTPAddress)&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;Note that $user.PrimarySMTPAddress refers to the value in the users.csv file.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now that we&amp;rsquo;ve set that straight, we need to build the entries and save them to the user&amp;rsquo;s calendar:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;foreach($item in $calendaritems){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.Appointment -ArgumentList $service &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Subject = $item.Subject &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Body = $item.Body &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Start = $item.Start &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.End = $item.End &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.LegacyFreeBusyStatus = &amp;quot;Free&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($item.AllDayEvent = &amp;quot;true&amp;quot;){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.IsAllDayEvent = $true &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.IsAllDayEvent = $false &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Save([Microsoft.Exchange.WebServices.Data.SendInvitationsMode]::SendToAllAndSaveCopy) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Taking a look at the code above, there are some things we need to explain:&lt;/p&gt;
&lt;p&gt;We start by creating a new instance of a calendar object using:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$appointment = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.Appointment -ArgumentList $service&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then we define the entry&amp;rsquo;s Subject, Body, Start- &amp;amp; End-date, all have been defined through the calendaritems.csv file.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$appointment.Subject = $item.Subject &lt;br /&gt;$appointment.Body = $item.Body &lt;br /&gt;$appointment.Start = $item.Start &lt;br /&gt;$appointment.End = $item.End&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hard-coded in the script, we define the Free/Busy status as &amp;ldquo;Free&amp;rdquo; because the entry added to the user&amp;rsquo;s calendar is a pure informational entry.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$appointment.LegacyFreeBusyStatus = &amp;quot;Free&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Next, we sett the &amp;ldquo;IsAllDayEvent&amp;rdquo;-flag, based on the value we&amp;rsquo;ve entered in the calendaritems.csv file:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;if($item.AllDayEvent = &amp;quot;true&amp;quot;){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.IsAllDayEvent = $true &lt;br /&gt;} &lt;br /&gt;else{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.IsAllDayEvent = $false &lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In the end, we save the appointment to the calendar:&lt;/p&gt;
&lt;blockquote&gt;&lt;span style="font-family:Courier New;"&gt;$appointment.Save([Microsoft.Exchange.WebServices.Data.SendInvitationsMode]::SendToAllAndSaveCopy) &lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p&gt;That&amp;rsquo;s it. Easy, wasn&amp;rsquo;t it? &lt;img src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/wlEmoticon_2D00_winkingsmile_5F00_21674FD6.png" alt="Winking smile" class="wlEmoticon wlEmoticon-winkingsmile" style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Bringing it all together&lt;/h3&gt;
&lt;p&gt;If we bring all the pieces together, the script finally ends up looking like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Add-Type -Path &amp;quot;C:\Program Files\Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll&amp;quot; &lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;&lt;br /&gt;$service = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList ([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1) &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;$service.Url = [system.URI] &lt;a href="https://servername.domain.local/ews/exchange.asmx"&gt;https://servername.domain.local/ews/exchange.asmx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$calendaritems = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113341"&gt;Import-CSV&lt;/a&gt; &amp;quot;calendaritems.csv&amp;quot; &lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;$users = &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=113341"&gt;&lt;span style="font-family:Courier New;"&gt;import-csv&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Courier New;"&gt; &amp;ldquo;users.csv&amp;rdquo;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;foreach($user in $users){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;$service.ImpersonatedUserId = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.ImpersonatedUserId &amp;ndash;ArgumentList ([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$user.PrimarySMTPAddress)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach($item in $calendaritems){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment = &lt;a target="_blank" href="http://go.microsoft.com/fwlink/?LinkID=113355"&gt;New-Object&lt;/a&gt; Microsoft.Exchange.WebServices.Data.Appointment -ArgumentList $service &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Subject = $item.Subject &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Body = $item.Body &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Start = $item.Start &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.End = $item.End &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.LegacyFreeBusyStatus = &amp;quot;Free&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;if($item.AllDayEvent = &amp;quot;True&amp;quot;){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.IsAllDayEvent = $true &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.IsAllDayEvent = $false &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $appointment.Save([Microsoft.Exchange.WebServices.Data.SendInvitationsMode]::SendToAllAndSaveCopy) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Sources &amp;amp; Extra Information&lt;/h3&gt;
&lt;p&gt;If you&amp;rsquo;re looking for some great examples (and tutorials) and need some more idea&amp;rsquo;s on what you can do with EWS and PowerShell, check out the following blogs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:Courier New;"&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;a target="_blank" href="http://www.mikepfeiffer.net/"&gt;Mike Pfeiffer&amp;rsquo;s Blog&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;a target="_blank" href="http://gsexdev.blogspot.com/"&gt;Glen&amp;rsquo;s Exchange Dev Blog&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1194" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/EWS+Managed+API/default.aspx">EWS Managed API</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+Web+Services/default.aspx">Exchange Web Services</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/EWS/default.aspx">EWS</category></item><item><title>Exchange 2010 SP1 Installation Error “Scripting Agent Initialization failed: “file is not found…””</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/10/23/exchange-2010-sp1-installation-error-scripting-agent-initialization-failed-file-is-not-found.aspx</link><pubDate>Sun, 23 Oct 2011 21:34:29 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1165</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1165</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/10/23/exchange-2010-sp1-installation-error-scripting-agent-initialization-failed-file-is-not-found.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p&gt;When you try to install a new Exchange Server or if make an attempt to recover a failed server, you might run into the following error:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_7A29086A.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_6BEA8F7A.png" width="455" height="190" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This error occurs because the Scripting Agents CmdLetExtentionAgent is enabled but during installation the ScriptingAgentConfig.xml is not found. By default, the file is called ScriptingAgentmConfig.xml.sample (and that is also how it is copied from the installation source).&lt;/p&gt;  &lt;p&gt;I find it very unfortunate that the installer doesn’t take into account that if the Scripting Agent is installed it should change the filename, therefore avoiding this error. However; I understand that this might not be an easy thing to do. So let me show you how you can avoid this error.&lt;/p&gt;  &lt;h3&gt;Solution(s)&lt;/h3&gt;  &lt;p&gt;&lt;u&gt;The first solution:&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Copy the ScriptingAgentConfig.xml from another server (or a backup) to “C:\Program Files\Microsoft\Exchange Server\V14\Bin\CmdletExtentionAgents” before running the installer. This way, the installer will find the file and will &lt;u&gt;not&lt;/u&gt; throw an error. Just make sure that you create the folders &lt;u&gt;exactly&lt;/u&gt; as written, because the folder path is case sensitive.:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_24953988.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_6B122990.png" width="548" height="88" /&gt;&lt;/a&gt;     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;The second solution:&lt;/u&gt; Disable the Scripting-Agent before you run the install/recovery and re-enable it afterwards.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Run the following cmdlet from another Exchange Server: &lt;font face="Courier New"&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/8e4b3691-b8e8-4299-97a3-027b9503966a(EXCHG.141).aspx"&gt;Disable-CmdletExtensionAgent&lt;/a&gt; –Identity “Scripting Agent” &lt;/font&gt;and confirm:       &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_7F97790E.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_7159001E.png" width="472" height="57" /&gt;&lt;/a&gt;       &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;(Re)Run setup:      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_4A1EB6E9.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_50D1C06C.png" width="449" height="246" /&gt;&lt;/a&gt;       &lt;br /&gt;&amp;#160; &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Re-enable the scripting agent running &lt;font face="Courier New"&gt;&lt;a href="http://technet.microsoft.com/EN-US/library/349823d2-55cb-46d5-b658-ea15d2bbebaa(EXCHG.141).aspx"&gt;Enable-CmdletExtensionAgent&lt;/a&gt; –Identity “Scripting Agent”:         &lt;br /&gt;        &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3769BD32.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_3E1CC6B5.png" width="489" height="16" /&gt;&lt;/a&gt;&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1165" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/2010/default.aspx">2010</category></item><item><title>Get a list of mobile devices in Exchange 2010 using PowerShell</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/09/27/get-a-list-of-mobile-devices-in-exchange-2010-using-powershell.aspx</link><pubDate>Tue, 27 Sep 2011 21:12:00 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1134</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1134</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/09/27/get-a-list-of-mobile-devices-in-exchange-2010-using-powershell.aspx#comments</comments><description>&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Hi there! Following my &lt;a target="_blank" href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/09/25/exchange-2010-and-consumerization-of-mobile-devices.aspx"&gt;previous&lt;/a&gt; blog post about Exchange 2010 and consumerization of mobile devices, I decided to create a little script that might help you find out what mobile devices are actually connecting to your Exchange 2010 environment.&lt;/p&gt;
&lt;h3&gt;Step-by-Step&lt;/h3&gt;
&lt;p&gt;First, I define the variables that I&amp;rsquo;m going to use. &lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;$Date = Get-Date -uformat &amp;quot;%Y%m%d&amp;quot; &lt;br /&gt;$Logfile = &amp;quot;C:\Logs\ActiveSync-all-$date.txt&amp;quot; &lt;br /&gt;$Devices = @()&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Secondly, I add headers to the text file. This makes handling easier when you import it into Excel. &lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;Add-Content -path $LogFile &amp;quot;name,devicemodel,devicetype,useragent,lastsynctime&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Then we build a list of all mailboxes that have an ActiveSyncDevice configured (or in use) and we filter on objects that are on an Exchange 2010 server: &lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;$Mailboxes = Get-CASMailbox -ResultSize Unlimited | Where {$_.HasActiveSyncDevicePartnership -eq $True -and $_.ExchangeVersion.ExchangeBuild.Major -ilike &amp;quot;14&amp;quot;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Next, we loop through the result and per mailbox we&amp;rsquo;re going to query for devices using the Get-ActiveSyncDeviceStatistics cmdlet. We loop through each device to get some of the details (like the model etc):&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;ForEach ($mailbox in $mailboxes){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Devices= Get-ActiveSyncDeviceStatistics -Mailbox $mailbox.name &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $name = $mailbox.Name &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForEach ($device in $devices) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Model = $Device.DeviceModel &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Type = $Device.DeviceType &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $LastSyncTime = $Device.LastSuccessSync &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $UserAgent = $Device.DeviceUserAgent &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add-Content -path $Logfile &amp;quot;$name,$Model,$Type,$UserAgent,$LastSyncTime&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Bringing it all together&lt;/h3&gt;
&lt;p&gt;If we bring all of the above together, we get the following result:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$Date = Get-Date -uformat &amp;quot;%Y%m%d&amp;quot; &lt;br /&gt;$Logfile = &amp;quot;C:\Logs\ActiveSync-all-$date.txt&amp;quot; &lt;br /&gt;$Devices = @()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Add-Content -path $LogFile &amp;quot;name,devicemodel,devicetype,useragent,lastsynctime&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;$Mailboxes = Get-CASMailbox -ResultSize Unlimited | Where {$_.HasActiveSyncDevicePartnership -eq $True -and $_.ExchangeVersion.ExchangeBuild.Major -ilike &amp;quot;14&amp;quot;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;ForEach ($mailbox in $mailboxes){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Devices= Get-ActiveSyncDeviceStatistics -Mailbox $mailbox.name &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $name = $mailbox.Name &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForEach ($device in $devices) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Model = $Device.DeviceModel &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Type = $Device.DeviceType &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $LastSyncTime = $Device.LastSuccessSync &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $UserAgent = $Device.DeviceUserAgent &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add-Content -path $Logfile &amp;quot;$name,$Model,$Type,$UserAgent,$LastSyncTime&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The output of the file will look something like this:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;Michael Van Horenbeeck,Android,Android,Android/3.2-EAS-1.2,09/27/2011 05:55:59, &lt;br /&gt;Michael Van Horenbeeck,Android,Android,Android/3.2-EAS-1.2,, &lt;br /&gt;Michael Van Horenbeeck,htcace,htcace,Android-EAS/3.10.000.083346.405,09/27/2011 20:00:48, &lt;br /&gt;Michael Van Horenbeeck,TestActiveSyncConnectivity,TestActiveSyncConnectivity,Microsoft-Server-ActiveSync/12.0+(TestExchangeConnectivity.com),09/16/2011 13:05:41,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As you can see, I&amp;rsquo;m indeed using an Android-device. If you look closely, you&amp;rsquo;ll notice that there are 2 different devices. &lt;br /&gt;You&amp;rsquo;ll also notice that not all devices register their Model/Type correctly (like my Android device). Others do pop out in the logs more clearly:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;User X,iPad,iPad,Apple-iPad2C2/812.1,09/27/2011 18:52:48, &lt;br /&gt;User X,HTC Touch Pro,PocketPC,MSFT-PPC/5.2.5310,09/27/2011 20:07:02, &lt;br /&gt;User Y,iPad,iPad,Apple-iPad1C1/803.148,09/27/2011 20:12:39, &lt;br /&gt;User Y,SAMSUNG,WP,MSFT-WP/7.0.7004,09/27/2011 20:19:11,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;Note:&lt;/span&gt; If you ever used the testexchangeconnectivity.com website to test your ActiveSync deployment, you will notice that it will show up in the logs as well.&lt;/p&gt;
&lt;h3&gt;EDIT:&lt;/h3&gt;
&lt;p&gt;Tom Vergauwen, a colleague of me&amp;nbsp;just pointed out there&amp;#39;s an easier way using:&lt;/p&gt;
&lt;p&gt;Get-ActiveSyncDevice | Get-ActiveSyncDeviceStatistics&lt;/p&gt;
&lt;p&gt;It requires less iterations in the script; making it a lot quicker to process (certainly in large environments).&lt;br /&gt;Note: Get-ActiveSyncDevice is not available on Exchange 2007, so you&amp;#39;ll have to stick with the first script if you want to adapt it to Exchange 2007. &lt;/p&gt;
&lt;p&gt;Bringing the best of both worlds together, results into the following script:&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;span style="font-family:Courier New;"&gt;$Date = Get-Date -uformat &amp;quot;%Y%m%d&amp;quot;&lt;br /&gt;$file = &amp;quot;C:\temp\eas-devicelist-$date.csv&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;new-item $file -type file -force -value &amp;quot;User;DeviceType;DeviceModel;DeviceID;DeviceUserAgent;LastSyncTime&amp;#39;n&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;$devices = Get-ActiveSyncDevice | Get-ActiveSyncDeviceStatistics&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;ForEach($device in $devices){&lt;br /&gt;&amp;nbsp;&amp;nbsp; $Model = $Device.DeviceModel&lt;br /&gt;&amp;nbsp;&amp;nbsp; $Type = $Device.DeviceType&lt;br /&gt;&amp;nbsp;&amp;nbsp; $id = Device.DeviceID&lt;br /&gt;&amp;nbsp;&amp;nbsp; $LastSyncTime = $Device.LastSuccessSync&lt;br /&gt;&amp;nbsp;&amp;nbsp; $UserAgent = $Device.DeviceUserAgent&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; $identity = $device.identity|out-string&lt;br /&gt;&amp;nbsp;&amp;nbsp; $identity = $identity.split(&amp;quot;/&amp;quot;)[-2]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&amp;nbsp;&amp;nbsp; Add-Content -Path $file &amp;quot;$identity;$Type;$Model;$id;$UserAgent$LastSyncTime&amp;quot;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-family:Arial;"&gt;Again: thanks Tom for pointing this out!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1134" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/2010/default.aspx">2010</category></item><item><title>Examining the Message Tracking Logs using EMS</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/09/11/examining-the-message-tracking-logs-using-ems.aspx</link><pubDate>Sun, 11 Sep 2011 17:11:05 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1114</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1114</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/09/11/examining-the-message-tracking-logs-using-ems.aspx#comments</comments><description>&lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p&gt;Recently I was asked to provide an overview of the amount of mails that flow in and out a specific mailbox during a specific timeframe. The purpose was to create some kind of ‘profile’ (baseline) out of this mailbox.&amp;#160; &lt;br /&gt;Previously, this would typically have been information that you could get from the Exchange Profile Analyzer (EPA). But the Profile Analyzer uses WebDAV to ‘tap into’ Exchange which isn’t supported in Exchange 2010 anymore making it unusable in this case.&lt;/p&gt;  &lt;p&gt;Thus, I had to revert back to either a 3rd party tool or the message tracking logs. On top of that, the Management Console has no option to easily export information into e.g. a CSV-file… &lt;/p&gt;  &lt;p&gt;Based on the requirements, I decided to write a script that would fetch me some information from the message tracking logs:&lt;/p&gt;  &lt;p&gt;- Date/Time of the mails that have been sent/received    &lt;br /&gt;- Recipient/Sender     &lt;br /&gt;- Subject&lt;/p&gt;  &lt;p&gt;In this particular case, Message Tracking Logs were kept for 7 days. Even though it was not required, I decided to create daily statistics. Last but not least, I wanted these reports to be sent out automatically so that no further ‘maintenance’ was required.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;The solution&lt;/h3&gt;  &lt;p&gt;&lt;em&gt;Note: I’ve masked some of the output in the screenshots because the scripts were ran in a live environment.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The EMS allows to query the message tracking logs using the Get-MessageTrackingLog cmdlet:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_1425E8B8.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_65CC630A.png" width="660" height="59" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the customer’s environment, there are multiple Hub Transport servers. To make sure that I include all the servers, I either add the –server parameter and run the command for each Hub Transport server, or I do the following:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_53839C48.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_45452358.png" width="669" height="46" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;(The output is exactly the same, but now includes the logs from &lt;u&gt;all&lt;/u&gt; Hub Transport servers)&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Next, I wanted to filter the events that are shown. As stated above, I only need the Date/Time, Recipient or Sender and the Subject:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog | ft Sender,Recipients,TimeStamp,MessageSubject&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_1E0ADA23.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_24BDE3A6.png" width="693" height="44" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Note:&lt;/u&gt; the message shown above are the system messages which count as received messages as well! (if you want to filter them out you’ll have to add a where-clause to the cmdlet):&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog | Where-Object{$_.MessageSubject -ne &amp;quot;Your mailbox is almost full.&amp;quot;} | ft Sender,Recipients,TimeStamp,MessageSubject&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;So far so good &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/wlEmoticon_2D00_smile_5F00_12751CE4.png" /&gt;&lt;/p&gt;  &lt;p&gt;Running the cmdlets above, will provide us with the entire message tracking logs from all the different hub transport servers. In order to get the stats for a specific mailbox, during a specific timeframe, we need to filter:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;the date (we want a daily report with the sent / received messages from the day before)&lt;/li&gt;    &lt;li&gt;the sender/recipient&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;To fetch results from the message tracking logs during a specific timeframe, we need to use the –start and –end parameters:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog –Start &amp;quot;MM/dd/yyyy hh:mm:ss&amp;quot; –End &amp;quot;MM/dd/yyyy hh:mm:ss&amp;quot; | ft Sender,Recipients,TimeStamp,MessageSubject&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_725A1026.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_641B9736.png" width="681" height="60" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Fetching results for a specific mailbox (email) means that this mailbox can either be sender or recipient, resulting in the following cmdlets:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog –Start &amp;quot;MM/dd/yyyy hh:mm:ss&amp;quot; –End &amp;quot;MM/dd/yyyy hh:mm:ss&amp;quot; –Sender &lt;a href="mailto:email@domain.tld"&gt;email@domain.tld&lt;/a&gt; | ft Sender,Recipients,TimeStamp,MessageSubject&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3CE14E01.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_7181AA3C.png" width="691" height="56" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog –Start &amp;quot;MM/dd/yyyy hh:mm:ss&amp;quot; –End &amp;quot;MM/dd/yyyy hh:mm:ss&amp;quot; –Recipients &lt;a href="mailto:email@domain.tld"&gt;email@domain.tld&lt;/a&gt; | ft Sender,Recipients,TimeStamp,MessageSubject&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_1C5A0E4F.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_230D17D2.png" width="701" height="42" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;However, because of the way messages are logged in the message tracking logs, this might cause to return a message multiple times. For instance, if a mail is sent to both internal and external recipients, a second entry in the message tracking logs can be found for the external recipients only. This is by design the way the Exchange store handles messages. If we want to avoid that, we need to specify the EventID’s and Sources as well:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog -Recipients &lt;/font&gt;&lt;a href="mailto:email@domain.tld"&gt;&lt;font size="2" face="Courier New"&gt;email@domain.tld&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Courier New"&gt; -EventId DELIVER -Start &amp;quot;mm/dd/yyyy 0:00:00&amp;quot; -End &amp;quot;mm/dd/yyyy 23:59:59&amp;quot; | where{$_.Source -eq &amp;quot;STOREDRIVER&amp;quot;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;Get-TransportServer | Get-MessageTrackingLog –Sender &lt;/font&gt;&lt;a href="mailto:email@domain.tld"&gt;&lt;font size="2" face="Courier New"&gt;email@domain.tld&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Courier New"&gt; -Start &amp;quot;mm/dd/yyyy 0:00:00&amp;quot; -End &amp;quot;mm/dd/yyy 23:59:59&amp;quot; -EventID RECEIVE&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Bringing it all together&lt;/h3&gt;  &lt;p&gt;If we bring all the parts from above together, we’ll finally end up with the following code below. Note the way we handle the date &amp;amp; time to make sure that it’s in the correct format. This is because the script will be run using a scheduled task and I want it to automatically “calculate” the date of the day before, based on the systems’ time and date at the moment the script is ran:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;em&gt;#defining the variables&lt;/em&gt;        &lt;br /&gt;&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;$servers = Get-TransportServer       &lt;br /&gt;$email = &amp;quot;email@domail.tld&amp;quot;        &lt;br /&gt;$total_received = @()        &lt;br /&gt;$total_sent = @()&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;       &lt;br /&gt;&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;       &lt;br /&gt;$getdate = &amp;#39;{0:MM/dd/yyyy}&amp;#39; –f (get-date).addDays(-1)        &lt;br /&gt;$filedate= &amp;#39;{0:ddMMyyyy}&amp;#39; –f (get-date).addDays(-1)        &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;foreach($server in $servers){ &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;em&gt;#fetching the received messages         &lt;br /&gt;&lt;/em&gt;&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;$in = Get-MessageTrackingLog -Server $server -Recipients $email -EventId DELIVER -Start &amp;quot;$getdate 0:00:00&amp;quot; -End &amp;quot;$getdate 23:59:59&amp;quot; | where{$_.Source -eq &amp;quot;STOREDRIVER&amp;quot;}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160; foreach ($i in $in){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $received = New-Object PSobject        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $received | Add-Member -type NoteProperty -name Sender -value $i.sender        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $received | Add-Member -type NoteProperty -name Subject -value $i.messagesubject        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $received | Add-Member -type NoteProperty -name Time -value $i.timestamp        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $total_received += $received        &lt;br /&gt;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;     &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&lt;em&gt;#fetching the sent messages&lt;/em&gt;        &lt;br /&gt;$out = Get-MessageTrackingLog -server $server –sender $email -Start &amp;quot;$getdate 0:00:00&amp;quot; -End &amp;quot;$getdate 23:59:59&amp;quot; -EventID RECEIVE&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;em&gt;&amp;#160;&amp;#160; #add a extra loop to detect whether the fetched results (recipients) are an array or not. If it’s an array, join to a string (needed because of output format)         &lt;br /&gt;&amp;#160;&amp;#160; &lt;/em&gt;&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;foreach($o in $out){       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if($o.recipients -is [system.array]){        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $recip = [string]::join(&amp;quot;;&amp;quot;,$o.recipients)        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $sent = New-Object PSObject        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $sent | Add-Member -type NoteProperty -name Recipients -value $recip        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $sent | Add-Member -type NoteProperty -name Subject -value $o.messagesubject        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $sent | Add-Member -type NoteProperty -name Time -value $o.timestamp        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $total_sent += $sent&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160; }&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;em&gt;#results are exported to a csv-file on the local hdd. This way we have a file that we can re-use later.         &lt;br /&gt;&lt;/em&gt;$total_received | Export-CSV c:\mailstats\received_$filedate.csv -notypeinformation        &lt;br /&gt;$total_sent | Export-CSV c:\mailstats\sent_$filedate.csv –notypeinformation&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&lt;em&gt;#the code below is used to mail the files we’ve created before&lt;/em&gt;&lt;/font&gt;      &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;$smtpServer = &amp;quot;servername.domain.tld&amp;quot;       &lt;br /&gt;$msg = new-object Net.Mail.MailMessage        &lt;br /&gt;$smtp = new-object Net.Mail.SmtpClient($smtpServer)        &lt;br /&gt;$msg.From = &amp;quot;mailstats@domail.tld&amp;quot;        &lt;br /&gt;$msg.To.Add(&amp;quot;recipient@domain.com&amp;quot;)        &lt;br /&gt;$msg.Subject = &amp;quot;FYI: Exchange Mailbox Statistics for $email&amp;quot;        &lt;br /&gt;$msg.Body = &amp;quot;Daily Mail Stats for $email&amp;quot;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;$att_sent = New-Object Net.Mail.Attachment(&amp;quot;c:\mailstats\sent_$filedate.csv&amp;quot;)       &lt;br /&gt;$att_received = New-Object Net.Mail.Attachment(&amp;quot;c:\mailstats\received_$filedate.csv&amp;quot;)        &lt;br /&gt;$msg.Attachments.Add($att_sent)        &lt;br /&gt;$msg.Attachments.Add($att_received)&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="2" face="Courier New"&gt;$smtp.Send($msg)&lt;/font&gt;      &lt;br /&gt;&lt;/p&gt; &lt;/blockquote&gt;      &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Although there is no GUI which will allow you to save data from the message tracking logs, fetching data through the EMS is pretty straightforward and not that hard at all. You can – if needed – customize the script to include multiple mailboxes and file-handling (e.g.: exporting to html).&lt;/p&gt;  &lt;p&gt;Cheers!&lt;/p&gt;  &lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1114" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/2010/default.aspx">2010</category></item><item><title>Using the Scripting Agent to automate some basic “housekeeping” tasks</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/31/using-the-scripting-agent-to-automate-some-basic-housekeeping-tasks.aspx</link><pubDate>Wed, 31 Aug 2011 10:28:06 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1103</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1103</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/31/using-the-scripting-agent-to-automate-some-basic-housekeeping-tasks.aspx#comments</comments><description>&lt;h3&gt;&lt;u&gt;Introduction&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;Recently, &lt;a href="http://www.pro-exchange.be/members/KoVe/default.aspx" target="_blank"&gt;Koen&lt;/a&gt; published an &lt;a href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/08/26/applying-housekeeping-retention-policies-to-the-end-users.aspx" target="_blank"&gt;article&lt;/a&gt; about applying “housekeeping” retention policies to end-users.&lt;/p&gt;  &lt;p&gt;Somewhere in the article, there was a specific line that drew my attention:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;“… The policy will need to be applied to future mailboxes as well. Obviously I can request the service desk to update their user/mailbox creation procedures. However as an exchange admin I prefer to keep control. In other words we need something that we can run over and over again…”&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;One way of making sure that the policy is applied to every new mailbox, is to instruct the helpdesk/service desk to run a script every time a new user is created. However, this is still a manual intervention which leaves room for (human) error. I wanted to go a step further, and &lt;u&gt;make sure&lt;/u&gt; that the policy is applied every time a new mailbox is created.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;CMDlet extension agents&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;CMDlet extension agents are components in Exchange Server 2010 that are called whenever a cmdlet runs. They – literally – extend the functionality of an existing cmdlet and are available on any Exchange Server Role but the Edge Transport Server.    &lt;br /&gt;Only native Exchange 2010 cmdlets can ‘call’ these extension agents. This means that you cannot – directly – call upon these agents using a script you’ve written yourself. However; if your script contains a native Exchange 2010 cmdlet (e.g. New-Mailbox), that cmdlet will still be calling the cmdlet extension agent.&lt;/p&gt;  &lt;p&gt;Exchange 2010 includes several built-in agents but I’m not going into detail about the different agents. Nonetheless, for a detailed overview, take a look here: &lt;a title="http://technet.microsoft.com/en-us/library/dd335067.aspx" href="http://technet.microsoft.com/en-us/library/dd335067.aspx"&gt;http://technet.microsoft.com/en-us/library/dd335067.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For this article, it is the scripting agent in particular that I’m interested in.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Scripting Agent&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;The scripting agent is a cmdlet extension agent that allows you to ‘add’ some of your own scripting during execution of an Exchange 2010 cmdlet. The scripting agent includes some API’s that an Exchange 2010 cmdlet can call whenever a script is configured to be run. In short: it allows you to run your own code: before, during or after an Exchange 2010 cmdlet is run. &lt;/p&gt;  &lt;p&gt;If you’d like to have more information on the Scripting Agent, take a look here: &lt;a title="http://technet.microsoft.com/en-us/library/dd297951.aspx" href="http://technet.microsoft.com/en-us/library/dd297951.aspx"&gt;http://technet.microsoft.com/en-us/library/dd297951.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;But instead of trying to explain everything into detail, let’s just use an example and everything will become clear.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Building on Koen’s example, I would like to achieve the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;apply a retention policy named “Retention Policy 1” to new user mailboxes &lt;/li&gt;    &lt;li&gt;exclude VIP-mailboxes and assign them a retention policy “Retention Policy VIP” &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And of course, lazy admin as I am, I want these task to be executed automatically – without any user intervention.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Based on the requirements above, I could create a simple script like this:&amp;#160; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;$policy = “Retention Policy 1”        &lt;br /&gt;$policy_vip = “Retention Policy VIP”         &lt;br /&gt;        &lt;br /&gt;$mbx = get-mailbox | where{!$_.RetentionPolicy}         &lt;br /&gt;foreach($mb in $mbx){&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;font face="Courier New"&gt;&lt;em&gt;# we assume that all VIP-users have a mailbox in the database “VIP”          &lt;br /&gt;&lt;/em&gt;&amp;#160;&amp;#160; if($mb.database –eq “VIP”){         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Set-Mailbox –RetentionPolicy $policy_vip         &lt;br /&gt;&amp;#160;&amp;#160; }         &lt;br /&gt;&amp;#160;&amp;#160; else{         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Set-Mailbox –RetentionPolicy $policy         &lt;br /&gt;&amp;#160;&amp;#160; }         &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Although this script can automatically assign a retention policy whenever it is run, someone still has to run it manually after a new user has been created. And that’s exactly what I’m trying to avoid &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/wlEmoticon_2D00_smile_5F00_4EF84657.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Building the solution&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;Let’s see what happens when we put the Scripting Agent into action.&lt;/p&gt;  &lt;p&gt;In the directory: “.\Program Files\Microsoft\Exchange Server\v14\Bin\CmdletExtensionAgents”, you will find a file called ScriptingAgentConfig.xml.sample. This file contains some samples on what you could do with the scripting agent:    &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_12CC7AAF.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_476CD6EA.png" width="461" height="202" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Either rename the file to ScriptingAgentConfig.xml and alter it or create a new ScriptingAgentConfig.xml-file. I – personally – prefer creating a new (blank) file.&lt;/p&gt;  &lt;p&gt;Copy-Paste the code below in the file:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;        &lt;br /&gt;&amp;#160; &amp;lt;Configuration version=&amp;quot;1.0&amp;quot;&amp;gt;         &lt;br /&gt;&amp;#160; &amp;lt;Feature Name=&amp;quot;MailboxProvisioning&amp;quot; Cmdlets=&amp;quot;New-Mailbox&amp;quot;&amp;gt;         &lt;br /&gt;&amp;#160; &amp;lt;ApiCall Name=&amp;quot;OnComplete&amp;quot;&amp;gt;         &lt;br /&gt;&amp;#160; If($succeeded) {         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $Name= $provisioningHandler.UserSpecifiedParameters[&amp;quot;Name&amp;quot;]         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $retpolicy = &amp;quot;Retention Policy 1&amp;quot;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $policy_vip = &amp;quot;Retention Policy VIP&amp;quot;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if($provisioningHandler.UserSpecifiedParameters[&amp;quot;RetentionPolicy&amp;quot;] -eq $null){         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if((get-mailbox $Name).database.name -eq &amp;quot;VIP&amp;quot;){         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Set-Mailbox -Identity $Name -RetentionPolicy $policy_vip         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; else{         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Set-Mailbox -Identity $Name -RetentionPolicy $retpolicy         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }         &lt;br /&gt;&amp;#160; }         &lt;br /&gt;&amp;#160; &amp;lt;/ApiCall&amp;gt;         &lt;br /&gt;&amp;#160; &amp;lt;/Feature&amp;gt;         &lt;br /&gt;&amp;#160; &amp;lt;/Configuration&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;As you can see, we are using the onComplete-API which will make our code run &lt;u&gt;after&lt;/u&gt; the new-mailbox cmdlet has been completed. &lt;/p&gt;  &lt;p&gt;Let’s break down the script, and see what each part does:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;font face="Courier New"&gt;if($succeeded)&lt;/font&gt;: will validate that the cmdlet ‘new-mailbox’ ran successfully &lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;$Name = $provisioningHandler.UserSpecifiedParameters[&amp;quot;Name&amp;quot;]:&lt;/font&gt; assigns the value of the name-parameter that was provided with the new-mailbox cmdlet to the variable “$Name” &lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;if($provisioningHandler.UserSpecifiedParameters[&amp;quot;RetentionPolicy&amp;quot;] -eq $null): &lt;/font&gt;&lt;font face="Calibri"&gt;we check whether a retention policy was already provided with the new-mailbox cmdlet. If so; no action will be taken.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;if((get-mailbox $Name).database.name -eq &amp;quot;VIP&amp;quot;)&lt;/font&gt;&lt;font face="Calibri"&gt;: if the user’s mailbox is created in the VIP-database, assign “Retention Policy VIP”. Else, assign “Retention Policy 1”&lt;/font&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;After saving the file, we need to enable the Scripting Agent using the following cmdlet:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Enable-CmdletExtentionAgent “Scripting Agent”&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_671BB0B2.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_26E59738.png" width="485" height="58" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can verify it’s status running the following cmdlet:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;Get-CmdletExtentionAgent “Scripting Agent” | fl Name,Enabled&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_51BDFB4A.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0D7D93FE.png" width="597" height="63" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Let’s create a mailbox and see what happens:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;New-Mailbox –Name RetPol1 –Password (CovertTo-Securestring &lt;/font&gt;&lt;a href="mailto:&amp;ldquo;P@ssw0rd"&gt;&lt;font face="Courier New"&gt;“P@ssw0rd&lt;/font&gt;&lt;/a&gt;&lt;font face="Courier New"&gt;” –AsPlainText –Force) –UserPrincipalName &amp;quot;RetPol1@domain.tld”&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_1F5A27CB.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_3136BB98.png" width="699" height="73" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now query for the user’s Retention Policy:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_7100A21D.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_2CC03AD1.png" width="407" height="118" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Magic! Even without specifying a Retention Policy, the user got the one I specified before assigned!&lt;/p&gt;  &lt;p&gt;Now, let see what happens if we create the user in the VIP database: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_6C8A2156.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_2C5407DC.png" width="649" height="163" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This time the user got a different retention policy: “Retention Policy VIP”. &lt;/p&gt;  &lt;p&gt;And what happens if we provide a retention policy with the new-mailbox cmdlet?&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_4C02E1A4.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_76DB45B6.png" width="656" height="167" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Exactly, the script will not change the retention policy (even though we created the user in the VIP database).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;As you see, scripting agents are not that difficult to implement and offer you a wide range of possibilities in automating certain tasks.&lt;/p&gt;  &lt;p&gt;Obviously, you could already provide a retention policy when executing the new-mailbox cmdlet using the –RetentionPolicy parameter. But that would still require you to enter that every single time, which leaves room for human error. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Extra Resources&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;By coincidence, not so long ago, another colleague (Michel de Rooij) also published an article about using CMDlet extension agents to automatically create an archive in a specific database whenever a new mailbox is created. I definitely recommend reading it through! &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://eightwone.com/2011/08/24/automatic-archive-provisioning-with-cmdlet-extension-agents/" href="http://eightwone.com/2011/08/24/automatic-archive-provisioning-with-cmdlet-extension-agents/"&gt;http://eightwone.com/2011/08/24/automatic-archive-provisioning-with-cmdlet-extension-agents/&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;p&gt;   &lt;br /&gt;If you want to get to know more about the Scripting Agent, take a look at the following TechNet article: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://technet.microsoft.com/en-us/library/dd297951.aspx" href="http://technet.microsoft.com/en-us/library/dd297951.aspx"&gt;http://technet.microsoft.com/en-us/library/dd297951.aspx&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1103" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category></item><item><title>Integrating AD RMS with Exchange 2010 (part 3)</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/28/integrating-ad-rms-with-exchange-2010-part-3.aspx</link><pubDate>Sun, 28 Aug 2011 20:25:06 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1096</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1096</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/28/integrating-ad-rms-with-exchange-2010-part-3.aspx#comments</comments><description>&lt;h3&gt;&lt;u&gt;Introduction&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;In the &lt;a href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/08/15/integrating-ad-rms-with-exchange-2010-part-1.aspx" target="_blank"&gt;first&lt;/a&gt; part of this article, we talked about what AD RMS was and how to setup a small test-environment. In the &lt;a href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/08/22/integrating-ad-rms-with-exchange-2010-part-2.aspx" target="_blank"&gt;second&lt;/a&gt; part, I showed how to integrate RMS with Exchange 2010 and how you could/should create and deploy rights policy templates to your users.&lt;/p&gt;  &lt;p&gt;Today, I’ll show you how to protect a new mail message using Outlook 2010 or OWA and I will also be talking about the more automated ways of integrating RMS templates: Outlook- &amp;amp; Transport protection Rules.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Outlook- &amp;amp; Transport Protection Rules&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;If we would use the environment that we created during the past two parts of this article, creating rights-protected content would entirely be up to the user. This would mean that if the user did not apply a RMS template on an outgoing message, the message could still leave the organization without being protected, possibly leaving sensible information unprotected.&lt;/p&gt;  &lt;p&gt;There are cases in which you might want content always to be protected (e.g. email coming from the financial department). Outlook- &amp;amp; Transport Protection rules enable you to create “rules” that will automatically apply a RMS template, without any user intervention. The main difference between both is that an Outlook Protection Rule will encrypt the message when it leaves the user’s computer (before hitting the hub&amp;#160; transport servers) whereas a Transport Protection Rule will apply a RMS template while the message is in transit (on the hub transport servers). In the latter case, the user will have no idea whether the message will be encrypted or not. Outlook Protection Rules allows the user to see that the message was encrypted and – if configured – also allows the user to modify the template used to encrypt the message.&lt;/p&gt;  &lt;p&gt;If you want to use Outlook Protection Rules, you also have to make sure that the template that is defined in the rule also is available on the client’s computer. For more information on how to achieve that, please take a look at my &lt;a href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/08/22/integrating-ad-rms-with-exchange-2010-part-2.aspx" target="_blank"&gt;previous&lt;/a&gt; article.&lt;/p&gt;  &lt;p&gt;Whenever a message is protected with an Outlook Protection Rule, it is encrypted and therefor – normally – not readable to a hub transport server. This would definitely limit processing options during transport (e.g. for message compliancy). Fortunately, Exchange 2010 allows you to enable “transport decryption”. The decryption agent will decrypt the message upon reception, allowing other agents to also process the message (e.g. append a disclaimer etc.). Once processing is complete, the hub transport server will re-encrypt the message with the same AD RMS template that was used to encrypt it in the first place, before sending it out onto the internet.&lt;/p&gt;  &lt;p&gt;For more information about transport decryption and –agents, have a look here: &lt;a title="http://technet.microsoft.com/en-us/library/dd638126.aspx" href="http://technet.microsoft.com/en-us/library/dd638126.aspx"&gt;http://technet.microsoft.com/en-us/library/dd638126.aspx&lt;/a&gt; and &lt;a title="http://technet.microsoft.com/en-us/library/bb125012.aspx" href="http://technet.microsoft.com/en-us/library/bb125012.aspx"&gt;http://technet.microsoft.com/en-us/library/bb125012.aspx&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;&lt;/u&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;u&gt;&lt;/u&gt;&lt;/h3&gt;  &lt;h3&gt;&lt;u&gt;Creating Outlook Protection Rules&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;Creating an Outlook Protection Rule is pretty straightforward, however you can only do this using the Exchange Management Shell (EMS):&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;New-OutlookProtectionRule –Name &lt;em&gt;&amp;lt;name&amp;gt;&lt;/em&gt; –ApplyRightsProtectionTemplate &lt;em&gt;&amp;lt;name_of_the_rms_template&amp;gt;&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3F83F958.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_1849B023.png" width="610" height="176" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In the example above, I first queried for all availably RMS templates using the Get-RMSTemplate cmdlet. I then used the “Do Not Print” template to create an Outlook Protection Rule that would apply to &lt;u&gt;all&lt;/u&gt; email messages.&lt;/p&gt;  &lt;p&gt;If you want to limit the scope of the Outlook Protection Rule, you would use either the &lt;font face="Courier New"&gt;–SentTo&lt;/font&gt; or&lt;font face="Courier New"&gt; –SentToScope&lt;/font&gt; parameters:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_4CEA0C5E.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_5EC6A02B.png" width="620" height="150" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Notice that I added the&lt;font face="Courier New"&gt; –SendToScope&lt;/font&gt; “inOrganization” parameter. This will make sure that the Outlook Protection Rule is only applied to messages sent internally. &lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;u&gt;Note:&lt;/u&gt; I replaced the name of the RMS template by the TemplateGUID. This because I created a duplicate RMS-template called “Do Not Forward and wanted to be sure the correct one was selected.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;For more information on the &lt;font face="Courier New"&gt;New-OutlookProtectionRule&lt;/font&gt; and it’s parameters, please check: &lt;a title="http://technet.microsoft.com/en-us/library/dd298182.aspx" href="http://technet.microsoft.com/en-us/library/dd298182.aspx"&gt;http://technet.microsoft.com/en-us/library/dd298182.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Creating Transport Protection Rules&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;Transport protection rules are “no more” than regular transport rules which we use to apply an AD RMS Template to a message. Creating transport rules can either be done through the EMC or the EMS.    &lt;br /&gt;In order to alternate between EMS and EMC, I will show you how to perform this task using the EMC. However, if you want to use the EMS, take a look here: &lt;a title="http://technet.microsoft.com/en-us/library/bb125138.aspx" href="http://technet.microsoft.com/en-us/library/bb125138.aspx"&gt;http://technet.microsoft.com/en-us/library/bb125138.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Open the EMC and navigate to “Organization Configuration” &amp;gt; “Hub Transport”; select the “Transport Rules”-tab from the result pane and click “New Transport Rule” from the actions pane.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_5088273B.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_650D76B9.png" width="578" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This will launch the “New Transport Rule”-wizard.&lt;/p&gt;  &lt;p&gt;Enter descriptive details and click Next:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_6BC0803C.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_2B8A66C2.png" width="361" height="197" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select an appropriate condition that meets your requirement and click Next. In this example I chose to create a condition based on the membership of a Distribution Group “HR”:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3647BE17.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0F0D74E2.png" width="318" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select “Rights Protect Message with RMS Template” and click the underlined text “RMS Template”:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_43ADD11D.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_6E86352F.png" width="315" height="271" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select the desired RMS Template and confirm:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_3C2261B0.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_49F4A7AB.png" width="203" height="162" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click Next.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_5BD13B78.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_6DADCF45.png" width="322" height="265" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Add an exception (if required) and click Next:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_62181206.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0CF07619.png" width="318" height="158" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click Next again and then click New.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Creating a rights-protected document with Outlook&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;Besides the automatic application of RMS templates (through Outlook- or Transport Protection Rules), a user can still decide to apply a RMS template to a message himself.&lt;/p&gt;  &lt;p&gt;Open a new mail message and navigate to the options-tab. From there, click the arrow under “Permission”:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_13A37F9C.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_685EE894.png" width="401" height="65" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Select an available template to apply it to the message.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_7A3B7C61.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_210992A2.png" width="244" height="228" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Creating a rights-protected document with OWA&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;From within OWA, open a new mail message and click the arrow next to the permissions-icon. Select an available template to apply it to the message.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_79CF496C.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/image_5F00_thumb_5F00_0BABDD3A.png" width="445" height="142" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="4"&gt;&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;Throughout the past few articles, we created a simple RMS infrastructure and integrated it with Exchange 2010. We deployed some RMS templates and distributed them to a Windows 7 machine.    &lt;br /&gt;Afterwards we’ve also taken a look at the more automated ways of integrating RMS through protection rules. &lt;/p&gt;  &lt;p&gt;I hope that you feel a bit more confident with regards to RMS/IRM now and if if you have any questions, please don’t hesitate to comment or to contact me directly.&lt;/p&gt;  &lt;p&gt;See you next time!&lt;/p&gt;  &lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1096" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Outlook+2010_2C00_+Exchange+2010/default.aspx">Outlook 2010, Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Outlook+2010/default.aspx">Outlook 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Rights+Management/default.aspx">Rights Management</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/compliance/default.aspx">compliance</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Security/default.aspx">Security</category></item><item><title>Applying “housekeeping” retention policies to the end users</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/26/applying-housekeeping-retention-policies-to-the-end-users.aspx</link><pubDate>Fri, 26 Aug 2011 12:40:00 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1091</guid><dc:creator>Koen Vermoesen</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1091</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/26/applying-housekeeping-retention-policies-to-the-end-users.aspx#comments</comments><description>&lt;p&gt;In my &lt;a href="http://www.pro-exchange.be/blogs/exchange2010/archive/2011/08/11/basic-housekeeping-with-exchange-2010-sp1-retention-policies.aspx"&gt;previous&lt;/a&gt; blog post I wrote about a basic retention policy for doing some basic housekeeping using Exchange 2010 retention policies. The last sentence of that post post reads:&lt;/p&gt;
&lt;p&gt;All there&amp;rsquo;s is left to do is applying the policy to the remainder of the user base, but don&amp;rsquo;t forget to skip the CEO&amp;rsquo;s mailbox ;-)&lt;/p&gt;
&lt;p&gt;Right now you&amp;rsquo;re probably thinking &amp;ldquo;&lt;a href="http://technet.microsoft.com/en-us/library/bb123685.aspx"&gt;Get-Mailbox&lt;/a&gt; | &lt;a href="http://technet.microsoft.com/en-us/library/bb123981.aspx"&gt;Set-Mailbox&lt;/a&gt;&amp;rdquo; does the trick. Obviously it does the trick; but I&amp;rsquo;ve got a couple more requirements.&lt;/p&gt;
&lt;li&gt;The retention policy needs to be set on about 2500. If you&amp;rsquo;re like me that you rather spend halve a day writing a script than using that time to make the changes in the GUI. (+ I wouldn&amp;rsquo;t have something to blog about.) &lt;/li&gt;
&lt;li&gt;I&amp;rsquo;ve got that CEO mailbox to exclude. I could of course easily exclude a single mailbox. Let&amp;rsquo;s make it a bit more future proof and ensure the scripts can deal with multiple exclusions. &lt;/li&gt;
&lt;li&gt;It&amp;rsquo;s also a good idea to filter mailboxes out which already have a retention policy set. The policy will need to be applied to future mailboxes as well. Obviously I can request the service desk to update their user/mailbox creation procedures. However as an exchange admin I prefer to keep control. In other words we need something that we can run over and over again. &lt;/li&gt;
&lt;p&gt;Lets go over the different sections of the script:&lt;/p&gt;
&lt;p&gt;First of all we start with defining the list of excluded mailboxes. I chose to use a lengthy way of doing so. This way I could add sufficient comments to ensure it&amp;rsquo;s really clear which VIPs we&amp;rsquo;re dealing with (as there is no logical connection between the alias and the user).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# Defining the mbx to be excluded from the retention policy     &lt;br /&gt;# You can add to the list as needed      &lt;br /&gt;# However make sure you use the alias, not SamAccountName!      &lt;br /&gt;$Exceptions = @() # Define array      &lt;br /&gt;$Exceptions += &amp;quot;ABC123&amp;quot; # Casper      &lt;br /&gt;$Exceptions += &amp;quot;DEF456&amp;quot; # Melchior      &lt;br /&gt;$Exceptions += &amp;quot;GHI789&amp;quot; # Balthazar&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After Some more variable definitions, we convert the exclusion list form an array of strings to an array of mailbox object (needed later on in the script). Afterwards we print a list on screen showing the list of excluded mailbox.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# Set more variables     &lt;br /&gt;$RetPol = &amp;quot;Remove old deleted items and calendar entries&amp;quot;      &lt;br /&gt;$TableCols = &amp;quot;Alias&amp;quot;,&amp;quot;DisplayName&amp;quot;,&amp;quot;RetentionPolicy&amp;quot;&lt;/p&gt;
&lt;p&gt;# Display Exclusions     &lt;br /&gt;Clear-Host      &lt;br /&gt;Write-Host &amp;quot;Retention Policies will NOT be changed for:&amp;quot; -ForegroundColor Red      &lt;br /&gt;$Exceptions = $Exceptions | Get-Mailbox # Convert array of strings to array of mbx objects      &lt;br /&gt;$Exceptions | ft $TableCols&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The next section does a query for mailboxes for which not Retention Policy has been set yet.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# Exclude mbx which already have the retention policy set     &lt;br /&gt;Write-Host &amp;quot;`nBuilding the list of mailboxes without a Retention Policy set&amp;quot; -ForegroundColor Green      &lt;br /&gt;$MBX = @() # Define array      &lt;br /&gt;$MBX += $(Get-Mailbox -ResultSize Unlimited | where {!$_.RetentionPolicy}) # Exclude mailboxes which have already a retention policy set      &lt;br /&gt;$MBX | ft $TableCols      &lt;br /&gt;Write-Host &amp;quot;`nPlease check if these counts seem realistic to you.&amp;quot; -ForegroundColor Green      &lt;br /&gt;Write-Host &amp;quot;# of mbx on the exclusion list:&amp;quot; $Exceptions.Count      &lt;br /&gt;Write-Host &amp;quot;# of mbx without retention policy:&amp;quot; $MBX.Count&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We compare the array of mbxs without retention policy with the exception list. We converted the exception list earlier on to be able to compare of objects of the same type. The delta is the list of mailboxes we need to update. The PassThru-parameter is need to ensure our command returns mailbox objects because the &lt;a href="http://technet.microsoft.com/en-us/library/dd347568.aspx"&gt;Compare-Object&lt;/a&gt; command returns &amp;ldquo;difference objects&amp;rdquo; by default. The SideIndicator property on the other hand excludes results that are in $Exceptions but not $MBX, which can happen if you do some creative testing.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# Exclude mbx on the exclusion list     &lt;br /&gt;$MBX2Set = @() # Define array      &lt;br /&gt;$MBX2Set += $(Compare-Object $MBX $Exceptions -PassThru | ? { $_.SideIndicator -eq &amp;quot;&amp;lt;=&amp;quot;})      &lt;br /&gt;$MBX2Set | ft $TableCols&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Last but not least we need to actually set the Retention Policies for the remaining mailboxes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;#Setting RetentionPolicy     &lt;br /&gt;Write-Host &amp;quot;`nSetting retention policy&amp;quot; -ForegroundColor Green      &lt;br /&gt;if ($MBX2Set) {      &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;# of mbx to set retention policy for:&amp;quot; $MBX2Set.Count      &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $MBX2Set | Set-Mailbox -RetentionPolicy $RetPol      &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {      &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;No mailboxes to set!&amp;quot; -ForegroundColor Yellow      &lt;br /&gt;}&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Screenshots of scripts don&amp;rsquo;t always offer a lot of added value, especially if they read &amp;ldquo;nothing to change&amp;rdquo; but at least one can admire the colors ;-)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/Image_2D00_20110826135117_5F00_0963DB2F.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="Image 20110826135117" alt="Image 20110826135117" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/Image_2D00_20110826135117_5F00_thumb_5F00_61BD5F04.png" border="0" height="319" width="743" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1091" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Archiving/default.aspx">Archiving</category></item><item><title>Script: check what version of Exchange 2010 you are running</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/09/script-check-what-version-of-exchange-2010-you-are-running.aspx</link><pubDate>Tue, 09 Aug 2011 10:37:00 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:1077</guid><dc:creator>Michael Van Horenbeeck</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=1077</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2011/08/09/script-check-what-version-of-exchange-2010-you-are-running.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve noticed that quite some search phrases in Google were about how to determine what version or build&amp;nbsp;of Exchange (2010) you&amp;#39;re running. That is why, a while back,&amp;nbsp;I decided to&amp;nbsp;make a little script which does that for you.&amp;nbsp;I&amp;nbsp;updated the syntax a bit (more compact) and added new Exchange version numbers.&lt;/p&gt;
&lt;p&gt;At the moment, the script is limited to Exchange 2010, but you could easily modify it to include support for earlier versions of Exchange as well.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note that I&amp;#39;m not a scripting-guru and that the script&amp;#39;s function is limited to Exchange 2010 only. For more information, you can always contact me directly. Feedback is always welcome!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;To run the script, you just have to run &amp;quot;Get-ExchangeVersion&amp;quot; once you&amp;#39;ve loaded into your profile. To do so, you can dot-script this script by typing &lt;strong&gt;&amp;quot;. .\scriptname.ps1&lt;/strong&gt;&amp;quot; from&amp;nbsp;EMS.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;Here&amp;#39;s the code:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;lt;#&lt;br /&gt;Michael Van Horenbeeck&lt;br /&gt;Version-checker for Exchange 2010&lt;br /&gt;v1.0 28/02/2011&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Updates&lt;br /&gt;v1.1 17/07/2011 - Added new builds to the $versionArray&lt;br /&gt;v1.2 09/09/2011 - Added UR4 v2 to the $versionArray&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Additional Information&lt;br /&gt;This script is designed to only work with Exchange Server 2010. &lt;br /&gt;If you want to add support for earlier versions of exchange there are some things that need to be done:&lt;br /&gt;&amp;nbsp;&amp;nbsp; - add version info to $versionArray&lt;br /&gt;&amp;nbsp;&amp;nbsp; - lookup version info from exsetup.exe in different location (based on what version you&amp;#39;re running)&lt;br /&gt;&amp;nbsp;&lt;br /&gt;The script needs to be run with enough rights in order to use administrative shares and lookup file version info&lt;br /&gt;Additionally, the exchange server should be reachable from the computer you are using to run the script.&lt;br /&gt;#&amp;gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;function Get-ExchangeVersion{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define variables&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $var = @()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $info = @()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $obj=@()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $servers = Get-ExchangeServer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $i=0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #additional settings&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set-ADServerSettings -ViewEntireForest $true&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #List of Version numbers&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #format:(&amp;quot;Name&amp;quot;,&amp;quot;buildnr&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $versionArray = (&amp;quot;Exchange Server 2010 RTM&amp;quot;,&amp;quot;14.00.0639.021&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 Update Rollup 1&amp;quot;,&amp;quot;14.00.0682.001&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 Update Rollup 2&amp;quot;,&amp;quot;14.00.0689.000&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 Update Rollup 3&amp;quot;,&amp;quot;14.00.0694.000&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 Update Rollup 4&amp;quot;,&amp;quot;14.00.0702.001&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 Update Rollup 5&amp;quot;,&amp;quot;14.00.0726.000&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 RTM&amp;quot;,&amp;quot;14.01.0218.015&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 Update Rollup 1&amp;quot;,&amp;quot;14.01.0255.002&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 Update Rollup 2&amp;quot;,&amp;quot;14.01.0270.001&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 Update Rollup 3&amp;quot;,&amp;quot;14.01.0289.003&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 Update Rollup 3 v3&amp;quot;,&amp;quot;14.01.0289.007&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 Update Rollup 4&amp;quot;,&amp;quot;14.01.0323.001&amp;quot;),&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&amp;quot;Exchange Server 2010 SP1 Update Rollup 4 v2&amp;quot;,&amp;quot;14.01.0323.006&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Welcome message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;Exchange 2010 Version Checker v1.2&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;----------------------------------&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;The script is determining what versions of Exchange 2010 you are running. Please wait...&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #run trhough the array of exchange servers to determine build&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach ($server in $servers){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $var+= Get-ExchangeServer $server&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $role = $var[$i].ServerRole&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #The script uses the default installation directory + administrative share. If one (or both) has changed (e.g. no administrative share available or you installed in another directory)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #please, update the variable $fileinfo with the correct information&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $fileinfo = Get-Command &amp;quot;&lt;/em&gt;&lt;a&gt;&lt;em&gt;\\$server\c$\program&lt;/em&gt;&lt;/a&gt;&lt;em&gt; files\microsoft\exchange server\v14\bin\exsetup.exe&amp;quot; | %{$_.fileversioninfo}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $version = $fileinfo.FileVersion&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $major = $fileinfo.FileMajorPart&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for($n=0;$n -lt $versionArray.count; $n++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($version -eq $versionArray[$n][1]){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $obj = New-Object PSObject&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $obj | Add-Member -type NoteProperty -name Name -value $server&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $obj | Add-Member -type NoteProperty -name Roles -value $role&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $obj | Add-Member -type NoteProperty -name VersionName -value $versionArray[$n][0]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $info += $obj&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $i++&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $n=0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output $info | ft -autosize&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Host &amp;quot;&amp;quot;&lt;br /&gt;} &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you are interested in a more complete (and complex) script, which gives you a nice overview of your entire Exchange organization, please take a look at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.stevieg.org/2011/07/exchange-environment-report-1-5-2-released/"&gt;http://www.stevieg.org/2011/07/exchange-environment-report-1-5-2-released/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to get to know more about powershell, visit:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/scriptcenter/dd742419"&gt;http://technet.microsoft.com/en-us/scriptcenter/dd742419&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=1077" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange/default.aspx">Exchange</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Service+Pack/default.aspx">Service Pack</category></item><item><title>Generating Exchange 2010 Certificates (Exchange Management Shell)</title><link>http://www.proexchange.be/blogs/exchange2010/archive/2009/10/23/generating-exchange-2010-certificates-exchange-management-shell.aspx</link><pubDate>Fri, 23 Oct 2009 17:15:11 GMT</pubDate><guid isPermaLink="false">a583a9e2-e885-4d34-829b-07e1aa1d77a8:304</guid><dc:creator>Johan Delimon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.proexchange.be/blogs/exchange2010/rsscomments.aspx?PostID=304</wfw:commentRss><comments>http://www.proexchange.be/blogs/exchange2010/archive/2009/10/23/generating-exchange-2010-certificates-exchange-management-shell.aspx#comments</comments><description>&lt;p&gt;As you probably know, Exchange 2007 certificate management was done in powershell.&amp;#160; Luckily we have some tools available to help us with the creation of these Powershell Commandlets to generate certificates.&lt;/p&gt;  &lt;p&gt;Exchange 2010 not only allows you to manage certificates via Powershell but also via the GUI    &lt;br /&gt;See the following article for Certificates via the GUI     &lt;br /&gt;&lt;a title="http://www.pro-exchange.be/blogs/exchange2010/archive/2009/05/04/finally-managing-exchange-certificates-using-the-gui.aspx" href="http://www.pro-exchange.be/blogs/exchange2010/archive/2009/05/04/finally-managing-exchange-certificates-using-the-gui.aspx"&gt;http://www.pro-exchange.be/blogs/exchange2010/archive/2009/05/04/finally-managing-exchange-certificates-using-the-gui.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This article discusses the differences in Powershell Certificate Creation Exchange 2007 vs Exchange 2010&lt;/p&gt;  &lt;p&gt;Digicert has a great tool for generating the powershell script required to generate a Certificate    &lt;br /&gt;&lt;a title="https://www.digicert.com/easy-csr/exchange2007.htm" href="https://www.digicert.com/easy-csr/exchange2007.htm"&gt;https://www.digicert.com/easy-csr/exchange2007.htm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.11_5F00_6B92C9A7.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="New-ExchangeCertificate.11" border="0" alt="New-ExchangeCertificate.11" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.11_5F00_thumb_5F00_2A18174E.png" width="648" height="342" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Let’s create a certificate in Exchange 2010 Exchange Management Shell&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.1_5F00_1A95057F.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="New-ExchangeCertificate.1" border="0" alt="New-ExchangeCertificate.1" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.1_5F00_thumb_5F00_39D7AC52.png" width="813" height="227" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;A positional parameter cannot be found that accepts argument &amp;#39;-Path&amp;#39;.      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + CategoryInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : InvalidArgument: (:) [New-ExchangeCertificate], ParameterBindingException       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + FullyQualifiedErrorId : PositionalParameterNotFound,New-ExchangeCertificate&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The Powershell command fails! What is happening?&lt;/p&gt;  &lt;p&gt;Well, the parameters for New-ExchangeCertificate have changed.&amp;#160; The &lt;strong&gt;“-Path”&lt;/strong&gt; parameter has been removed from the parameter list.     &lt;br /&gt;Check the Technet page : New-ExchangeCertificate (Exchange 2010 Help)     &lt;br /&gt;&lt;a title="http://technet.microsoft.com/en-us/library/aa998327(EXCHG.140).aspx" href="http://technet.microsoft.com/en-us/library/aa998327(EXCHG.140).aspx"&gt;http://technet.microsoft.com/en-us/library/aa998327(EXCHG.140).aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.1_5F00_78C92CED.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now Digicert has a new Exchange 2010 CSR Command Wizard    &lt;br /&gt;&lt;a title="https://www.digicert.com/easy-csr/exchange2010.htm" href="https://www.digicert.com/easy-csr/exchange2010.htm"&gt;https://www.digicert.com/easy-csr/exchange2010.htm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.21_5F00_0CE24977.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="New-ExchangeCertificate.21" border="0" alt="New-ExchangeCertificate.21" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.21_5F00_thumb_5F00_367614AA.png" width="670" height="354" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Let’s run this new Command in the Exchange 2010 Command Shell&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.2_5F00_69D1D806.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="New-ExchangeCertificate.2" border="0" alt="New-ExchangeCertificate.2" src="http://www.pro-exchange.be/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/exchange2010/NewExchangeCertificate.2_5F00_thumb_5F00_4F253BED.png" width="859" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;That works fine but we have no file that is created.&amp;#160; Now we could copy &amp;amp; paste the certificate information from the prompt into a text file and hope that formatting is OK.    &lt;br /&gt;The Exchange 2010 New-Certificate help on Technet explains that we have to do this in two steps.&amp;#160; First a certificate must be created (like the screenshot) and then this information must be saved into a file.&lt;/p&gt;  &lt;p&gt;So Let’s do this:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;First we need to create the Certificate and save the information into a variable ($Data in this case)&lt;/strong&gt;     &lt;br /&gt;$Data = New-ExchangeCertificate -GenerateRequest -KeySize 2048 -SubjectName &amp;quot;c=BE, s=Brussels, l=Brussels, o=Johan Delimon, ou=Pro-Exchange, cn=www.pro-exchange.be&amp;quot; -DomainName www.pro-exchange.be, mail.pro-exchange.be, autodiscover.pro-exchange.be -PrivateKeyExportable $True&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Then we must save this content to a file:&lt;/strong&gt;     &lt;br /&gt;Set-Content -path &amp;quot;c:\www_pro-exchange_be.req&amp;quot; -Value $Data &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The same result can be accomplished from a single command like this:      &lt;br /&gt;&lt;/strong&gt;Set-Content -path &amp;quot;c:\www_pro-exchange_be.req&amp;quot; -Value (New-ExchangeCertificate -GenerateRequest -KeySize 2048 -SubjectName &amp;quot;c=BE, s=Brussels, l=Brussels, o=Johan Delimon, ou=Pro-Exchange, cn=www.pro-exchange.be&amp;quot; -DomainName www.pro-exchange.be, mail.pro-exchange.be, autodiscover.pro-exchange.be -PrivateKeyExportable $True)&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Importing Certificates is quite similar and has also a two step approach&lt;/p&gt;  &lt;p&gt;Check the Technet page : Import-ExchangeCertificate (Exchange 2010 Help)    &lt;br /&gt;&lt;a title="http://technet.microsoft.com/en-us/library/bb124424(EXCHG.140).aspx" href="http://technet.microsoft.com/en-us/library/bb124424(EXCHG.140).aspx"&gt;http://technet.microsoft.com/en-us/library/bb124424(EXCHG.140).aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path c:\www_pro-exchange_be.cer -Encoding byte -ReadCount 0))&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.proexchange.be/aggbug.aspx?PostID=304" width="1" height="1"&gt;</description><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Exchange+2010/default.aspx">Exchange 2010</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Certificates/default.aspx">Certificates</category><category domain="http://www.proexchange.be/blogs/exchange2010/archive/tags/Powershell/default.aspx">Powershell</category></item></channel></rss>