<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9152313422880014915</id><updated>2012-01-29T22:11:08.916-07:00</updated><category term='C#'/><category term='Calendaring'/><category term='PowerShell'/><category term='Backups'/><category term='Blackberry'/><category term='OWA'/><category term='Resources'/><category term='Daylight Saving Time'/><category term='Exchange'/><category term='Outlook'/><category term='Shared Mailboxes'/><category term='Scripts'/><category term='Clustering'/><category term='Exchange 2003'/><category term='Exchange 2007'/><title type='text'>Nick’s Exchange and Scripting Blog</title><subtitle type='html'>Exchange, Scripting, and other things IT</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-3939816068593328726</id><published>2008-01-29T06:47:00.000-07:00</published><updated>2008-01-29T06:52:23.062-07:00</updated><title type='text'>My Blog has moved...</title><content type='html'>As some of you may know, I started a new job with Microsoft last September. I apologize for the lack of updates as I have been getting settled with the new job. &lt;br /&gt;&lt;br /&gt;I have resumed blogging at a new location: &lt;a href="http://blogs.msdn.com/karsmith/"&gt;http://blogs.msdn.com/karsmith/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-3939816068593328726?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/3939816068593328726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=3939816068593328726' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/3939816068593328726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/3939816068593328726'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2008/01/my-blog-has-moved.html' title='My Blog has moved...'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-3592262113310434025</id><published>2007-07-11T20:59:00.001-06:00</published><updated>2007-07-16T15:55:23.526-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2003'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><title type='text'>NDR Message: 5.6.1 Body type not supported by Remote Host</title><content type='html'>I spent this afternoon tracking down an odd NDR message received when an Exchange 2007 user sends a message to a distribution group hosted on an Exchange 2003 server containing contact objects.  When the user sends a message to such a distribution group the following NDR message is received: &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Delivery has failed to these recipients or distribution lists:&lt;br /&gt;&lt;br /&gt;Smith,Nick&lt;br /&gt;The e-mail system had a problem processing this message. Microsoft Exchange will not try to redeliver this message for you. Please provide the following diagnostic text to your system administrator.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Diagnostic information for administrators:&lt;br /&gt;&lt;br /&gt;Generating server: e2003server.domain.com&lt;br /&gt;&lt;br /&gt;k.nick.smith@gmail.com&lt;br /&gt;#&lt; #5.6.1 smtp;554 5.6.1 Body type not supported by Remote Host&gt; #SMTP#&lt;br /&gt;…&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The headers of this message indicate that it was routed through the Exchange 2007 transport servers to Exchange 2003 via the routing group connector and to the Exchange 2003 listed as the expansion server for the distribution list.  Most importantly, the NDR generating server was the Exchange 2003 distribution group expansion server.&lt;br /&gt;&lt;br /&gt;I immediately began looking into the contact objects for which the NDR was generated.  Oddly, I was able to successfully send mail directly to the contact object.  I only received an NDR message when sending to a distribution group of which the contact object was a member.  Further testing revealed that Exchange 2003 users were able to successfully send messages to the distribution group.  The message was delivered to all members including the contact objects in question.  &lt;br /&gt;&lt;br /&gt;To muddy the waters, NDR messages are not generated for all contact objects in the distribution list.  We created several new contacts and added them to a distribution list trying to find the difference between working and non-working contacts.  This new test distribution list exhibited the same behavior as others; NDR’ing some contacts while successfully sending the message to others.  NDR messages were always generated for the same contacts.  At this point I compared the working and non-working contacts but I was unable to find any differences that would cause the problem.&lt;br /&gt;&lt;br /&gt;On a hunch, since I was able to send messages to the contacts directly from Exchange 2007, I decided to change the expansion server for the distribution group to an Exchange 2007 transport server.  This did the trick and both Exchange 2003 and 2007 users are able to send to all members of the distribution group.  While I can’t fully explain why the distribution group does not work when expanded on an Exchange 2003 server, I can accept this simple workaround as the solution to our problems.  Hopefully someone more knowledgeable than me can explain this in the comments section.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Solution&lt;/h3&gt;&lt;br /&gt;To resolve this problem set the distribution group expansion server to an Exchange 2007 server.  This can be done in the Exchange Management Shell with the following command:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Set-DistributionGroup “Group Display Name” –ExpansionServer:E2007ServerName&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-3592262113310434025?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/3592262113310434025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=3592262113310434025' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/3592262113310434025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/3592262113310434025'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/07/ndr-message-561-body-type-not-supported.html' title='NDR Message: 5.6.1 Body type not supported by Remote Host'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-2238249789189412520</id><published>2007-06-29T07:20:00.001-06:00</published><updated>2007-06-29T07:30:19.649-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><title type='text'>Exchange 2007 Update Rollup 3 Released</title><content type='html'>The long awaited fix for the &lt;a href="http://knicksmith.blogspot.com/2007/03/exchange-2007-and-outlook-2003-where.html"&gt;Outlook 2003 in-line attachments issue&lt;/a&gt; is included in the rollup.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/?kbid=935999"&gt;Description of Update Rollup 3 for Exchange 2007&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Additionally, the rollup includes the fix to the "Cannot open the free/busy information" error mentioned in my &lt;a href="http://knicksmith.blogspot.com/2007/05/managing-resource-mailbox-calendars.html"&gt;Managing Resource Mailbox Calendars Article&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I for one will be installing this rollup ASAP as we have been waiting for some of these fixes for quite a long time.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-2238249789189412520?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/2238249789189412520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=2238249789189412520' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/2238249789189412520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/2238249789189412520'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/06/exchange-2007-update-rollup-3-released.html' title='Exchange 2007 Update Rollup 3 Released'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-2798264295096006526</id><published>2007-06-18T20:27:00.000-06:00</published><updated>2007-06-18T20:53:50.823-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2003'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Script: Identifying Quota Bottlenecks</title><content type='html'>Quota increase requests are a frequent occurrence for me.  Without blindly approving the request, I prefer to look for large folders within a users’ mailbox that could easily be archived (e.g. ‘Sent Items 05’ or ‘Archived Items’).  I have used the following scripts to see the number of items and size of user mailbox folders.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Exchange 2007&lt;/h3&gt;&lt;br /&gt;The Exchange Management Shell offers some built-in tools to accomplish this task.  Massaging the output makes it easier to identify quota bottlenecks.  This script can be run from any computer with the Exchange Management Shell&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Script&lt;/strong&gt;:&lt;br /&gt;&lt;code&gt;param($alias = $(read-host alias))&lt;br /&gt;Get-MailboxFolderStatistics $alias | FT FolderPath,ItemsInFolder,@{label="FolderSize (KB)";expression={$_.FolderSize.ToKB()} }&lt;br /&gt;Get-MailboxStatistics $alias | FT ItemCount,StorageLimitStatus,@{label="TotalItemSize (KB)";expression={$_.TotalItemSize.Value.ToKB()} },@{label="TotalItemSize (MB)";expression={$_.TotalItemSize.Value.ToMB()} },LastLogonTime&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Output&lt;/strong&gt;:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[PS] C:\Temp&gt;.\MailboxSize.ps1 e12_test1&lt;br /&gt;&lt;br /&gt;FolderPath                              ItemsInFolder           FolderSize (KB)&lt;br /&gt;----------                              -------------           ---------------&lt;br /&gt;/                                                   0                         0&lt;br /&gt;/Calendar                                           5                        33&lt;br /&gt;/Contacts                                           0                         0&lt;br /&gt;/Deleted Items                                     10                         9&lt;br /&gt;/Drafts                                             0                         0&lt;br /&gt;/Inbox                                             10                     79356&lt;br /&gt;/Journal                                            0                         0&lt;br /&gt;/Junk E-Mail                                        0                         0&lt;br /&gt;/Notes                                              0                         0&lt;br /&gt;/Outbox                                             0                         0&lt;br /&gt;/RSS Feeds                                          0                         0&lt;br /&gt;/Sent Items                                        14                        32&lt;br /&gt;/Sync Issues                                        0                         0&lt;br /&gt;/Sync Issues/Conflicts                              0                         0&lt;br /&gt;/Sync Issues/Local Fail...                          0                         0&lt;br /&gt;/Sync Issues/Server Fai...                          0                         0&lt;br /&gt;/Tasks                                              0                         0&lt;br /&gt;&lt;br /&gt;ItemCount      StorageLimitStatus      TotalItemSize (KB)      TotalItemSize (MB) LastLogonTime&lt;br /&gt;---------      ------------------      ------------------      ------------------ -------------&lt;br /&gt;       43              BelowLimit                   79438                      77 6/6/2007 2:03:07 PM&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&amp;nbsp;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Exchange 2003&lt;/h3&gt;&lt;br /&gt;The attached VBScript must be run on the mailbox server hosting the user’s mailbox.  It connects to the IFS drive and evaluates the size of each folder in the user’s mailbox.  I modified a &lt;a href="http://www.outlookexchange.com/articles/glenscales/mreport2.asp"&gt;script&lt;/a&gt; previously published by &lt;a href="http://gsexdev.blogspot.com/"&gt;Glen Scales&lt;/a&gt; and adapted it to output the name and total size of the folder to the command window.&lt;br /&gt;&lt;br /&gt;**Remember to change your domain name on line 15**&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Script&lt;/strong&gt;:&lt;br /&gt;'Adapted from http://www.outlookexchange.com/articles/glenscales/mreport2.asp&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Dim obArgs,cArgs,iSize,ndate,tmailbox&lt;br /&gt;&lt;br /&gt;Set obArgs = WScript.Arguments&lt;br /&gt;tmailbox = obArgs.Item(0)&lt;br /&gt;&lt;br /&gt;Main&lt;br /&gt;&lt;br /&gt;Sub Main()&lt;br /&gt; Dim sConnString,domainname&lt;br /&gt;&lt;br /&gt; 'On Error Resume Next&lt;br /&gt; domainname = "mail.domain.com"&lt;br /&gt; ' Set up connection string to mailbox.&lt;br /&gt; sConnString = "file://./backofficestorage/" &amp; domainname&lt;br /&gt; sConnString = sConnString &amp; "/mbx/" &amp; obArgs.Item(0) &amp; "/NON_IPM_SUBTREE"&lt;br /&gt;&lt;br /&gt; iSize = 0&lt;br /&gt; Wscript.Echo&lt;br /&gt; RecurseFolder sConnString, ""&lt;br /&gt; WScript.Echo&lt;br /&gt; WScript.Echo "Mailbox Size: " &amp; replace(formatnumber((iSize/1024/1024),2),",","") &amp; " MB"&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Sub RecurseFolder(sConnString, sParentFolder)&lt;br /&gt;   Dim oConn&lt;br /&gt;   Dim oRecSet&lt;br /&gt;   Dim sSQL&lt;br /&gt;   Dim sFolderPath&lt;br /&gt;&lt;br /&gt;   ' Set up SQL SELECT statement.&lt;br /&gt;   sSQL = "SELECT ""http://schemas.microsoft.com/mapi/proptag/x0e080003"", "&lt;br /&gt;   sSQL = sSQL &amp; """DAV:href"",""DAV:hassubs"",""DAV:displayname"" "&lt;br /&gt;   sSQL = sSQL &amp; "FROM SCOPE ('SHALLOW TRAVERSAL OF """ &amp; sConnString&lt;br /&gt;   sSQL = sSQL &amp; """') WHERE ""DAV:isfolder"" = true"&lt;br /&gt;&lt;br /&gt;   ' Create Connection object.&lt;br /&gt;   Set oConn = CreateObject("ADODB.Connection")&lt;br /&gt;   Set oRecSet = CreateObject("ADODB.Recordset")&lt;br /&gt;&lt;br /&gt;   ' Set provider to EXOLEDB.&lt;br /&gt;   oConn.Provider = "Exoledb.DataSource"&lt;br /&gt;&lt;br /&gt;   ' Open connection to folder.&lt;br /&gt;   oConn.Open sConnString&lt;br /&gt;     if Err.Number &lt;&gt; 0 then&lt;br /&gt;     WScript.Echo "Error opening connection: " &amp; Err.Number &amp; " " &amp; Err.Description&lt;br /&gt;     Set oRecSet = Nothing&lt;br /&gt;     Set oConn = Nothing&lt;br /&gt;     Exit Sub&lt;br /&gt;     end if&lt;br /&gt;&lt;br /&gt;   ' Open Recordset of all subfolders in folder.&lt;br /&gt;   oRecSet.CursorLocation = 3&lt;br /&gt;   oRecSet.Open sSQL, oConn.ConnectionString&lt;br /&gt;     if Err.Number &lt;&gt; 0 then&lt;br /&gt;     WScript.Echo "Error opening recordset: " &amp; Err.Number &amp; " " &amp; Err.Description&lt;br /&gt;     oRecSet.Close&lt;br /&gt;     oConn.Close&lt;br /&gt;     Set oRecSet = Nothing&lt;br /&gt;     Set oConn = Nothing&lt;br /&gt;     Exit Sub&lt;br /&gt;     end if&lt;br /&gt;&lt;br /&gt;   if oRecSet.RecordCount = 0 then&lt;br /&gt;      oRecSet.Close&lt;br /&gt;      oConn.Close&lt;br /&gt;      Set oRecSet = Nothing&lt;br /&gt;      Set oConn = Nothing&lt;br /&gt;      Exit Sub&lt;br /&gt;   end if&lt;br /&gt;&lt;br /&gt;   ' Move to first record.&lt;br /&gt;   oRecSet.MoveFirst&lt;br /&gt;     if Err.Number &lt;&gt; 0 then&lt;br /&gt;     WScript.Echo "Error moving to first record: " &amp; Err.Number &amp; " " &amp; Err.Description&lt;br /&gt;     oRecSet.Close&lt;br /&gt;     oConn.Close&lt;br /&gt;     Set oRecSet = Nothing&lt;br /&gt;     Set oConn = Nothing&lt;br /&gt;     Exit Sub&lt;br /&gt;     end if&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;   ' Loop through all of the records, and then add the size of the &lt;br /&gt;   ' subfolders to obtain the total size.&lt;br /&gt;   While oRecSet.EOF &lt;&gt; True&lt;br /&gt;      ' Increment size.&lt;br /&gt;      iSize = iSize + oRecSet.Fields.Item("http://schemas.microsoft.com/mapi/proptag/x0e080003")&lt;br /&gt;      foldersize = oRecSet.Fields.Item("http://schemas.microsoft.com/mapi/proptag/x0e080003")&lt;br /&gt;      workfolderfp = oRecSet.Fields("DAV:href").value&lt;br /&gt;      workfolder = oRecSet.Fields("DAV:displayname").value&lt;br /&gt;      sFolderPath = sParentFolder &amp; "/" &amp; workfolder&lt;br /&gt;      if InStr(sConnString,"NON_IPM_SUBTREE") = 0 then&lt;br /&gt;       Dim sSplit &lt;br /&gt;       sSplit = Split(sFolderPath,"/")&lt;br /&gt;       Dim sShortPath &lt;br /&gt;       sShortPath = ""&lt;br /&gt;       for i = 2 to Ubound(sSplit)&lt;br /&gt;        sShortPath = sShortPath &amp; sSplit(i) &amp; "/" &lt;br /&gt;       next&lt;br /&gt;       Dim sSize, sFolder, sDisplay&lt;br /&gt;       sFolder = Left(sShortPath,Len(sShortPath)-1)&lt;br /&gt;       sSize = replace(formatnumber((foldersize/1024),0),",","") &amp; " KB"&lt;br /&gt;       sDisplay = sFolder &amp; " "&lt;br /&gt;       for i = Len(sFolder) to (50 - Len(sSize))&lt;br /&gt;        sDisplay = sDisplay &amp; " "&lt;br /&gt;       next&lt;br /&gt;       sDisplay = sDisplay + sSize&lt;br /&gt;       WScript.Echo sDisplay&lt;br /&gt;      end if&lt;br /&gt;      ' If the folder has subfolders, recursively call RecurseFolder to process them.&lt;br /&gt;&lt;br /&gt;      If oRecSet.Fields.Item("DAV:hassubs") = True then&lt;br /&gt;         RecurseFolder oRecSet.Fields.Item("DAV:href"), sFolderPath&lt;br /&gt;      End If&lt;br /&gt;      ' Move to next record.&lt;br /&gt;      oRecSet.MoveNext&lt;br /&gt;     if Err.Number &lt;&gt; 0 then&lt;br /&gt;     WScript.Echo "Error moving to next record: " &amp; Err.Number &amp; " " &amp; Err.Description&lt;br /&gt;     Set oRecSet = Nothing&lt;br /&gt;     Set oConn = Nothing&lt;br /&gt;     Exit Sub&lt;br /&gt;     end if&lt;br /&gt;   wend&lt;br /&gt;&lt;br /&gt;   ' Close Recordset and Connection.&lt;br /&gt;   oRecSet.Close&lt;br /&gt;     if Err.Number &lt;&gt; 0 then&lt;br /&gt;     WScript.Echo "Error closing recordset: " &amp; Err.Number &amp; " " &amp; Err.Description&lt;br /&gt;     Set oRecSet = Nothing&lt;br /&gt;     Set oConn = Nothing&lt;br /&gt;     Exit Sub&lt;br /&gt;     end if&lt;br /&gt;&lt;br /&gt;   oConn.Close&lt;br /&gt;     if Err.Number &lt;&gt; 0 then&lt;br /&gt;     WScript.Echo "Error closing connection: " &amp; Err.Number &amp; " " &amp; Err.Description&lt;br /&gt;     Set oRecSet = Nothing&lt;br /&gt;     Set oConn = Nothing&lt;br /&gt;     Exit Sub&lt;br /&gt;     end if&lt;br /&gt;&lt;br /&gt;   ' Clean up memory.&lt;br /&gt;   Set oRecSet = Nothing&lt;br /&gt;   Set oConn = Nothing&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Output&lt;/strong&gt;:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\temp&gt;cscript MailboxSize.vbs user.csuf&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.6&lt;br /&gt;Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Inbox                                         472 KB&lt;br /&gt;Outbox                                          0 KB&lt;br /&gt;Sent Items                                     16 KB&lt;br /&gt;Deleted Items                                   0 KB&lt;br /&gt;Calendar                                        0 KB&lt;br /&gt;Contacts                                        0 KB&lt;br /&gt;Drafts                                          0 KB&lt;br /&gt;Journal                                         0 KB&lt;br /&gt;Notes                                           0 KB&lt;br /&gt;Tasks                                           0 KB&lt;br /&gt;Sync Issues                                     0 KB&lt;br /&gt;Sync Issues/Conflicts                           0 KB&lt;br /&gt;Sync Issues/Local Failures                      0 KB&lt;br /&gt;Sync Issues/Server Failures                     0 KB&lt;br /&gt;Junk E-mail                                     1 KB&lt;br /&gt;&lt;br /&gt;Mailbox Size: 0.48 MB&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;a href="http://www.freewebs.com/knicksmith/MailboxSize.zip"&gt;Download both scripts&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-2798264295096006526?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/2798264295096006526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=2798264295096006526' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/2798264295096006526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/2798264295096006526'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/06/script-identifying-quota-bottlenecks.html' title='Script: Identifying Quota Bottlenecks'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-4839432573035500775</id><published>2007-05-24T21:11:00.000-06:00</published><updated>2007-05-24T21:17:29.883-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Calendaring'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2003'/><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><title type='text'>Exchange 2003/2007: Enable Calendar Sharing</title><content type='html'>With a default installation of Exchange 2007, when an Exchange 2003 user tries to open/view the shared calendar of an Exchange 2007 user they receive the error “Unable to display the folder. The Calendar folder could not be found.” This error is received because the Exchange 2007 server rejects the MAPI request from the user’s Exchange 2003 server.  Adding the following registry value will allow the Exchange 2007 server to accept these requests from 2003 servers: &lt;br /&gt;&lt;br /&gt;Path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSExchangeIS\ParametersSystem &lt;br /&gt;Value Name: Disabled MAPI Clients&lt;br /&gt;Value Type: REG_SZ&lt;br /&gt;Value Date: -6.4.9999&lt;br /&gt;&lt;br /&gt;The value “-6.4.9999” will allow Exchange 2007 servers to accept connections from Exchange 2003 and all versions of Outlook.  &lt;br /&gt;&lt;br /&gt;You can read more about this setting at:&lt;br /&gt;&lt;br /&gt;How to disable MAPI client access to a computer that is running Exchange Server&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/288894"&gt;http://support.microsoft.com/kb/288894&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;Technet: All versions of Outlook are allowed to access the server &lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/library/69e7ac7b-9f0b-4b0d-879a-334c1b41242b.aspx"&gt;http://technet.microsoft.com/en-us/library/69e7ac7b-9f0b-4b0d-879a-334c1b41242b.aspx&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-4839432573035500775?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/4839432573035500775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=4839432573035500775' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4839432573035500775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4839432573035500775'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/05/exchange-20032007-enable-calendar.html' title='Exchange 2003/2007: Enable Calendar Sharing'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-5966372145481953576</id><published>2007-05-06T18:38:00.000-06:00</published><updated>2007-05-06T18:44:51.656-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clustering'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><title type='text'>Exchange 2007 Clustering: Important KB articles</title><content type='html'>&lt;h3&gt;Kerberos Authentication&lt;/h3&gt;&lt;br /&gt;Kerberos authentication will not work on an Exchange 2007 clustered server (CMS and SSC) until each cluster node machine is granted permissions to write the ‘Validated-SPN’ property on the CMS Active Directory computer object.  Additionally, the following error messages will be entered into the Application event log.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Event Type: Error &lt;br /&gt;Event Source: MSExchangeSA &lt;br /&gt;Event Category: General &lt;br /&gt;Event ID: 9317 &lt;br /&gt;Date: &lt;date&gt; &lt;br /&gt;Time: &lt;time&gt; &lt;br /&gt;User: N/A &lt;br /&gt;Computer: &lt;computername&gt; &lt;br /&gt;Description: &lt;br /&gt;Failed to register Service Principal Name for exchangeRFR; error code was c0072098.&lt;br /&gt;&lt;br /&gt;Event Type: Error &lt;br /&gt;Event Source: MSExchangeSA &lt;br /&gt;Event Category: General &lt;br /&gt;Event ID: 9317 &lt;br /&gt;Date: &lt;date&gt; &lt;br /&gt;Time: &lt;time&gt; &lt;br /&gt;User: N/A &lt;br /&gt;Computer: &lt;computername&gt; &lt;br /&gt;Description: &lt;br /&gt;Failed to register Service Principal Name for exchangeMDB; error code was c0072098. &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The KB article ID 935676 details the process of granting this permission on the CMS computer object.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/935676"&gt;Event ID 9317 is logged when the Microsoft Exchange System Attendant service comes online on an Exchange 2007 cluster node&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Provisioning mailboxes on additional Single Copy Cluster nodes&lt;/h3&gt;&lt;br /&gt;If you are creating a multiple CMSs (Clustered Mailbox Server) in a Single Copy Cluster you should be aware of the following KB article.  When trying to provision a mailbox on a second or successive CMS you receive the following error:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;“A proxy generator DLL on server FQDN.serverName could not be found or failed to initialize. Proxy addresses for the current recipient cannot be calculated. Please ensure that all the proxy addresses for the current recipient cannot be calculated. Please ensure that all proxy address generator DLLs have been installed on the target server.”&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This error can be solved by creating a message transfer agent (MTA) in Active Directory for each CMS.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/928811"&gt;How to enable mailbox creation on the second or later clustered mailbox server (CMS) of an Exchange 2007 Single Copy Cluster (SCC)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-5966372145481953576?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/5966372145481953576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=5966372145481953576' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/5966372145481953576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/5966372145481953576'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/05/exchange-2007-clustering-important-kb.html' title='Exchange 2007 Clustering: Important KB articles'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-8941890814555154497</id><published>2007-05-01T08:19:00.000-06:00</published><updated>2008-12-08T16:06:46.671-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Calendaring'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='Resources'/><title type='text'>Managing Resource Mailbox Calendars</title><content type='html'>The &lt;a href="http://technet.microsoft.com/en-us/library/aa996340.aspx"&gt;Set-MailboxCalendarSettings cmdlet&lt;/a&gt; is one of the most useful and flexible cmdlets available with Exchange 2007. However, its flexibility often leads to complexity and confusion. I’ll do my best to walk you through the possibilities and help explain some areas where the &lt;a href="http://technet.microsoft.com/en-us/library/aa996338.aspx"&gt;Microsoft documentation&lt;/a&gt; is lacking.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;AutomateProcessing&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Let’s start off by getting the calendar settings of a resource.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;[PS] C:\&gt;Get-MailboxCalendarSettings demo_laptop_1&lt;br /&gt;Identity                                      AutomateProcessing&lt;br /&gt;--------                                      ------------------&lt;br /&gt;ColoState.EDU/ExchangeResources/Demo Laptop 1 AutoAccept&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You will see the identity of the resource and its AutomateProcessing type. This can be set as one of 3 possibilities:&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt&gt;None&lt;/dt&gt;&lt;dd&gt;Both the resource booking and calendar attendants are disabled.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;AutoUpdate&lt;/dt&gt;&lt;dd&gt;Only the calendar attendant is enabled.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;AutoAccept&lt;/dt&gt;&lt;dd&gt;Both the resource booking and calendar attendants are enabled.&lt;/dd&gt; &lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;AutoUpdate is the default value for all mailboxes to help users manage their calendar data. The AutoAccept processing mode can only be enabled on resource mailboxes.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Calendar and Resource Booking Attendants&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;From &lt;a href="http://www.microsoft.com/exchange/evaluation/features/default.mspx"&gt;http://www.microsoft.com/exchange/evaluation/features/default.mspx&lt;/a&gt; each attendant is defined as the following:&lt;br /&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt&gt;Calendar Attendant&lt;/dt&gt;&lt;dd&gt;The Calendar Attendant reduces scheduling conflicts by limiting calendar items (request, declines, accepts) in the inbox to the latest version. The Calendar Attendant also marks meeting requests as tentative on recipient calendars until users can act on the request and relies on the Exchange Server 2007 free/busy Web service for always up-to-date availability information.&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;&lt;dt&gt;Resource Booking Attendant&lt;/dt&gt;&lt;dd&gt;The Resource Booking Attendant enables resources, including meeting rooms or other equipment, to be automatically managed. Resources can auto-accept requests when available or decline and provide details explaining the decline. Administrators can set granular policies on resources, including available hours or scheduling permissions.&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;h3&gt;Calendaring Policies&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Now we explore the great flexibility this cmdlet offers (and the root of that flat spot on your forehead from repeating banging it against the wall). There are 3 distinct, &lt;em&gt;counter-intuitively&lt;/em&gt; named policies that can be defined for automatic calendar processing:&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt&gt;Book-In Policy Requests&lt;/dt&gt;&lt;dd&gt;Users that are defined in the ‘Book-In-Policy’ are allowed to automatically schedule a resource if it available. Resource delegates do not have to approve these requests.&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;To define a list of users in the ‘book-in’ policy use the following command.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -BookInPolicy 'user1@domain.com','user2@domain.com'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This command will allow all users to use the ‘book-in’ policy.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -AllBookInPolicy:$True -AllRequestOutOfPolicy:$False -AllRequestInPolicy:$False&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;dt&gt;In-Policy Requests&lt;/dt&gt;&lt;dd&gt;Requests from users defined in the ‘In-Policy’ group must be approved by a resource delegate.&lt;/dd&gt;&lt;br /&gt;To define a list of users that can submit ‘in-policy’ requests use the following command.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -RequestInPolicy 'user1@domain.com','user2@domain.com'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This command will allow all users to submit ‘out-of-policy’ requests.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -AllBookInPolicy:$False -AllRequestOutOfPolicy:$False -AllRequestInPolicy:$True&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;dt&gt;Out-Of-Policy Requests&lt;/dt&gt;&lt;dd&gt;Users defined in the ‘Out-Of-Policy’ group have their requests automatically approved unless there is a conflict on the resource calendar. If a conflict exists, the calendar request is forwarded to resource delegates for approval.&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;To define a list of users that can submit ‘in-policy’ requests use the following command.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -RequestOutOfPolicy 'user1@domain.com','user2@domain.com'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;This command will allow all users to submit ‘out-of-policy’ requests.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -AllBookInPolicy:$False -AllRequestOutOfPolicy:$True -AllRequestInPolicy:$False&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;If you want to get fancy you can use the following command to allow all users to submit in-policy requests while allowing user1 to submit out-of-policy requests and adding the ‘Executive Committee’ distribution group members to the book-in policy.&lt;br /&gt;&lt;code&gt;Set-MailboxCalendarSettings resource_alias -AllRequestInPolicy:$true -AllRequestOutOfPolicy:$False -AllBookInPo&lt;br /&gt;licy:$False -BookInPolicy:'Executive Committee' -RequestOutOfPolicy:'user1@domain.com'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Resource Delegates&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;The Set-MailboxCalendarSettings cmdlet allows the administrator to define resource delegates without having to manually configure an Outlook profile and navigate the appropriate menus to define delegates. The feature is one of my favorites and very useful for self-service applications. However it has been a bit buggy. Here are the two bugs I have identified and should be fixed in SP1.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Error message when you try to accept a meeting request on behalf of an Exchange Server 2007 resource mailbox: "Cannot open Calendar folder for user resource_mailbox_name"&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/930865"&gt;http://support.microsoft.com/kb/930865&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;When the Set-MailboxCalendarSettings cmdlet is run to re-apply/add delegates for a resource calendar the original delegate's permissions are removed. The delegate is still displayed when running the ‘Get-MailboxCalendarSettings’ cmdlet however if you look at the permissions on the resource calendar, the delegate’s permissions have been removed. To re-grant permissions on the resource calendar you must run a "Set-MailboxCalendarSettings resource_alias -ResourceDelegates:$null" command. Afterwards you can re-grant permissions to the intended user. Until SP1 is released, I would recommend running this command before making any changes to resource delegates.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Resource Calendar Options&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;In additions to the features offered by the resource booking attendant there are many other calendar customizations that can be defined. Below are a few useful options that we use all the time. A complete list can be found at &lt;a href="http://technet.microsoft.com/en-us/library/aa996340.aspx"&gt;http://technet.microsoft.com/en-us/library/aa996340.aspx&lt;/a&gt;.&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt&gt;-AddAdditionalResonse and –AdditionalResponse&lt;/dt&gt;&lt;dd&gt;Define an additional response text that will accompany any meeting accept/decline/tentative notices.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-AddOrganizerToSubject&lt;/dt&gt;&lt;dd&gt;If set to $True, the calendar attendant will prepend the meeting organizers name to the meeting subject. This is very useful for quickly identifying the meeting organizer while looking at the resource calendar.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-AddRequestsTenatively&lt;/dt&gt;&lt;dd&gt;If set to $true, all meeting requests will be added to the resource calendar and marked as tentative until acted upon by a resource delegate.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-DeleteAttachments&lt;/dt&gt;&lt;dd&gt;If set to $true, attachments will be removed from the meeting information in the resource mailbox.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-DeleteComments, -DeleteSubject&lt;/dt&gt;&lt;dd&gt;See above.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-DeleteNonCalendarItems&lt;/dt&gt;&lt;dd&gt;If set to $true any non-calendar related messages will be deleted.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-BookingWindowInDays&lt;/dt&gt;&lt;dd&gt;Defines a horizon date for meeting scheduling. Also see EnforceSchedulingHorizon.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-ConflictPercentageAllowed&lt;/dt&gt;&lt;dd&gt;If recurring meetings are enabled you can define a conflict percentage to avoid declining a series of meetings because of a single conflict. An allowed percentage of ‘25’ would allow a meeting with 8 occurrences to be accepted as long as no more than 2 conflicts were detected. A separate decline message would be sent to the organizer for the conflicting meeting times.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-MaximumConflictInstances&lt;/dt&gt;&lt;dd&gt;The same as ConflictPercentageAllowed except with a defined static amount of conflicts allowed.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-MaximumDurationInMinutes&lt;/dt&gt;&lt;dd&gt;If you wish to prevent people from scheduling resources for a day, or possibly a few days, you can define this setting to set the maximum meeting duration. Alternatively, if you set the value to ‘0’ meetings of any length will be processed.&lt;/dd&gt;&lt;br /&gt;&lt;dt&gt;-ProcessExternalMeetingMessages&lt;/dt&gt;&lt;dd&gt;If set to $true, meeting requests from external Exchange organizations will be processed.&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;h3&gt;OWA Management&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;If you fear the command line like some of my co-workers (you know who you are… Jon) you can manage most of these settings via connecting to the resource mailbox via OWA and editing the ‘Resource Scheduling Options’. You have the ability to manage all of the calendar settings you would from the command line with the exception of defining resource delegates.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_QfC2byISyLA/RjdS09BYR5I/AAAAAAAAABQ/9M-prCEVsRI/s1600-h/OWAResourceManagement.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_QfC2byISyLA/RjdS09BYR5I/AAAAAAAAABQ/9M-prCEVsRI/s320/OWAResourceManagement.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5059603776061065106" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To open the resource mailbox via OWA you must define full-mailbox access to the managing user. This can be done from the Exchange Management Shell with the following command. &lt;br /&gt;&lt;br /&gt;&lt;code&gt;Add-MailboxPermission resource_alias –User:domain\username –AccessRights:FullAccess&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Further Documentation&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/aa996340.aspx"&gt;Technet Set-MailboxCalendarSettings Documentation&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www.microsoft.com/exchange/evaluation/features/calendarconcierge.mspx"&gt;Microsoft Exchange Server: Calendar Concierge&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/aa996338.aspx"&gt;Managing Resource Scheduling&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/bb124987.aspx"&gt;How to Set Resource Booking Policies&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/bb124542.aspx"&gt;How to Set Scheduling Role Membership&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-8941890814555154497?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/8941890814555154497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=8941890814555154497' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/8941890814555154497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/8941890814555154497'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/05/managing-resource-mailbox-calendars.html' title='Managing Resource Mailbox Calendars'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_QfC2byISyLA/RjdS09BYR5I/AAAAAAAAABQ/9M-prCEVsRI/s72-c/OWAResourceManagement.JPG' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-4153198097216716112</id><published>2007-04-15T20:56:00.000-06:00</published><updated>2008-12-08T16:06:46.861-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange'/><title type='text'>Script: Importing Address Books into Outlook</title><content type='html'>Last year the University decided to use Exchange as the campus calendaring solution.  As you well know, Exchange is a collaboration suite and it is difficult to separate email and calendaring functionality. Thus we also had a large mail migration on our hands.&lt;br /&gt;&lt;br /&gt;Migrating mail was simple enough using a combination of drag-and-drop methods of IMAP folders and the &lt;a href="http://www.aid4mail.com"&gt;Aid4Mail&lt;/a&gt; application to migrate local folders to PST files.  Migrating address books proved to be a little more difficult.  All the documentation on the internet detailed a process of importing a LDIF file into Outlook Express; then converting the Outlook Express address book into Outlook contacts.  We found this solution rather cumbersome and it didn’t always import contacts in the desired format.&lt;br /&gt;&lt;br /&gt;To solve this problem I wrote a VBScript that would parse a LDIF file and create the associated Outlook contacts.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;How it works&lt;/h3&gt;&lt;br /&gt;First, export your address book as an LDIF file from your old IMAP client. If you have multiple address books you will need to export each into its own LDIF file.&lt;br /&gt;&lt;br /&gt;Second, run the ImportLDIF.vbs script from a command prompt using CScript.exe.  The script will parse the specified LDIF file and import any contacts/distribution lists included.  The script will actually parse the LDIF file twice.  The first time it will import any user contacts and the second run will import distribution lists.  The LDIF file is parsed twice to ensure that all the contact objects have been created before creating the distribution lists and adding the members.&lt;br /&gt;&lt;br /&gt;The script accepts 2 parameters: 1) the LDIF file name and 2) an optional category for all the users/groups in the specified LDIF file.  The category option was added for those instances where users previously had multiple address books.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;cscript.exe ‹path›\ImportLdif.vbs ‹path›\‹exported file name›.ldif /Category:"Category Name"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;When the script enters the distribution list import phase you may be prompted in Outlook to allow the script to access your e-mail address stored in Outlook.  Grant the script access for 1 minute to complete the import process.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_QfC2byISyLA/RiLm3tWHNOI/AAAAAAAAABA/Rmd72IAAwEk/s1600-h/ldif_04.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_QfC2byISyLA/RiLm3tWHNOI/AAAAAAAAABA/Rmd72IAAwEk/s320/ldif_04.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5053855576602653922" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Script&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;'# Author: Nick Smith &lt;br /&gt;'#      http://knicksmith.blogspot.com &lt;br /&gt;'# Script Name: ImportLDIF.vbs&lt;br /&gt;'# Purpose: This script will parse a LDIF file and import user&lt;br /&gt;'#  objects as contacts and groups as distribution lists.&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;'Create a shell object&lt;br /&gt;Dim oShell&lt;br /&gt;Set oShell = CreateObject("Wscript.Shell")&lt;br /&gt;&lt;br /&gt;'Ensure the script is run with CScript&lt;br /&gt;CheckForCScript&lt;br /&gt;&lt;br /&gt;'Check arguments&lt;br /&gt;If Wscript.Arguments.UnNamed.Count &lt;&gt; 1 then&lt;br /&gt;  Wscript.Echo "Usage: cscript ImportLdif.vbs LdifFileName [/Category:""My Category Name""] "&lt;br /&gt;  Wscript.Echo vbtab &amp; "/Category" &amp; vbtab &amp; "Optional - Creates a category for the imported address book"&lt;br /&gt;  Wscript.Quit&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Dim olApp&lt;br /&gt;Dim olNS&lt;br /&gt;Dim contact&lt;br /&gt;Dim contactFolder&lt;br /&gt;Dim contactCategory&lt;br /&gt;Dim bMoveToFolder&lt;br /&gt;&lt;br /&gt;Dim mainFSO&lt;br /&gt;Dim objFile&lt;br /&gt;Dim strLine&lt;br /&gt;&lt;br /&gt;Const olContactItem = 2&lt;br /&gt;Const olDistributionListItem = 7&lt;br /&gt;Const olFolderContacts = 10&lt;br /&gt;&lt;br /&gt;'Create Outlook object&lt;br /&gt;Set olApp = CreateObject ("Outlook.Application")&lt;br /&gt;Set olNS = olApp.GetNamespace("MAPI")&lt;br /&gt;&lt;br /&gt;on error resume next&lt;br /&gt;&lt;br /&gt;'Open LDIF file&lt;br /&gt;Set mainfso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;Set objFile = mainFSO.OpenTextFile(Wscript.Arguments.Item(0), 1)&lt;br /&gt;If Err.number &lt;&gt; 0 Then&lt;br /&gt;  'Error Opening File.  Display Error info.&lt;br /&gt;  wscript.echo "Unable to open file: " &amp; Wscript.Arguments.Item(0)&lt;br /&gt;  wscript.echo "Error Number: " &amp; Err.number&lt;br /&gt;  wscript.echo "Error Description: " &amp; Err.Description&lt;br /&gt;  Err.clear&lt;br /&gt;&lt;br /&gt;  'No reason to continue script so quit&lt;br /&gt;  Wscript.quit&lt;br /&gt;End if&lt;br /&gt;&lt;br /&gt;'Save the contacts in the default folder&lt;br /&gt;Set contactFolder = olNS.GetDefaultFolder(olFolderContacts)&lt;br /&gt;&lt;br /&gt;'Create category if needed&lt;br /&gt;If (Wscript.Arguments.Named.Item("Category") &lt;&gt; "") Then&lt;br /&gt;  contactCategory = Wscript.Arguments.Named.Item("Category")&lt;br /&gt;Else&lt;br /&gt;  contactCategory = ""&lt;br /&gt;End if&lt;br /&gt;on error goto 0&lt;br /&gt;'*****************************************************************&lt;br /&gt;' Add Contacts First&lt;br /&gt;'*****************************************************************&lt;br /&gt;&lt;br /&gt;Dim strSplit&lt;br /&gt;Dim bContact&lt;br /&gt;Dim bFullName&lt;br /&gt;&lt;br /&gt;'Start parsing file&lt;br /&gt;Do Until objFile.AtEndOfStream&lt;br /&gt;  strLine=objFile.ReadLine&lt;br /&gt;  &lt;br /&gt;  'Create contact object&lt;br /&gt;  Set contact = olApp.CreateItem(olContactItem)&lt;br /&gt;  bContact = false&lt;br /&gt;  bFullName = false&lt;br /&gt;  Do Until ((Trim(strLine) = "") or (objFile.AtEndOfStream))&lt;br /&gt;    strSplit = Split(Trim(strLine),":")&lt;br /&gt;    select case Trim(Lcase(strSplit(0)))&lt;br /&gt;      case "objectclass"&lt;br /&gt;        if Trim(strSplit(1)) = "person" then&lt;br /&gt;          bContact = true&lt;br /&gt;        end if&lt;br /&gt;      case "givenname"&lt;br /&gt;        contact.FirstName = Trim(strSplit(1))&lt;br /&gt;        bFullName = true&lt;br /&gt;      case "sn"&lt;br /&gt;        contact.LastName = Trim(strSplit(1))&lt;br /&gt;      case "cn"&lt;br /&gt;        contact.FullName = Trim(strSplit(1))&lt;br /&gt;      case "mail"&lt;br /&gt;        contact.Email1Address = Trim(strSplit(1))&lt;br /&gt;        contact.Email1DisplayName = Trim(strSplit(1))&lt;br /&gt;        'Save contact as email address if no name&lt;br /&gt;        If bFullName &lt;&gt; True Then&lt;br /&gt;          contact.FullName = Trim(strSplit(1))&lt;br /&gt;          contact.FileAs = Trim (strSplit(1))&lt;br /&gt;        End If&lt;br /&gt;      case "telephonenumber"&lt;br /&gt;        contact.BusinessTelephoneNumber = Trim(strSplit(1))&lt;br /&gt;      case "homephone"&lt;br /&gt;        contact.HomeTelephoneNumber = Trim(strSplit(1))&lt;br /&gt;      case "facsimiletelephonenumber"&lt;br /&gt;        contact.BusinessFaxNumber = Trim(strSplit(1))&lt;br /&gt;      case "homepostaladdress"&lt;br /&gt;        contact.HomeAddressStreet = Trim(strSplit(1))&lt;br /&gt;      case "mozillahomelocalityname"&lt;br /&gt;        contact.HomeAddressCity = Trim(strSplit(1))&lt;br /&gt;      case "mozillahomestate"&lt;br /&gt;        contact.HomeAddressState = Trim(strSplit(1))&lt;br /&gt;      case "mozillahomepostalcode"&lt;br /&gt;        contact.HomeAddressPostalCode = Trim(strSplit(1))&lt;br /&gt;      case "mozillahomecountryname"&lt;br /&gt;        contact.HomeAddressCountry = Trim(strSplit(1))&lt;br /&gt;      case "postalAddress"&lt;br /&gt;        contact.BusinessAddressStreet = Trim(strSplit(1))&lt;br /&gt;      case "l"&lt;br /&gt;        contact.BusinessAddressCity = Trim(strSplit(1))&lt;br /&gt;      case "st"&lt;br /&gt;        contact.BusinessAddressState = Trim(strSplit(1))&lt;br /&gt;      case "postalcode"&lt;br /&gt;        contact.BusinessAddressPostalCode = Trim(strSplit(1))&lt;br /&gt;      case "c"&lt;br /&gt;        contact.BusinessAddressCountry = Trim(strSplit(1))&lt;br /&gt;      case "title"&lt;br /&gt;        contact.JobTitle = Trim(strSplit(1))&lt;br /&gt;      case "ou"&lt;br /&gt;        contact.Department = Trim(strSplit(1))&lt;br /&gt;      case "o"&lt;br /&gt;        contact.CompanyName = Trim(strSplit(1))&lt;br /&gt;      case "workurl"&lt;br /&gt;        contact.BusinessHomePage = Replace(Trim(strSplit(2)),"//","")&lt;br /&gt;      case "homeurl"&lt;br /&gt;        contact.PersonalHomePage = Replace(Trim(strSplit(2)),"//","")&lt;br /&gt;      case "description"&lt;br /&gt;        contact.Body = Trim(strSplit(1))&lt;br /&gt;      case "xmozillanickname"&lt;br /&gt;        contact.NickName = Trim(strSplit(1))&lt;br /&gt;      'Template fo addistional attributes&lt;br /&gt;      'case ""&lt;br /&gt;      '  contact. = Trim(strSplit(1))&lt;br /&gt;    end select&lt;br /&gt;    strLine=objFile.ReadLine&lt;br /&gt;  Loop&lt;br /&gt;  &lt;br /&gt;  'If this is a contact, save it&lt;br /&gt;  If bContact Then&lt;br /&gt;    contact.Categories = contactCategory&lt;br /&gt;    contact.Save&lt;br /&gt;    wscript.echo "Contact Created:" &amp; contact.FullName&lt;br /&gt;  End If&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;objFile.Close&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'*****************************************************************&lt;br /&gt;' Now Add Distribution Lists&lt;br /&gt;'*****************************************************************&lt;br /&gt;&lt;br /&gt;'Reopen file&lt;br /&gt;Set objFile = mainFSO.OpenTextFile(Wscript.Arguments.Item(0), 1)&lt;br /&gt;&lt;br /&gt;Dim subSplit&lt;br /&gt;Dim bList&lt;br /&gt;Dim list&lt;br /&gt;Dim objRcpnt&lt;br /&gt;&lt;br /&gt;'Start parsing file&lt;br /&gt;Do Until objFile.AtEndOfStream&lt;br /&gt;  strLine=objFile.ReadLine&lt;br /&gt;  &lt;br /&gt;  'Create a distributil list&lt;br /&gt;  Set list = olApp.CreateItem(olDistributionListItem)&lt;br /&gt;  bList = false&lt;br /&gt;  bFullName = false&lt;br /&gt;  Do Until ((Trim(strLine) = "") or (objFile.AtEndOfStream))&lt;br /&gt;    strSplit = Split(Trim(strLine),":")&lt;br /&gt;    select case Trim(Lcase(strSplit(0)))&lt;br /&gt;      case "objectclass"&lt;br /&gt;        if Trim(strSplit(1)) = "groupOfNames" then&lt;br /&gt;          bList = true&lt;br /&gt;        end if&lt;br /&gt;      case "cn"&lt;br /&gt;        list.DLName = Trim(strSplit(1))&lt;br /&gt;      case "description"&lt;br /&gt;        'list.Description = Trim(strSplit(1))&lt;br /&gt;      case "member"&lt;br /&gt;        if (Ubound(strSplit) = 1 ) then&lt;br /&gt;          subSplit = Split(strSplit(1),"mail=")&lt;br /&gt;          if (Ubound(subSplit) = 1) then&lt;br /&gt;            'Create recipient with email address&lt;br /&gt;            set objRcpnt = olApp.Session.CreateRecipient(subSplit(1))&lt;br /&gt;            objRcpnt.Resolve&lt;br /&gt;            list.AddMember objRcpnt&lt;br /&gt;          end if&lt;br /&gt;        end if&lt;br /&gt;    end select&lt;br /&gt;    strLine=objFile.ReadLine&lt;br /&gt;  Loop&lt;br /&gt;  'If distribution list, save it&lt;br /&gt;  If bList Then&lt;br /&gt;    List.Categories = contactCategory&lt;br /&gt;    List.Save&lt;br /&gt;    wscript.echo "List Created:" &amp; list.DLName&lt;br /&gt;  End If&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;objFile.Close&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sub CheckForCScript()&lt;br /&gt;  If Not Lcase(WScript.FullName) = Lcase(WScript.Path &amp; "\cscript.exe") Then&lt;br /&gt;&lt;br /&gt;  UsageString = "Please launch script using cscript.exe" &amp; vbcrlf&lt;br /&gt;  UsageString = UsageString &amp; "Usage: cscript.exe ImportLdif.vbs LdifFileName [/Category:""My Category Name""] " &amp; vbcrlf&lt;br /&gt;  UsageString = UsageString &amp; vbtab &amp; "/Category" &amp; vbtab &amp; "Optional - Creates a category for the imported address book"&lt;br /&gt;  oShell.Popup UsageString&lt;br /&gt;  WScript.Quit 0&lt;br /&gt;  End If&lt;br /&gt;End Sub &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://www.freewebs.com/knicksmith/ImportLdif.zip"&gt;Download the script here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-4153198097216716112?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/4153198097216716112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=4153198097216716112' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4153198097216716112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4153198097216716112'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/04/script-importing-address-books-into.html' title='Script: Importing Address Books into Outlook'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_QfC2byISyLA/RiLm3tWHNOI/AAAAAAAAABA/Rmd72IAAwEk/s72-c/ldif_04.gif' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-4233200750564319673</id><published>2007-04-08T22:20:00.000-06:00</published><updated>2007-07-23T14:39:10.372-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><category scheme='http://www.blogger.com/atom/ns#' term='Backups'/><title type='text'>Script: Exchange 2007 backups with NTBackup</title><content type='html'>&lt;a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntbackup_command.mspx?mfr=true"&gt;NTBackup&lt;/a&gt; is a great solution for Exchange disaster recovery without buying expensive additions to your current backup software. We use NTBackup to backup each Exchange database to its own backup file. Afterwards our primary backup software will send each of those files to tape. Here is a script we use to dynamically backup all the databases on our Exchange servers using NTBackup.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Optimizing NTBackup&lt;/h3&gt;&lt;br /&gt;&lt;a href="http://technet.microsoft.com/en-us/default.aspx"&gt;Technet&lt;/a&gt; has a great article on how &lt;a href="http://www.microsoft.com/technet/itshowcase/content/exchbkup.mspx"&gt;Microsoft IT uses NTBackup&lt;/a&gt; to backup their Exchange 2003 clusters. This article recommends some registry entries to help optimize performance as well as details about an &lt;a href="http://support.microsoft.com/kb/839272"&gt;enhanced NTBackup version&lt;/a&gt; that is included with Windows 2003 Service Pack 1. These performance enhancements cut our backup times by more than half. To start the script I set these registry values.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#Add registry keys to enhance NTBackup performance&lt;br /&gt;New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Logical Disk Buffer Size" -Value:"64" -PropertyType:"String" -Force&lt;br /&gt;New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Max Buffer Size" -Value:"1024" -PropertyType:"String" -Force&lt;br /&gt;New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Max Num Tape Buffers" -Value:"16" -PropertyType:"String" -Force&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Detect Databases on Each Server&lt;/h3&gt;&lt;br /&gt;Next, the script will detect all the mailbox databases on the server. The same steps will be performed for public folder databases.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Get-MailboxDatabase -Server:$ServerName | foreach{&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Creating the Backup Command File&lt;/h3&gt;&lt;br /&gt;Normally a ‘backup command’ or .bks file will be created by the NTBackup GUI. The script will create a .bks file for each database with the correct JET syntax and file encoding.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#Create the backup JET file for NTBackup&lt;br /&gt;$JetBackupSyntax = "JET " + $_.ServerName + "\Microsoft Information Store\" + $_.StorageGroupName + "\" + $_.AdminDisplayName + "`n"&lt;br /&gt;$BksFileName = $BackupScriptPath + $_.ServerName + "" + $_.StorageGroupName + "" + $_.AdminDisplayName + ".bks"&lt;br /&gt;$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Invoking NTBackup&lt;/h3&gt;&lt;br /&gt;The ‘&amp;’ character is an alias for the &lt;a href="http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/invoke-expression.mspx"&gt;Invoke-Expression&lt;/a&gt; cmdlet. I use ‘cmd /c’ to ensure that the script waits for the completion of the database backup before continuing.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#Call NTBackup to backup the database&lt;br /&gt;$BksDescriptiveName = $_.ServerName + "-" + $_.StorageGroupName.Replace(" ","_") + "-" + $_.AdminDisplayName.Replace(" ","_")&lt;br /&gt;&amp;amp;cmd /c "C:\WINDOWS\system32\ntbackup.exe backup `"@$BksFileName`" /n $BksDescriptiveName /d $BksDescriptiveName /v:no /r:no /rs:no /hc:off /m normal /fu /j `"$BksDescriptiveName`" /l:s /f $BackupPath$BksDescriptiveName.bkf"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Compiling a Single Log File&lt;/h3&gt;&lt;br /&gt;Each backup process will create a log file in the format of backup##.log within the %userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\ directory. The script will add the contents of the latest backup file to the backup log for the server.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#Append database backup log to server backup log&lt;br /&gt;&amp;type (get-childitem "$Home\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\" | Sort -Property:LastWriteTime -Descending)[0].FullName &gt;&gt; $BackupLog&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;At the end of the script, this file can be formatted and emailed to the system administrators.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#Add line breaks to format the backup log&lt;br /&gt;$BackupLogFormatted = ""&lt;br /&gt;Get-Content $BackupLog | foreach { $BackupLogFormatted += $_ + "`n" }&lt;br /&gt;&lt;br /&gt;#Email the backup log&lt;br /&gt;$smtp = New-Object Net.Mail.SmtpClient -arg $EmailSMTPServer&lt;br /&gt;$smtp.Send($EmailReportFromAddress,$EmailReportTo,"Exchange Backup Results for " + $ServerName + ": " + $(Get-Date).ToString('MM/dd/yyyy'),$BackupLogFormatted)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Cluster Version&lt;/h3&gt;&lt;br /&gt;To backup our cluster we created separate cluster groups for our backup disk resource. This cluster group is moved to the corresponding active server to write the backup files. Afterwards it is moved to a passive server that sends the backup files to tape. We schedule this script to be run at the same time on all cluster nodes. It tests if a file path exists (that would be owned by an exchange virtual server) and if so perform the backup for the corresponding server node.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;if (Test-Path G:\)&lt;br /&gt;{&lt;br /&gt;write-host ""&lt;br /&gt;write-host "STARTING BACKUP (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;write-host "** Getting Backup Disk..."&lt;br /&gt;CLUSTER GROUP "EXEVS1 Backups" /MOVETO:$env:COMPUTERNAME&lt;br /&gt;write-host "** Performing Backup..."&lt;br /&gt;&lt;br /&gt;#Backup databases on EXEVS1 to the R:\ drive&lt;br /&gt;perform_backup "EXEVS1" "R:\"&lt;br /&gt;&lt;br /&gt;write-host "** Reassign Backup Disk to Server hit by TSM..."&lt;br /&gt;CLUSTER GROUP "EXEVS1 Backups" /MOVETO:$BackupsServer&lt;br /&gt;write-host ""&lt;br /&gt;write-host "BACKUP COMPLETE (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;}&lt;br /&gt;elseif (Test-Path H:\)&lt;br /&gt;{&lt;br /&gt;write-host ""&lt;br /&gt;write-host "STARTING BACKUP (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;write-host "** Getting Backup Disk..."&lt;br /&gt;CLUSTER GROUP "EXEVS2 Backups" /MOVETO:$env:COMPUTERNAME&lt;br /&gt;write-host "** Performing Backup..."&lt;br /&gt;perform_backup "EXEVS2" "S:\"&lt;br /&gt;write-host "** Reassign Backup Disk to Server hit by TSM..."&lt;br /&gt;CLUSTER GROUP "EXEVS2 Backups" /MOVETO:$BackupsServer&lt;br /&gt;write-host ""&lt;br /&gt;write-host "BACKUP COMPLETE (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;}&lt;br /&gt;elseif (Test-Path I:\)&lt;br /&gt;{&lt;br /&gt;write-host ""&lt;br /&gt;write-host "STARTING BACKUP (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;write-host "** Getting Backup Disk..."&lt;br /&gt;CLUSTER GROUP "EXEVS3 Backups" /MOVETO:$env:COMPUTERNAME&lt;br /&gt;write-host "** Performing Backup..."&lt;br /&gt;perform_backup "EXEVS3" "T:\"&lt;br /&gt;write-host "** Reassign Backup Disk to Server hit by TSM..."&lt;br /&gt;CLUSTER GROUP "EXEVS3 Backups" /MOVETO:$BackupsServer&lt;br /&gt;write-host ""&lt;br /&gt;write-host "BACKUP COMPLETE (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;write-host "--- NO BACKUP REQUIRED ---";&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Scheduling the Task&lt;/h3&gt;&lt;br /&gt;Because this script uses PoweSshell with Exchange cmdlets you can’t just schedule the .ps1 file. You must run PowerShell, add in the Exchange PSConsoleFile, and invoke the script as a command.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -command "c:\util\Backup-Databases.ps1"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Script&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;function perform_backup ([string] $ServerName, [string] $BackupRootDrive) {&lt;br /&gt;&lt;br /&gt;### Start User Defined Variables ###&lt;br /&gt;#Set the backup file paths&lt;br /&gt;$BackupScriptPath = $BackupRootDrive + "BackupFiles\"&lt;br /&gt;$BackupPath = $BackupRootDrive + "DailyBackups\"&lt;br /&gt;&lt;br /&gt;#Set email options&lt;br /&gt;$EmailReportTo = "user@domain.com"&lt;br /&gt;$EmailReportFromAddress = "user@domain.com"&lt;br /&gt;$EmailSMTPServer = "smtp.domain.com"&lt;br /&gt;&lt;br /&gt;$BackupLog = $BackupScriptPath + "ExchangeBackupLogs.log"&lt;br /&gt;&lt;br /&gt;### End User Defined Variables ###&lt;br /&gt;&lt;br /&gt;#Create an empty backup log file&lt;br /&gt;new-item $BackupLog -type file -force&lt;br /&gt;&lt;br /&gt;#Add registry keys to enhance NTBackup performance&lt;br /&gt;New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Logical Disk Buffer Size" -Value:"64" -PropertyType:"String" -Force&lt;br /&gt;New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Max Buffer Size" -Value:"1024" -PropertyType:"String" -Force&lt;br /&gt;New-ItemProperty -Path:"HKCU:Software\Microsoft\Ntbackup\Backup Engine" -Name:"Max Num Tape Buffers" -Value:"16" -PropertyType:"String" -Force&lt;br /&gt;&lt;br /&gt;Get-MailboxDatabase -Server:$ServerName | foreach{&lt;br /&gt;&lt;br /&gt;#Create the backup JET file for NTBackup&lt;br /&gt;$JetBackupSyntax = "JET " + $_.ServerName + "\Microsoft Information Store\" + $_.StorageGroupName + "\" + $_.AdminDisplayName + "`n"&lt;br /&gt;$BksFileName = $BackupScriptPath + $_.ServerName + "" + $_.StorageGroupName + "" + $_.AdminDisplayName + ".bks"&lt;br /&gt;$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode&lt;br /&gt;&lt;br /&gt;#Call NTBackup to backup the database&lt;br /&gt;$BksDescriptiveName = $_.ServerName + "-" + $_.StorageGroupName.Replace(" ","_") + "-" + $_.AdminDisplayName.Replace(" ","_")&lt;br /&gt;&amp;cmd /c "C:\WINDOWS\system32\ntbackup.exe backup `"@$BksFileName`" /n $BksDescriptiveName /d $BksDescriptiveName /v:no /r:no /rs:no /hc:off /m normal /fu /j `"$BksDescriptiveName`" /l:s /f $BackupPath$BksDescriptiveName.bkf"&lt;br /&gt;&lt;br /&gt;#Append database backup log to server backup log&lt;br /&gt;&amp;amp;type (get-childitem "$Home\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\" | Sort -Property:LastWriteTime -Descending)[0].FullName &gt;&gt; $BackupLog&lt;br /&gt;}&lt;br /&gt;Get-PublicFolderDatabase -Server:$ServerName | foreach{&lt;br /&gt;&lt;br /&gt;#Create the backup JET file for NTBackup&lt;br /&gt;$JetBackupSyntax = "JET " + $_.ServerName + "\Microsoft Information Store\" + $_.StorageGroupName + "\" + $_.AdminDisplayName + "`n"&lt;br /&gt;$BksFileName = $BackupScriptPath + $_.ServerName + "" + $_.StorageGroupName + "" + $_.AdminDisplayName + ".bks"&lt;br /&gt;$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode&lt;br /&gt;&lt;br /&gt;#Call NTBackup to backup the database&lt;br /&gt;$BksDescriptiveName = $_.ServerName + "-" + $_.StorageGroupName.Replace(" ","_") + "-" + $_.AdminDisplayName.Replace(" ","_")&lt;br /&gt;&amp;cmd /c "C:\WINDOWS\system32\ntbackup.exe backup `"@$BksFileName`" /n $BksDescriptiveName /d $BksDescriptiveName /v:no /r:no /rs:no /hc:off /m normal /fu /j `"$BksDescriptiveName`" /l:s /f $BackupPath$BksDescriptiveName.bkf"&lt;br /&gt;&lt;br /&gt;#Append database backup log to server backup log&lt;br /&gt;&amp;amp;type (get-childitem "$Home\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\" | Sort -Property:LastWriteTime -Descending)[0].FullName &gt;&gt; $BackupLog&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Add line breaks to format the backup log&lt;br /&gt;$BackupLogFormatted = ""&lt;br /&gt;Get-Content $BackupLog | foreach { $BackupLogFormatted += $_ + "`n" }&lt;br /&gt;&lt;br /&gt;#Email the backup log&lt;br /&gt;$smtp = New-Object Net.Mail.SmtpClient -arg $EmailSMTPServer&lt;br /&gt;$smtp.Send($EmailReportFromAddress,$EmailReportTo,"Exchange Backup Results for " + $ServerName + ": " + $(Get-Date).ToString('MM/dd/yyyy'),$BackupLogFormatted)&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;### Start of backup script ###&lt;br /&gt;&lt;br /&gt;#Define backup server&lt;br /&gt;#The cluster backup resource will be moved to this server upon completion&lt;br /&gt;$BackupsServer = "BackupServerName"&lt;br /&gt;&lt;br /&gt;if (Test-Path G:\)&lt;br /&gt;{&lt;br /&gt;write-host ""&lt;br /&gt;write-host "STARTING BACKUP (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;write-host "** Getting Backup Disk..."&lt;br /&gt;CLUSTER GROUP "EXEVS1 Backups" /MOVETO:$env:COMPUTERNAME&lt;br /&gt;write-host "** Performing Backup..."&lt;br /&gt;&lt;br /&gt;#Backup databases on EXEVS1 to the R:\ drive&lt;br /&gt;perform_backup "EXEVS1" "R:\"&lt;br /&gt;&lt;br /&gt;write-host "** Reassign Backup Disk to Server hit by TSM..."&lt;br /&gt;CLUSTER GROUP "EXEVS1 Backups" /MOVETO:$BackupsServer&lt;br /&gt;write-host ""&lt;br /&gt;write-host "BACKUP COMPLETE (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;}&lt;br /&gt;elseif (Test-Path H:\)&lt;br /&gt;{&lt;br /&gt;write-host ""&lt;br /&gt;write-host "STARTING BACKUP (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;write-host "** Getting Backup Disk..."&lt;br /&gt;CLUSTER GROUP "EXEVS2 Backups" /MOVETO:$env:COMPUTERNAME&lt;br /&gt;write-host "** Performing Backup..."&lt;br /&gt;perform_backup "EXEVS2" "S:\"&lt;br /&gt;write-host "** Reassign Backup Disk to Server hit by TSM..."&lt;br /&gt;CLUSTER GROUP "EXEVS2 Backups" /MOVETO:$BackupsServer&lt;br /&gt;write-host ""&lt;br /&gt;write-host "BACKUP COMPLETE (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;}&lt;br /&gt;elseif (Test-Path I:\)&lt;br /&gt;{&lt;br /&gt;write-host ""&lt;br /&gt;write-host "STARTING BACKUP (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;write-host "** Getting Backup Disk..."&lt;br /&gt;CLUSTER GROUP "EXEVS3 Backups" /MOVETO:$env:COMPUTERNAME&lt;br /&gt;write-host "** Performing Backup..."&lt;br /&gt;perform_backup "EXEVS3" "T:\"&lt;br /&gt;write-host "** Reassign Backup Disk to Server hit by TSM..."&lt;br /&gt;CLUSTER GROUP "EXEVS3 Backups" /MOVETO:$BackupsServer&lt;br /&gt;write-host ""&lt;br /&gt;write-host "BACKUP COMPLETE (" $(get-date).Tostring("yyyy-MM-dd HH:mm:ss") ")"&lt;br /&gt;write-host ""&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;write-host "--- NO BACKUP REQUIRED ---";&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.freewebs.com/knicksmith/Backup-Databases.zip"&gt;Download the clustered and standalone server scripts here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-4233200750564319673?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/4233200750564319673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=4233200750564319673' title='29 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4233200750564319673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4233200750564319673'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/04/script-exchange-2007-backups-with.html' title='Script: Exchange 2007 backups with NTBackup'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>29</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-8199819607409328825</id><published>2007-04-06T21:18:00.000-06:00</published><updated>2007-04-06T21:53:04.118-06:00</updated><title type='text'>5 things you don't know about me</title><content type='html'>&lt;a href="http://blogs.technet.com/evand/archive/2007/04/05/ack-i-ve-been-tagged.aspx"&gt;Evan&lt;/a&gt; tagged me so with a '5 things you don't know about me' post. So here it goes:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I am a hockey fanatic. It started when I was a kid watching &lt;a href="http://denverpioneers.cstv.com/sports/m-hockey/denv-m-hockey-body.html"&gt;DU hockey&lt;/a&gt; and with the NHL playoffs about to start, this is my favorite time of the year. Too bad it looks like my team is going to finish just out of the playoffs this year despite a &lt;a href="http://www.denverpost.com/sports/ci_5606121"&gt;valiant effort&lt;/a&gt;.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;In grade school I told a teacher I did not need to write my term paper because I was going to play professional baseball. I was promptly suspended for the remainder of the season.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;To relax on the weekends and vacations I like to ride &lt;a href="http://www.freewebs.com/knicksmith/Ouray.JPG"&gt;dirt bikes&lt;/a&gt;. My favorite place to ride is &lt;a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;q=ouray,+co&amp;layer=&amp;ie=UTF8&amp;z=12&amp;ll=38.022672,-107.670822&amp;spn=0.168225,0.374222&amp;t=k&amp;om=1&amp;iwloc=addr"&gt;Ouray, CO&lt;/a&gt; but I am going to give Moab a try in June.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I once wrote my own intrusion detection program that would compare the MD5 hashes of a file system and report any files that had been changed since the last scan.....in VBScript.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Today I forwarded my desk phone line to &lt;a href="http://www.microsoft.com/technet/prodtechnol/beta/ocs/default.mspx"&gt;Office Communications Server&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;Now it's my turn: &lt;a href="http://blogs.msdn.com/mstehle/default.aspx"&gt;Matt Stehle&lt;/a&gt; and &lt;a href="http://joshmaher.wordpress.com/"&gt;Josh Maher&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-8199819607409328825?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/8199819607409328825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=8199819607409328825' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/8199819607409328825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/8199819607409328825'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/04/5-things-you-dont-know-about-me.html' title='5 things you don&apos;t know about me'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-4745954497047322020</id><published>2007-04-01T22:00:00.000-06:00</published><updated>2007-04-01T22:14:40.771-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange'/><title type='text'>Delegating Distribution Group Management Via Outlook</title><content type='html'>Managing distribution lists is normally a duty of Exchange and/or Active Directory administrators.  The process for adding or removing a member of a distribution list is likely to submit a request and wait until an administrator makes the necessary changes.&lt;br /&gt;&lt;br /&gt;Using a combination of Active Directory permissions and the built-in tools of Outlook you can delegate the ability to manage distribution lists to the user.  Here’s how to do it:&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Adding Permissions&lt;/h3&gt;&lt;br /&gt;For a user to have the ability to manage distribution group membership they must be assigned the ‘Write Members’ active directory permission. This can be done in ADUC, but I find PowerShell much simpler.&lt;br /&gt;&lt;br /&gt;Adding permission for a single user:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Add-ADPermission -Identity:'Group Display Name’ -User:domain\username -AccessRights ReadProperty, WriteProperty -Properties 'Member'&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Adding permission for a group of users:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Add-ADPermission -Identity:'Group Display Name’ -User:'Display Name of Permissions Group’ -AccessRights ReadProperty, WriteProperty -Properties 'Member'&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Modifying Group Membership within Outlook&lt;/h3&gt;&lt;br /&gt;After locating the group within the Global Address List, select ‘Modify Members…’ from the properties screen.  To add new members select the ‘Add…’ option and located the desired users within the GAL. Members can be removed by highlighting the desired user and selecting the ‘Remove’ button.&lt;br /&gt;&lt;br /&gt;If you receive a “Changes to the distribution list membership cannot be saved. You do not have sufficient permission to perform this operation on this object” error message either permissions are not assigned correctly or the user is not connecting a global catalog from the domain hosting the distribution group. &lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-4745954497047322020?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/4745954497047322020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=4745954497047322020' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4745954497047322020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/4745954497047322020'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/04/delegating-distribution-group.html' title='Delegating Distribution Group Management Via Outlook'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-3511589211600319636</id><published>2007-03-27T21:37:00.000-06:00</published><updated>2007-04-08T22:40:48.925-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Managing Exchange 2007 Recipients with C#</title><content type='html'>During our Exchange 2007 implementation I was faced with the task of integrating Exchange 2007 recipient management with our in-house identity management systems. Our active directory provisioning code was already written in .Net and implemented CDOEXM for recipient management. One of the things that concerned me the most about migrating to Exchange 2007 was the ability to manage recipients from within the existing code. CDOEXM is not supported for managing Exchange 2007 recipients and the idea of invoking the Exchange management shell from .Net code was a foreign concept to me. Information on how to do so was sparse. Many many thanks to &lt;a href="http://www.viveksharma.com/techlog"&gt;Vivek Sharma&lt;/a&gt; for posting sample code before anything else was available. My early code was based directly off his examples. Since then I have created a few applications using these methods and I have learned quite a few lessons while doing so. Below are some of my experiences and customizations that made the process much simpler.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Web References&lt;/h3&gt;&lt;br /&gt;First, here are some helpful links to get started with invoking the management shell from C# code:&lt;br /&gt;&lt;br /&gt;Creating Applications that Use the Default Host&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms714671.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms714671.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Mstehle's Introduction to Exchange Powershell Automation&lt;br /&gt;Part 1: &lt;a href="http://blogs.msdn.com/mstehle/archive/2007/01/25/fyi-introduction-to-exchange-powershell-automation-part-1.aspx"&gt;http://blogs.msdn.com/mstehle/archive/2007/01/25/fyi-introduction-to-exchange-powershell-automation-part-1.aspx&lt;/a&gt;&lt;br /&gt;Part 2: &lt;a href="http://blogs.msdn.com/mstehle/archive/2007/01/25/outbox-introduction-to-exchange-powershell-automation-part-2.aspx"&gt;http://blogs.msdn.com/mstehle/archive/2007/01/25/outbox-introduction-to-exchange-powershell-automation-part-2.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sample Code: Calling Exchange cmdlets from .Net code&lt;br /&gt;&lt;a href="http://www.viveksharma.com/techlog/2006/07/27/sample-code-calling-exchange-cmdlets-from-net-code"&gt;http://www.viveksharma.com/techlog/2006/07/27/sample-code-calling-exchange-cmdlets-from-net-code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Caveats&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Creating the necessary Runspace and RunspaceInvoke instances will take 2-3 seconds to get setup in a compiled application. &lt;/li&gt;&lt;li&gt;It can take 6-9 seconds to execute the first Exchange command on a computer with only the Exchange 2007 management tools installed. You may also receive the following errors in the event log:&lt;br /&gt;&lt;br /&gt;Event Type: Error&lt;br /&gt;Event Source: MSExchange ADAccess&lt;br /&gt;Event Category: General&lt;br /&gt;Event ID: 2152&lt;br /&gt;Date: 3/26/2007&lt;br /&gt;Time: 7:38:52 PM&lt;br /&gt;User: N/A&lt;br /&gt;Computer: HASTY&lt;br /&gt;Description:&lt;br /&gt;Process eIDAD.exe (PID=2984). A remote procedure call (RPC) request to the Microsoft Exchange Active Directory Topology service failed with error 1753 (Error 6d9 from HrGetServersForRole). Make sure that the Remote Procedure Call (RPC) service is running. In addition, make sure that the network ports that are used by RPC are not blocked by a firewall.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Event Type: Error&lt;br /&gt;Event Source: MSExchange Common&lt;br /&gt;Event Category: Devices&lt;br /&gt;Event ID: 106&lt;br /&gt;Date: 3/26/2007&lt;br /&gt;Time: 7:38:57 PM&lt;br /&gt;User: N/A&lt;br /&gt;Computer: HASTY&lt;br /&gt;Description:&lt;br /&gt;Performance counter updating error. Counter name is Latest Exchange Topology Discovery Time in Seconds, category name is MSExchange Topology. Optional code: 2. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Invoking the Runspace and adding the Exchange management snap-in does not give you the same environment as opening the Exchange Management Shell. One of the most striking differences is that the $AdminSessionADSettings environment settings are not available. By default, all Exchange management cmdlets will search the entire forest. You can best replicate this environment by starting a normal PowerShell instance and add the Microsoft.Exchange.Management.Powershell.Admin snap-in. (Run “Add-PSSnapin -Name:’Microsoft.Exchange.Management.PowerShell.Admin’ ”). &lt;/li&gt;&lt;li&gt;To compile your code you must add a reference for Systems.Management.Automation. By default this is added to the global assembly cache when PowerShell is installed. The best way to add this DLL as a reference is to manually edit the .csproj file associated with the project and add the following line to the references itemgroup.&lt;br /&gt;&lt;pre&gt;&amp;lt;reference include="System.Management.Automation"&amp;gt;&lt;/pre&gt;&lt;br /&gt;Adding the reference in this manner will ensure that you are always using the appropriate DLL whether you are running on a 32 or 64 bit machine.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Birth of the wrapper class&lt;/h3&gt;&lt;br /&gt;My first attempt at integrating recipient management into our identity management provisioning code worked well but I paid quite a time penalty when invoking the shell and issuing commands to update/set attributes on each account. Updating a single account was not too bad (~1 second per account) after the Runspace was completely setup and all the Exchange DLLs were loaded. However, when updating all 60,000+ accounts the time penalty added up and became an unacceptable bottleneck. To prevent this, I implemented logic to check if each attribute needed to be updated before invoking the command to set the attribute. This logic removed the bottleneck and very soon the code was running just as quickly as before; except for the time needed to create the Runspace. These optimizations made the Runspace unnecessary for most instances when an update was run on a single account and no Exchange attributes were changed. Thus the wrapper class was setup to store a Runspace that would only be initialized if a command was invoked.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Notes About the Wrapper Class&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The wrapper class is a singleton and must me instantiated as such. Because the class is a singleton, only one Runspace will be created no matter how many times the class is instantiated. &lt;/li&gt;&lt;li&gt;The Runspace is only created once the first command is invoked. The same is true with RunspaceInvoke. &lt;/li&gt;&lt;li&gt;The wrapper class combines methods from both the Runspace and RunspaceInvoke classes. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Wrapper Class&lt;/h3&gt;&lt;br /&gt;&lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.IO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Text;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Reflection;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Diagnostics;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Collections;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Collections.ObjectModel;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Management.Automation;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Management.Automation.Host;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;using&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; System.Management.Automation.Runspaces;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;namespace&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; EMSDemo.Utility&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;   &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:blue'&gt;sealed&lt;/span&gt; &lt;span style='color:blue'&gt;class&lt;/span&gt; &lt;span style='color:teal'&gt;ExchangeManagementShellWrapper&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;   &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;#region&lt;/span&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; Variable Declaration&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:teal'&gt;RunspaceConfiguration&lt;/span&gt; rc;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//RunspaceConfiguration&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:teal'&gt;Runspace&lt;/span&gt; r;&lt;span style='mso-spacerun:yes'&gt;                       &lt;/span&gt;&lt;span style='color:green'&gt;//Runspace&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:teal'&gt;RunspaceInvoke&lt;/span&gt; ri;&lt;span style='mso-spacerun:yes'&gt;                &lt;/span&gt;&lt;span style='color:green'&gt;//RunspaceInvoke&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:blue'&gt;static&lt;/span&gt; &lt;span style='color:blue'&gt;readonly&lt;/span&gt; &lt;span style='color:teal'&gt;ExchangeManagementShellWrapper&lt;/span&gt; instance = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;ExchangeManagementShellWrapper&lt;/span&gt;(); &lt;span style='color:green'&gt;//Singleton instance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;#endregion&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; ExchangeManagementShellWrapper(){}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:blue'&gt;static&lt;/span&gt; &lt;span style='color:teal'&gt;ExchangeManagementShellWrapper&lt;/span&gt; Instance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; instance;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:blue'&gt;void&lt;/span&gt; InitializeRunspace()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Setup Runspace environment for Exchange Management Shell&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;AppDomain&lt;/span&gt;.CurrentDomain.AssemblyResolve += &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;ResolveEventHandler&lt;/span&gt;(AssemblyResolver);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create RunspaceConfiguration&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;rc = &lt;span style='color:teal'&gt;RunspaceConfiguration&lt;/span&gt;.Create();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Add PSSnapIn for Exchange 2007 and check for warnings&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;PSSnapInException&lt;/span&gt; warning;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;PSSnapInInfo&lt;/span&gt; info = rc.AddPSSnapIn(&lt;span style='color:maroon'&gt;&amp;quot;Microsoft.Exchange.Management.PowerShell.Admin&amp;quot;&lt;/span&gt;, &lt;span style='color:blue'&gt;out&lt;/span&gt; warning);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (warning != &lt;span style='color:blue'&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;&lt;span style='color:green'&gt;// A warning is not expected, but if one is detected&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;&lt;span style='color:green'&gt;// write the warning and return.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;System.&lt;span style='color:teal'&gt;Console&lt;/span&gt;.Write(warning.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create and open runspace&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;r = &lt;span style='color:teal'&gt;RunspaceFactory&lt;/span&gt;.CreateRunspace(rc);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;r.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:blue'&gt;void&lt;/span&gt; InitializeRunspaceInvoke()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create runspace if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (r == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspace(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create RunspaceInvoke&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;ri = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;RunspaceInvoke&lt;/span&gt;(r);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; RunspaceInvoke(&lt;span style='color:blue'&gt;string&lt;/span&gt; EMSCommand)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;    &lt;/span&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create RunspaceInvoke if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (ri == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspaceInvoke(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the commmand and return the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; ri.Invoke(EMSCommand);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; RunspaceInvoke(&lt;span style='color:blue'&gt;string&lt;/span&gt; EMSCommand, &lt;span style='color:teal'&gt;IEnumerable&lt;/span&gt; input)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create RunspaceInvoke if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (ri == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspaceInvoke(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the commmand and return the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;    &lt;/span&gt;&lt;span style='mso-spacerun:yes'&gt;     &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; ri.Invoke(EMSCommand, input);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; RunspaceInvoke(&lt;span style='color:blue'&gt;string&lt;/span&gt; EMSCommand, &lt;span style='color:blue'&gt;out&lt;/span&gt; &lt;span style='color:teal'&gt;IList&lt;/span&gt; errors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the RunspaceInvoke method with a null input&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; RunspaceInvoke(EMSCommand, &lt;span style='color:blue'&gt;null&lt;/span&gt;, &lt;span style='color:blue'&gt;out&lt;/span&gt; errors);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; RunspaceInvoke(&lt;span style='color:blue'&gt;string&lt;/span&gt; EMSCommand, &lt;span style='color:teal'&gt;IEnumerable&lt;/span&gt; input, &lt;span style='color:blue'&gt;out&lt;/span&gt; &lt;span style='color:teal'&gt;IList&lt;/span&gt; errors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create RunspaceInvoke if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (ri == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspaceInvoke(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the commmand and return the results and errors&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; ri.Invoke(EMSCommand, input, &lt;span style='color:blue'&gt;out&lt;/span&gt; errors);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; PipelineInvoke(&lt;span style='color:teal'&gt;Collection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;Command&lt;/span&gt;&amp;gt; EMSCommands, &lt;span style='color:blue'&gt;out&lt;/span&gt; &lt;span style='color:teal'&gt;PipelineReader&lt;/span&gt;&amp;lt;&lt;span style='color:blue'&gt;object&lt;/span&gt;&amp;gt; Errors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Runspace if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (r == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspace(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Pipeline and add the commands&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;Pipeline&lt;/span&gt; pipeline = r.CreatePipeline();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:teal'&gt;Command&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; EMSCommands)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;pipeline.Commands.Add(item);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the commands and return the results and errors&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; results = pipeline.Invoke();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;Errors = pipeline.Error;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;pipeline = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; results;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; PipelineInvoke(&lt;span style='color:teal'&gt;Collection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;Command&lt;/span&gt;&amp;gt; EMSCommands)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Runspace if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (r == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspace(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Pipeline and add the commands&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;Pipeline&lt;/span&gt; pipeline = r.CreatePipeline();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:teal'&gt;Command&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; EMSCommands)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;pipeline.Commands.Add(item);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the commands and return the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; pipeline.Invoke();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; PipelineInvoke(&lt;span style='color:teal'&gt;Command&lt;/span&gt; EMSCommand, &lt;span style='color:blue'&gt;out&lt;/span&gt; &lt;span style='color:teal'&gt;PipelineReader&lt;/span&gt;&amp;lt;&lt;span style='color:blue'&gt;object&lt;/span&gt;&amp;gt; Errors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Runspace if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (r == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspace(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Pipeline and add the command&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;Pipeline&lt;/span&gt; pipeline = r.CreatePipeline();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;pipeline.Commands.Add(EMSCommand);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the command and return the results and errors&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; results = pipeline.Invoke();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;Errors = pipeline.Error;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;pipeline = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; results;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; PipelineInvoke(&lt;span style='color:teal'&gt;Command&lt;/span&gt; EMSCommand)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Runspace if it has not already been created&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (r == &lt;span style='color:blue'&gt;null&lt;/span&gt;) { InitializeRunspace(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Create Pipeline and add teh command&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:teal'&gt;Pipeline&lt;/span&gt; pipeline = r.CreatePipeline();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;pipeline.Commands.Add(EMSCommand);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Invoke the command and return the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; pipeline.Invoke();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;public&lt;/span&gt; &lt;span style='color:blue'&gt;void&lt;/span&gt; Dispose()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Close the Runspace and cleanup&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;r.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;ri = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;r = &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;&lt;span style='color:blue'&gt;private&lt;/span&gt; &lt;span style='color:blue'&gt;static&lt;/span&gt; System.Reflection.&lt;span style='color:teal'&gt;Assembly&lt;/span&gt; AssemblyResolver(&lt;span style='color:blue'&gt;object&lt;/span&gt; p, &lt;span style='color:teal'&gt;ResolveEventArgs&lt;/span&gt; args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:green'&gt;//Add path for the Exchange 2007 DLLs&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (args.Name.Contains(&lt;span style='color:maroon'&gt;&amp;quot;Microsoft.Exchange&amp;quot;&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; &lt;span style='color:teal'&gt;Assembly&lt;/span&gt;.LoadFrom(&lt;span style='color:teal'&gt;Path&lt;/span&gt;.Combine(&lt;span style='color:maroon'&gt;&amp;quot;C:\\Program Files\\Microsoft\\Exchange Server\\bin\\&amp;quot;&lt;/span&gt;, args.Name.Split(&lt;span style='color:maroon'&gt;','&lt;/span&gt;)[0] + &lt;span style='color:maroon'&gt;&amp;quot;.dll&amp;quot;&lt;/span&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;&lt;span style='color:blue'&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;            &lt;/span&gt;&lt;span style='color:blue'&gt;return&lt;/span&gt; &lt;span style='color:blue'&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;         &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;   &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Examples&lt;/h3&gt;&lt;br /&gt;Each example will perform the same task and produce the same results using both the RuspaceInvoke and PipelineInvoke methods. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Initializing the Exchange Management Shell Wrapper&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Singleton_pattern"&gt;Singletons&lt;/a&gt; do not have a constructor so you must create an ‘instance’.&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;static&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; &lt;span style='color:blue'&gt;void&lt;/span&gt; Main(&lt;span style='color:blue'&gt;string&lt;/span&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:green'&gt;//Initialize the ExchangeManagementShellWrapper&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;ExchangeManagementShellWrapper&lt;/span&gt; ems = &lt;span style='color:teal'&gt;ExchangeManagementShellWrapper&lt;/span&gt;.Instance;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;ICollection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;PSObject&lt;/span&gt;&amp;gt; results;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;line-height:115%;font-family: "Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;...&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Invoking a Single Command&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In this example both the RunspaceInvoke and PipelineInvoke methods are used to get information about the mailbox for ‘knsmith’.  In each foreach loop are different methods for accessing the data within the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.management.automation.psobject.aspx"&gt;PSObject&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Use the RunspaceInvoke command with a command string&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;results = ems.RunspaceInvoke(&lt;span style='color:maroon'&gt;&amp;quot;Get-Mailbox knsmith&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:teal'&gt;PSObject&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; results)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(item.Members[&lt;span style='color:maroon'&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;].Value.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Use the PipelineInvoke command with a Command object&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;Command&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; EMSCommand = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;Command&lt;/span&gt;(&lt;span style='color:maroon'&gt;&amp;quot;Get-Mailbox&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;EMSCommand.Parameters.Add(&lt;span style='color:maroon'&gt;&amp;quot;Identity&amp;quot;&lt;/span&gt;, &lt;span style='color:maroon'&gt;&amp;quot;knsmith&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;results = ems.PipelineInvoke(EMSCommand);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:teal'&gt;PSObject&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; results)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;//A different way of accessing property info from the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;PSPropertyInfo&lt;/span&gt; prop = (&lt;span style='color:teal'&gt;PSPropertyInfo&lt;/span&gt;)item.Properties[&lt;span style='color:maroon'&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:blue'&gt;if&lt;/span&gt; (prop != &lt;span style='color:blue'&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;    &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(prop.Value.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Invoking Commands With Errors Ouput&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In this example each command will attempt to create a new file at c:\temp called test.ps1.  A new file will be created it one does not already exist.  If the file does exist, an error will be returned and the output will be: “Error: The file ‘C:\temp\test.ps1’ already exists.&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Using RunspaceInvoke with errors&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;IList&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; IErrors;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;results = ems.RunspaceInvoke(&lt;span style='color:maroon'&gt;&amp;quot;New-Item -Path:'c:\\temp\\test.ps1' -Type:File&amp;quot;&lt;/span&gt;, &lt;span style='color:blue'&gt;out&lt;/span&gt; IErrors);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:teal'&gt;PSObject&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; results)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(item.Members[&lt;span style='color:maroon'&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;].Value.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:blue'&gt;object&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; IErrors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:maroon'&gt;&amp;quot;Error: {0}&amp;quot;&lt;/span&gt;, item.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Using PipelineInvoke with errors&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;EMSCommand = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;Command&lt;/span&gt;(&lt;span style='color:maroon'&gt;&amp;quot;New-Item&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;EMSCommand.Parameters.Add(&lt;span style='color:maroon'&gt;&amp;quot;Path&amp;quot;&lt;/span&gt;, &lt;span style='color:maroon'&gt;&amp;quot;c:\\temp\\test.ps1&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;EMSCommand.Parameters.Add(&lt;span style='color:maroon'&gt;&amp;quot;Type&amp;quot;&lt;/span&gt;, &lt;span style='color:maroon'&gt;&amp;quot;File&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;PipelineReader&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&amp;lt;&lt;span style='color:blue'&gt;object&lt;/span&gt;&amp;gt; errors;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;results = ems.PipelineInvoke(EMSCommand, &lt;span style='color:blue'&gt;out&lt;/span&gt; errors);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:teal'&gt;PSObject&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; results)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(item.Members[&lt;span style='color:maroon'&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;].Value.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;if&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (errors.Count &amp;gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:blue'&gt;foreach&lt;/span&gt; (&lt;span style='color:blue'&gt;object&lt;/span&gt; obj &lt;span style='color:blue'&gt;in&lt;/span&gt; errors.ReadToEnd())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;    &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(&lt;span style='color:maroon'&gt;&amp;quot;Error: {0}&amp;quot;&lt;/span&gt;, obj.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;line-height:115%;font-family: "Courier New";mso-no-proof:yes'&gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Invoking Multiple Commands&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Invoking multiple commands using a pipe is one of my most common tasks in PowerShell.  The RunspaceInvoke method is pretty straight forward as you can just pass in a command string the same as you use in the Exchange Management Shell.  The PipelineInvoke method is a little different.  You must create a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.management.automation.runspaces.command.aspx"&gt;Command&lt;/a&gt; object for each command you wish to issue.  After the Command objects have been created, add them in the order they are to be executed to the collection.&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Using the RunspaceInvoke command with a command string&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;ems.RunspaceInvoke(&lt;span style='color:maroon'&gt;&amp;quot;Get-Mailbox knsmith | Set-Mailbox -EmailAddressPolicyEnabled:$True&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Using PipelineInvoke with a Command Collection&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;Collection&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&amp;lt;&lt;span style='color:teal'&gt;Command&lt;/span&gt;&amp;gt; CommandsList = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;Collection&lt;/span&gt;&amp;lt;&lt;span style='color:teal'&gt;Command&lt;/span&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;Command&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; GetMailbox = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;Command&lt;/span&gt;(&lt;span style='color:maroon'&gt;&amp;quot;Get-Mailbox&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;GetMailbox.Parameters.Add(&lt;span style='color:maroon'&gt;&amp;quot;Identity&amp;quot;&lt;/span&gt;, &lt;span style='color:maroon'&gt;&amp;quot;knsmith&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;CommandsList.Add(GetMailbox);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;Command&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; SetMailbox = &lt;span style='color:blue'&gt;new&lt;/span&gt; &lt;span style='color:teal'&gt;Command&lt;/span&gt;(&lt;span style='color:maroon'&gt;&amp;quot;Set-Mailbox&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;SetMailbox.Parameters.Add(&lt;span style='color:maroon'&gt;&amp;quot;EmailAddressPolicyEnabled&amp;quot;&lt;/span&gt;, &lt;span style='color:blue'&gt;true&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;CommandsList.Add(SetMailbox);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;ems.PipelineInvoke(CommandsList, &lt;span style='color:blue'&gt;out&lt;/span&gt; errors);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Passing an Input Object to the Runspace&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The RunspaceInvoke method offers the added ability to pass in an input collection.  The key to this is that you must start your command string with “$input | ” so that your input will be processed.  This example will show how you can get the attributes for a mailbox, make a change and commit the changes by passing back the results and using the Set-Mailbox cmdlet.&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Use the RunspaceInvoke command with a command string&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;results = ems.RunspaceInvoke(&lt;span style='color:maroon'&gt;&amp;quot;Get-Mailbox knsmith&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:teal'&gt;PSObject&lt;/span&gt; item &lt;span style='color:blue'&gt;in&lt;/span&gt; results)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:green'&gt;//Set the property to false&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;item.Members[&lt;span style='color:maroon'&gt;&amp;quot;UseDatabaseQuotaDefaults&amp;quot;&lt;/span&gt;].Value = &lt;span style='color:blue'&gt;false&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:teal;mso-no-proof:yes'&gt;IList&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; SetErrors;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//Save the changes we made to the results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:green;mso-no-proof:yes'&gt;//The $input variable will be equal to the 'results' variable we pass in&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;ems.RunspaceInvoke(&lt;span style='color:maroon'&gt;&amp;quot;$input | Set-Mailbox&amp;quot;&lt;/span&gt;, results, &lt;span style='color:blue'&gt;out&lt;/span&gt; SetErrors);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'&gt;foreach&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt; (&lt;span style='color:blue'&gt;object&lt;/span&gt; error &lt;span style='color:blue'&gt;in&lt;/span&gt; SetErrors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none'&gt;&lt;span style='font-size: 10.0pt;font-family:"Courier New";mso-no-proof:yes'&gt;&lt;span style='mso-spacerun:yes'&gt;  &lt;/span&gt;&lt;span style='color:teal'&gt;Console&lt;/span&gt;.WriteLine(error.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class=MsoNormal&gt;&lt;span style='font-size:10.0pt;line-height:115%;font-family: "Courier New";mso-no-proof:yes'&gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.freewebs.com/knicksmith/EMSDemo.zip"&gt;Download the wrapper class and example code.&lt;/a&gt; (Right-click and 'Save Target As')&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusion&lt;/h3&gt;&lt;br /&gt;Whether or not you decide to use this wrapper class I hope it at least helps you with examples of how to utilize the RunspaceInvoke and Pipeline methods for invoking the Exchange management shell.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-3511589211600319636?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/3511589211600319636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=3511589211600319636' title='60 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/3511589211600319636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/3511589211600319636'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/managing-exchange-2007-recipients-with.html' title='Managing Exchange 2007 Recipients with C#'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>60</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-8663474309007281513</id><published>2007-03-22T19:41:00.000-06:00</published><updated>2007-03-22T19:46:15.744-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blackberry'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Granting Blackberry Permissions on Exchange 2007</title><content type='html'>One of the requirements for deploying a Blackberry Enterprise Server is to grant the Blackberry service account privileges on user mailboxes.  The Blackberry service account must be granted ‘full mailbox access’ and the ‘send-as’ permissions to work properly. Here are two methods of accomplishing this task using PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Single User Method&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\ &gt;Add-MailboxPermission username@domain –user domain\besadmin –AccessRights FullAccess&lt;br /&gt;[PS] C:\ &gt;Add-ADPermission username@domain –user domain\besadmin -ExtendedRights Send-As, Receive-As&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The first command will grant the Blackberry service account (besadmin) full mailbox access to the user’s mailbox.  The second command will assign the appropriate active directory permissions so the service account can send and receive email as the user.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Server Method&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\ &gt;Get-MailboxServer | Add-ADPermission -User domain\besadmin -AccessRights GenericRead, GenericWrite -ExtendedRights Send-As, Receive-As, ms-Exch-Store-Admin&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This method will grant all the necessary permissions to the service account on ALL mailboxes hosted on Exchange 2007 servers.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-8663474309007281513?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/8663474309007281513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=8663474309007281513' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/8663474309007281513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/8663474309007281513'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/granting-blackberry-permissions-on.html' title='Granting Blackberry Permissions on Exchange 2007'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-1803083510530944387</id><published>2007-03-21T19:12:00.000-06:00</published><updated>2008-12-08T16:06:47.372-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><title type='text'>Exchange 2007 and Outlook 2003: Where are my attachments?</title><content type='html'>A few months ago, I received a phone call from one of our college IT administrators inquiring about emails with missing attachments. At first I thought he was referring to attachment types that we block with ForeFront (e.g. executables, scripts, harmful files). However, when he started complaining about intermittent missing jpg attachments I started investigating further. I had users forward the messages with missing attachments to me and I could see the attachments just fine. I opened the user’s mailbox via OWA and again I could see the attachments. It wasn’t until I visited the user’s office that I was able to see (and believe) the problem. Outlook 2003 would display the message, but no indications that it contained attachments. After a little troubleshooting we were able to determine that Outlook 2007, OWA, and IMAP clients were able to display all the attachments properly.&lt;br /&gt;&lt;br /&gt;I collected all the information I could about the messages, message types, senders, etc. and submitted the problem to Microsoft. (That was a fun one to describe with PSS.) After a few days of back and forth they determined:&lt;br /&gt;&lt;blockquote&gt;"The issue seems to be caused by our Content Conversion engine setting a MAPI property on the message to tell Outlook to “hide” the attachments. The code only seems to do this if the MIME is formed where the Content-Disposition MIME header is set to “inline”. This is definitely a change in behavior from Exchange 2003…"&lt;/blockquote&gt;&lt;br /&gt;In English: A bug exists in Exchange 2007 when a message with ‘inline’ attachments is delivered. This bug causes Outlook 2003 to not display the message attachments correctly.&lt;br /&gt;&lt;br /&gt;In my last correspondence with Microsoft they said that the code has been fixed for Exchange 2007 SP1 and a ‘backport to RTM’ has been accepted. Here’s to hoping they have a hot-fix soon.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The Workarounds&lt;/h3&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_QfC2byISyLA/RgHb5_-bvaI/AAAAAAAAAAc/_c9xGIWSzAI/s1600-h/missingattachment.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_QfC2byISyLA/RgHb5_-bvaI/AAAAAAAAAAc/_c9xGIWSzAI/s320/missingattachment.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5044554847103991202" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; View the attachment in OWA: OWA correctly understands how Exchange 2007 stores attachment information for the message. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Open the message and save the attachments: This one is a little counter-intuitive. Even though Outlook 2003 doesn’t display the attachments, it can still access them. By selecting the ‘Save Attachments’ option from the ‘File’ menu will allow you view and save the attachments. &lt;/li&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_QfC2byISyLA/RgHcKf-bvbI/AAAAAAAAAAk/O0Sw7gETXc0/s1600-h/saveattachments.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_QfC2byISyLA/RgHcKf-bvbI/AAAAAAAAAAk/O0Sw7gETXc0/s320/saveattachments.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5044555130571832754" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;li&gt; Forward the message: This gives you 2 options. 1) Forwarding the message to yourself will display the correct attachment information in the new message. 2) When composing the forwarded message you will see the attachments. &lt;/li&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_QfC2byISyLA/RgHcVf-bvcI/AAAAAAAAAAs/tPqdyCgh4jA/s1600-h/forwardmessage.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_QfC2byISyLA/RgHcVf-bvcI/AAAAAAAAAAs/tPqdyCgh4jA/s320/forwardmessage.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5044555319550393794" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;li&gt; Flag the message: ‘Flagging’ the message will cause Outlook 2003 to write information about the message to the Exchange database. This process will cause Outlook 2003 to set the appropriate information so that it displays attachments correctly. &lt;/li&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_QfC2byISyLA/RgHchf-bvdI/AAAAAAAAAA0/HPPBkI4URv0/s1600-h/flaggedmessage.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_QfC2byISyLA/RgHchf-bvdI/AAAAAAAAAA0/HPPBkI4URv0/s320/flaggedmessage.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5044555525708824018" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;li&gt; Upgrade to Outlook 2007 &lt;/li&gt;&lt;br /&gt;&lt;li&gt; Have the sender send ‘real attachments’: Since the problem only exists with ‘inline’ attachments the sender can change their mail client to send ‘real attachments’ and avoid future problems sending attachments to your organization. **Note: Mozilla mail clients &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=65794"&gt;send ‘inline’ attachments by default&lt;/a&gt; when composing HTML email. Instructions for changing this behavior can be found &lt;a href="http://kb.mozillazine.org/Send_attachments_as_real_attachments"&gt;here&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;--Nick &lt;/p&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;font color=red&gt;Update:&lt;/font&gt; &lt;a href="http://support.microsoft.com/?kbid=935999"&gt;Update Rollup 3 for Exchange 2007&lt;/a&gt; fixes the issue mentioned above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-1803083510530944387?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/1803083510530944387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=1803083510530944387' title='56 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/1803083510530944387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/1803083510530944387'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/exchange-2007-and-outlook-2003-where.html' title='Exchange 2007 and Outlook 2003: Where are my attachments?'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_QfC2byISyLA/RgHb5_-bvaI/AAAAAAAAAAc/_c9xGIWSzAI/s72-c/missingattachment.jpg' height='72' width='72'/><thr:total>56</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-6517377914484863948</id><published>2007-03-18T17:11:00.000-06:00</published><updated>2007-03-19T09:16:09.098-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Finding a Public Folder by Email Address</title><content type='html'>Public folders can be complex and difficult to manage at times.  Recently, a colleague identified a public folder in the global address list that was misdirecting his user support questions.  The public folder in question was named “Help Desk”.  Working for a University there are multiple help desks and IT departments. The name “Help Desk” was confusing to users and causing misdirected support questions.  He tried using his Exchange 2003 tools, the Active Directory Users and Computers snap-in, and the PFDAVAdmin tool without finding the public folder in question. Finally, out of frustration, he asked for my help to find the public folder.&lt;br /&gt;&lt;br /&gt;Once again PowerShell came to the rescue. Very quickly I was able to find the folder using its email address from the GAL and give him the public folder path he needed to make the necessary changes.  Here is how you can do it:&lt;br /&gt;&lt;br /&gt;First I set the PowerShell scope to view our entire forest (we have many domains and multiple Exchange administrative groups).  This is done by changing the properties of the $AdminSessionADSettings variable.  &lt;a href="http://blogs.technet.com/evand/archive/2007/02/14/adminsessionadsettings-and-you.aspx"&gt;Evan Dodds&lt;/a&gt; has a good blog post about $AdminSessionADSettings.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;$AdminSessionADSettings.ViewEntireForest = $True&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Next I used the &lt;a href="http://technet.microsoft.com/en-us/library/bb124772.aspx"&gt;Get-MailPublicFolder&lt;/a&gt; cmdlet to identify the public folder in question:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Get-MailPublicFolder helpdesk@sub.domain.com&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I was able to identify the public folder but I still didn’t know the public folder path so that my colleague could make the necessary changes. I found this by piping the results from my previous command to the &lt;a href="http://technet.microsoft.com/en-us/library/bb124772.aspx"&gt;Get-PublicFolder&lt;/a&gt; cmdlet.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Get-MailPublicFolder helpdesk@sub.domain.com | Get-PublicFolder&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now I could use the ‘ParentPath’ attribute to find the public folder path so that he could make the necessary changes.  &lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;$AdminSessionADSettings.ViewEntireForest = $True&lt;br /&gt;[PS] C:\&gt;$HelpDeskPF = (Get-MailPublicFolder helpdesk@sub.domain.com | Get-PublicFolder)&lt;br /&gt;[PS] C:\&gt;$HelpDeskPF.ParentPath&lt;br /&gt;\Business College\Resources\Resumes&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The help desk folder was located within the 'Resumes' folder??? No wonder he couldn't find it.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-6517377914484863948?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/6517377914484863948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=6517377914484863948' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/6517377914484863948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/6517377914484863948'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/finding-public-folder-by-email-address.html' title='Finding a Public Folder by Email Address'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-542224541639969215</id><published>2007-03-07T20:40:00.000-07:00</published><updated>2007-03-07T20:41:14.531-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Script: Globally Replace Email Domain</title><content type='html'>Have you ever had to globally replace one email domain with another? Maybe you are in the middle of a merger or possibly made a typo in a recipient policy. Searching for and updating idividual email accounts can be tedious.&lt;br /&gt;&lt;br /&gt;I couple of weeks ago a friend had a need for a script to identify accounts with an @domainA.com email address and replace it with an @domainB.com address.  Below is the script I created to accomplish such a task.&lt;br /&gt;&lt;br /&gt;--Nick&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;## Please set variables as desired below ##&lt;br /&gt;$OldDomain = "@olddomain.com" #Domain address to remove&lt;br /&gt;$NewDomain = "@newdomain.com" #Domain address to add&lt;br /&gt;&lt;br /&gt;## Start of script&lt;br /&gt;&lt;br /&gt;#Query AD for mailboxes to alter&lt;br /&gt;Get-Mailbox -ResultSize:Unlimited -Filter:"EmailAddresses -like '*$OldDomain*'" | foreach {&lt;br /&gt; &lt;br /&gt;  #Store Identity of Mailbox&lt;br /&gt;  $MailboxID = $_.Identity&lt;br /&gt;&lt;br /&gt;  #Identify the email addresses to change&lt;br /&gt;  $AddressesToChange = $_.EmailAddresses | where { $_.ProxyAddressString -like "*$OldDomain*" }&lt;br /&gt; &lt;br /&gt;  #Loop through results in case a user has multiple addresses to change&lt;br /&gt;  $AddressesToChange | foreach {&lt;br /&gt;  &lt;br /&gt;    #Get email address&lt;br /&gt;    $OldAddress = $_.ProxyAddressString&lt;br /&gt; &lt;br /&gt;    #Remove domain portion of email address&lt;br /&gt;    $Username = $_.ProxyAddressString.Split("@")[0]&lt;br /&gt;  &lt;br /&gt;    #Set new email address (format: 'smtp:username@newdomain')&lt;br /&gt;    $NewEmailAddress = $Username + $NewDomain&lt;br /&gt;  &lt;br /&gt;    #Check if it is a PrimarySMTP Address&lt;br /&gt;    $IsPrimarySMTPAddress = $False&lt;br /&gt;    if ($_.IsPrimaryAddress -eq "True" -and $_.PrefixString -eq "smtp")&lt;br /&gt;    {&lt;br /&gt;      $IsPrimarySMTPAddress = $True&lt;br /&gt;    }&lt;br /&gt;  &lt;br /&gt;    #Add new address&lt;br /&gt;    Set-Mailbox -Identity:$MailboxID -EmailAddresses:((Get-Mailbox -Identity:$MailboxID).EmailAddresses + "$NewEmailAddress")&lt;br /&gt;  &lt;br /&gt;    #Set new address as primary address if needed&lt;br /&gt;    If ($IsPrimarySMTPAddress)&lt;br /&gt;    {&lt;br /&gt;      #Remove 'smtp:' from start of the string&lt;br /&gt;      $PrimarySmtpAddress = $NewEmailAddress.Split(":")[1]&lt;br /&gt;      Set-Mailbox -Identity:$MailboxID  -PrimarySmtpAddress:$PrimarySmtpAddress -WindowsEmailAddress:$PrimarySmtpAddress&lt;br /&gt;    }&lt;br /&gt;  &lt;br /&gt;    #Remove the old address&lt;br /&gt;    Set-Mailbox -Identity:$MailboxID -EmailAddresses:((Get-Mailbox -Identity:$MailboxID).EmailAddresses | where { $_.ProxyAddressString -notlike "$OldAddress" })&lt;br /&gt; &lt;br /&gt;    Write-Host $OldAddress "has been replaced with" $NewEmailAddress&lt;br /&gt;  } &lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Sample scripts are provided AS IS without warranty of any kind. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages.&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-542224541639969215?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/542224541639969215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=542224541639969215' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/542224541639969215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/542224541639969215'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/script-globally-replace-email-domain.html' title='Script: Globally Replace Email Domain'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-6536927483623065304</id><published>2007-03-05T18:45:00.000-07:00</published><updated>2008-12-08T16:06:48.008-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shared Mailboxes'/><category scheme='http://www.blogger.com/atom/ns#' term='Outlook'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><category scheme='http://www.blogger.com/atom/ns#' term='OWA'/><title type='text'>Exchange 2007 and Shared Mailboxes</title><content type='html'>Exchange 2007 introduces many new &lt;a href="http://technet.microsoft.com/en-us/library/bb201680.aspx"&gt;recipient types&lt;/a&gt;; one of which is a 'shared mailbox'. Defining a mailbox as 'shared' creates a disabled active directory account to which the mailbox is connected. In the past, to create a shared mailbox you would create an enabled domain account and attach a mailbox. Chances are you would assign a password and give it to one or more users so that they could access the mailbox. In many instances this username and password combination was also used to authenticate onto a domain computer (e.g. receptionists, help desk students). How many people know the username/password combination for that account? Is this password changed when users leave the organization?&lt;br /&gt;&lt;br /&gt;Disabled accounts act as a security measure. You will no longer be required to have extra username/password combinations for accessing your network. Using the method described below you can easily assign permissions specifically to those users requiring access. Because users will use their own domain credentials to access the shared mailbox you will be able to easily grant and revoke access without circulating new passwords.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Creating Shared Mailboxes&lt;/h3&gt;&lt;br /&gt;The Exchange Management Console does not give the option for creating a shared mailbox in the new mailbox wizard. To create shared mailboxes you must use PowerShell. &lt;br /&gt;&lt;br /&gt;To create a shared mailbox you simply add the "-Shared" option while creating the mailbox using the &lt;a href="http://technet.microsoft.com/en-us/library/aa997663.aspx"&gt;New-Mailbox cmdlet&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;New-Mailbox -Name:'Help Desk' -OrganizationalUnit:'Domain.com/Exchange Resources' -Database:'Mailbox Database' -UserPrincipalName:'helpdesk@domain.com' -Shared&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In this sample, a disabled user account will be created in the 'Exchange Resources' organizational unit with an attached mailbox. Since the user account is disabled by default no initial password was required.&lt;br /&gt;&lt;br /&gt;If desired, existing mailboxes can be converted to shared mailboxes using the &lt;a href="http://technet.microsoft.com/en-us/library/bb123981.aspx"&gt;Set-Mailbox cmdlet&lt;/a&gt; by using the -Type parameter.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;Set-Mailbox helpdesk -Type:Shared&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To convert a shared mailbox to a regular user mailbox use the -Type:Regular option.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Assigning Permissions&lt;/h3&gt;&lt;br /&gt;Shared mailboxes do not have an associated password so you must grant mailbox permissions for the users requiring access to the mailbox. Since, by definition, shared mailboxes will be accessed by multiple users, I suggest assigning permissions using security groups. The first step is to create a security group in your domain containing the users you want to access the shared mailbox. For this example I will name the group "Help Desk Permissions Group". Grant full mailbox permissions for the group you just created.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;Add-MailboxPermission helpdesk -User:'Help Desk Permissions Group' -AccessRights:FullAccess&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Users in the the "Help Desk Permissions Group" will now have full access to the mailbox. But you are not done yet...you MUST also add the active directory 'Send-As' permission so that members of the group can send mail with the shared mailbox's email address. Additionally, you may want to add permissions to read/write personal information so that users can setup delegates if needed.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;Add-ADPermission helpdesk -User:'Help Desk Permissions Group' -ExtendedRights:Send-As -AccessRights:ReadProperty, WriteProperty -Properties:'Personal Information'&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now your users will have complete access to the shared mailbox.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Accessing Shared Mailboxes&lt;/h3&gt;&lt;br /&gt;One method for accessing the shared mailbox is to add it as an additional mailbox within Outlook. The mailbox can be added on the advanced tab of your Exchange mailbox account settings. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_QfC2byISyLA/RezmM-lqaTI/AAAAAAAAAAM/_EAjJdVbr8Q/s1600-h/AddAdditionalMailbox.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_QfC2byISyLA/RezmM-lqaTI/AAAAAAAAAAM/_EAjJdVbr8Q/s320/AddAdditionalMailbox.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5038655193754528050" /&gt;&lt;/a&gt;&lt;br /&gt;This method is great for allowing you to read email from the shared mailbox and sending as that email address when desired. Unfortunately, this method will not save items sent as that mailbox to its 'Sent Items' folder. All items sent within Outlook will be stored in the primary mailbox's 'Sent Items' folder.&lt;br /&gt;&lt;br /&gt;Another option is to configure a separate Outlook profile for opening the shared mailbox. Use the mail icon within the control panel to add an additional Outlook profile. Configure the account normally; entering the shared mailbox display name or exchange alias as the user name. This method will allow you to use shared mailbox the same as a normal user mailbox. All items will be sent as the shared mailbox and saved to the 'Sent Items' folder.&lt;br /&gt;&lt;br /&gt;Finally, shared mailboxes can be accessed via OWA. To open the shared mailbox simply add the mailbox email address to the end of your normal OWA URL. Authenticate using your normal domain credentials.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_QfC2byISyLA/Rezn7OlqaUI/AAAAAAAAAAU/19ufgl5PCYA/s1600-h/OWASharedMailbox.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_QfC2byISyLA/Rezn7OlqaUI/AAAAAAAAAAU/19ufgl5PCYA/s320/OWASharedMailbox.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5038657087835105602" /&gt;&lt;/a&gt;&lt;br /&gt;Hopefully this has been helpful for understanding shared mailboxes and the permissions needed. Granting mailbox permissions via this method can also be accomplished in Exchange 2003. However, granting active directory 'send-as' permissions on the user account and Exchange full mailbox access will have to be done manually using the the active directory users and computers MMC. &lt;br /&gt;&lt;br /&gt;In an upcoming post I will detail how this method can be integrated into Exchange self-service request and provisioning process.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-6536927483623065304?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/6536927483623065304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=6536927483623065304' title='50 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/6536927483623065304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/6536927483623065304'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/exchange-2007-and-shared-mailboxes.html' title='Exchange 2007 and Shared Mailboxes'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_QfC2byISyLA/RezmM-lqaTI/AAAAAAAAAAM/_EAjJdVbr8Q/s72-c/AddAdditionalMailbox.jpg' height='72' width='72'/><thr:total>50</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-275172961796603274</id><published>2007-03-05T11:33:00.000-07:00</published><updated>2007-03-05T11:42:08.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Mailbox Load Balancing Made Simple - Part 3</title><content type='html'>Previously I detailed mailbox provisioning based upon&lt;a href="http://knicksmith.blogspot.com/2007/03/mailbox-provisioning-made-simple-part-1.html"&gt; database file size &lt;/a&gt;and &lt;a href="http://knicksmith.blogspot.com/2007/03/mailbox-load-balancing-made-simple-part.html"&gt;user count&lt;/a&gt;. Finally, I will demonstrate random dispersal of mailboxes.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Random Distribution&lt;/h3&gt;&lt;br /&gt;Statistically, given a large enough number, a random distribution of accounts will create mailbox databases with a similar number of users. Once again a random database can be chosen easily within PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;$MailboxDatabases = Get-MailboxDatabase&lt;br /&gt;[PS] C:\&gt;$Random = New-Object Random&lt;br /&gt;[PS] C:\&gt;$TargetDatabase = $MailboxDatabases[$Random.Next(0,$MailboxDatabases.Count-1)]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Pros&lt;/strong&gt;: This method is quick and easy for load-balancing users across multiple servers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cons&lt;/strong&gt;: With the random method you don’t have control in which database new mailboxes are created. There will be instances when a new mailbox is added to the biggest database in terms of both size and number of users. When/if you add new databases they will be populated at the same rate as existing databases and thus never achieve the same size as the existing databases.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusions&lt;/h3&gt;&lt;br /&gt;Each method has its merits and should be chosen based upon your environment. I personally used a hybrid solution: For existing user migrations I used the the smallest database in terms of file size method. Load balancing in terms of users per database took too long for our provisioning process with thousands of mailboxes; so I opted to use the random distribution method for new mailbox creations. If/when we add new servers/databases I will have to manually move users between databases to achieve a balance.&lt;br /&gt;&lt;br /&gt;Hopefully this is helpful if you are increasing the size of your Exchange organization or are re-writing your provisioning code for Exchange 2007.&lt;br /&gt;&lt;br /&gt;–Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-275172961796603274?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/275172961796603274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=275172961796603274' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/275172961796603274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/275172961796603274'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/mailbox-load-balancing-made-simple-part_05.html' title='Mailbox Load Balancing Made Simple - Part 3'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-141824642350138668</id><published>2007-03-05T08:17:00.000-07:00</published><updated>2007-03-05T08:31:07.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Mailbox Load Balancing Made Simple - Part 2</title><content type='html'>In &lt;a href="http://knicksmith.blogspot.com/2007/03/mailbox-provisioning-made-simple-part-1.html"&gt;part one&lt;/a&gt; of this three part article I discussed load balancing mailbox databases based upon file size. In part two I will discuss balancing databases based upon the number of users per database.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Equal Number of Users Per Database&lt;/h3&gt;&lt;br /&gt;The second approach is to assign an equal number of users per database. Statistically, if the majority of your users have the same quota, database sizes should be similar. Obviously some databases will be larger than others but theoretically the database sizes should fall within a bell curve. To find the smallest database (in terms of mailboxes) we can group mailboxes by database and sort accordingly:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\Temp&gt;Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Name            Count&lt;br /&gt;----            -----&lt;br /&gt;EVS2\SG9\MDB9   27&lt;br /&gt;EVS3\SG19\MDB19 36&lt;br /&gt;EVS3\SG9\MDB9   37&lt;br /&gt;EVS3\SG4\MDB4   38&lt;br /&gt;EVS3\SG2\MDB2   39&lt;br /&gt;…&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Assuming your edb file name is the same as the mailbox database name you can easily extract this information for mailbox provisioning:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;$TargetDatabase = (((Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count)[0].Name).Split(”.edb”))[0]&lt;br /&gt;[PS] C:\&gt;Enable-Mailbox -Identity:user@domain.com -Database:$TargetDatabase&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Pros&lt;/strong&gt;: This method is ideal for load-balancing new mailboxes on multiple servers. When/if new mailbox databases are added to the Exchange system they will quickly be populated to match existing databases.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cons&lt;/strong&gt;: When you have a large number of mailboxes, grouping mailboxes by database can take quite a few seconds, even minutes. This time delay can become quite a bottleneck if you are creating a large number of mailboxes.&lt;br /&gt;&lt;br /&gt;In part three I will detail randomly distributing mailboxes.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-141824642350138668?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/141824642350138668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=141824642350138668' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/141824642350138668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/141824642350138668'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/mailbox-load-balancing-made-simple-part.html' title='Mailbox Load Balancing Made Simple - Part 2'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-785875229887157699</id><published>2007-03-04T18:46:00.000-07:00</published><updated>2007-03-05T08:30:44.182-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Mailbox Load Balancing Made Simple - Part 1</title><content type='html'>While creating our Exchange mailbox provisioning process I was faced with a problem of load balancing mailboxes across multiple databases and several servers. Our mailbox count made micro-managing databases for specific departments not advantageous. We decided to try to distribute mailboxes evenly across all databases (as closely as possible). Three methods for load balancing were identified: database file size, number of users per database, and a random distribution of mailboxes.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Equal Database File Sizes&lt;/h3&gt;&lt;br /&gt;The theory behind this method was to keep database sizes uniform for backup purposes. Some databases would host many ‘light’ users while other databases may only host a few ‘heavy’ users. Either way each database would host approximately the same amount of data. To find the smallest database file size on a server I needed to get a list of databases, find the size of each, and sort for the smallest in terms of size. The following command works well in a single server environment.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;Get-MailboxDatabase | foreach { get-childitem $_.edbFilePath | select-object name,length} | sort -property length &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Name      Length&lt;br /&gt;----      ------&lt;br /&gt;MDB19.edb 4257366016&lt;br /&gt;MDB12.edb 4270080000&lt;br /&gt;MDB6.edb  4312023040&lt;br /&gt;…&lt;br /&gt;MDB5.edb  7000571904&lt;br /&gt;MDB8.edb  7174504448 &lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Assuming your edb file name is the same as the mailbox database name you can easily extract this information for mailbox provisioning:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[PS] C:\&gt;$TargetDatabase = (((Get-MailboxDatabase -Server:EVS1 | foreach { get-childitem $_.edbFilePath | select-object name,length} | sort -property length)[0].Name).Split(”.edb”))[0]&lt;br /&gt;[PS] C:\&gt;Enable-Mailbox -Identity:user@domain.com -Database:$TargetDatabase&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This method becomes more difficult when trying to load balance across multiple servers. It can be done by converting the edbFilePath to a UNC path using the ServerName attribute of the mailbox database object. After sorting to find the smallest database you must determine the identity of the mailbox in the form ‘ServerName\StorageGroupName\DatabaseName’. I did not pursue this method much further because of its fatal flaw for new mailbox provisioning.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Pros&lt;/strong&gt;: This method works well for migrating existing mailboxes that contain some amount of data and is my preferred method for migrating mailboxes from legacy Exchange servers. The script executes quickly in a single server Exchange environment.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cons&lt;/strong&gt;: This method becomes quite complex when running multiple Exchange servers or if the provisioning code does not run on the Exchange server itself. Unless databases are regularly defragmented offline, the database file size will include some amount of ‘whitespace’ from previously deleted emails/mailboxes and the file size may not be indicative of the amount of real data stored within the database.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Fatal flaw&lt;/strong&gt;: This method does not work when adding new mailboxes in bulk. Ten/hundreds/thousands of empty mailboxes could be added to a single database without it growing beyond the size of the next smallest database.&lt;br /&gt;&lt;br /&gt;In &lt;a href="http://knicksmith.blogspot.com/2007/03/mailbox-load-balancing-made-simple-part.html"&gt;part two&lt;/a&gt; I will detail distributing users evenly accross all databases based upon mailbox count.&lt;br /&gt;&lt;br /&gt;--Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-785875229887157699?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/785875229887157699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=785875229887157699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/785875229887157699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/785875229887157699'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/mailbox-provisioning-made-simple-part-1.html' title='Mailbox Load Balancing Made Simple - Part 1'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-2703058614615079505</id><published>2007-03-04T17:02:00.000-07:00</published><updated>2007-03-04T19:16:48.826-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Daylight Saving Time'/><category scheme='http://www.blogger.com/atom/ns#' term='Exchange 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>DST and Mobile Devices</title><content type='html'>We are now less than a week away from the start of the daylight saving time changes for 2007. As an Exchange admin are you ready? By now I am sure you have patched your &lt;a href="http://support.microsoft.com/kb/931836"&gt;computers&lt;/a&gt; and &lt;a href="http://support.microsoft.com/kb/926666"&gt;Exchange servers&lt;/a&gt;, read the &lt;a href="http://support.microsoft.com/gp/dst_topissues"&gt;DST documentation&lt;/a&gt;, viewed &lt;a href="http://support.microsoft.com/gp/dst_webcasts"&gt;webcasts&lt;/a&gt;, and run the &lt;a href="http://support.microsoft.com/kb/930879"&gt;Exchange calendar update tool&lt;/a&gt;. With such a long list of things to worry about have you remembered all those pesky mobile devices? Below are a few links to patching instructions for different mobile device types:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.microsoft.com/windowsmobile/daylightsaving/default.mspx"&gt;Windows Mobile&lt;/a&gt; (Important: After applying the patch you MUST manually change your time zone once then switch back to the original time zone to apply the updated the DST setting.) &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.palm.com/us/support/downloads/dst_palmos.html"&gt;Palm&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Blackberry: &lt;a href="http://www.blackberry.com/DST2007/patch/index2.shtml"&gt;User initiated&lt;/a&gt;, &lt;a href="http://www.blackberry.com/DST2007/patch/index2.shtml#admin-wireless-push"&gt;Administrative patch deployment &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Identifying users with mobile devices and applying the appropriate patches can be challenging. Working in higher education I have no control over the active-sync mobile devices that connect to our Exchange servers. Thus I had to find a way to identify and notify users with mobile devices. Fortunately, we are running Exchange 2007 and I have the tools needed to accomplish such a task easily. Using the Get-ActiveSyncDeviceStatistics cmdlet I was able to compile a list of devices that have synced within the last 2 weeks.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Get-Mailbox -ResultSize:Unlimited | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | Where {$_.LastSuccessSync -gt '2/15/2007'}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Incorporating a couple of other PowerShell tools I was able to create a CSV file with the user’s email address and device type. Now I can e-mail device specific patching instructions to the effected users. As an added bonus I was able to accomplish this in a single line.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Get-Mailbox -ResultSize:Unlimited | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | Where {$_.LastSuccessSync -gt '2/15/2007'} | Sort-Object -Property DeviceType,Identity | Select-Object @{name="EmailAddress";expression={$_.Identity.ToString().Split("\")[0]}},DeviceType | Export-Csv -Path:"C:\Temp\MobileDevices.csv"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;**Note: This method will only identify active-sync users. Blackberry users will not be included in the results.&lt;br /&gt;&lt;br /&gt;–Nick&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-2703058614615079505?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/2703058614615079505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=2703058614615079505' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/2703058614615079505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/2703058614615079505'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/dst-and-mobile-devices.html' title='DST and Mobile Devices'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9152313422880014915.post-6461021817723280750</id><published>2007-03-04T17:01:00.000-07:00</published><updated>2007-03-04T17:02:33.643-07:00</updated><title type='text'>Welcome to my new blog</title><content type='html'>Welcome to my new blog where I plan to post helpful information and scripts relating the Exchange, PowerShell, and Outlook (among other things IT). I plan to post updates regularly and look forward to your comments and requests.&lt;br /&gt;&lt;br /&gt;–Nick&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9152313422880014915-6461021817723280750?l=knicksmith.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://knicksmith.blogspot.com/feeds/6461021817723280750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9152313422880014915&amp;postID=6461021817723280750' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/6461021817723280750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9152313422880014915/posts/default/6461021817723280750'/><link rel='alternate' type='text/html' href='http://knicksmith.blogspot.com/2007/03/welcome-to-my-new-blog.html' title='Welcome to my new blog'/><author><name>Nick Smith</name><uri>http://www.blogger.com/profile/15312621960101025538</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
