<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>viveksharma.com: techlog</title>
    <link rel="self" type="application/xml" href="http://viveksharma.com/TECHLOG/Atom.aspx" />
    <subtitle type="html" />
    <id>http://viveksharma.com/TECHLOG/Default.aspx</id>
    <author>
        <name>Vivek Sharma</name>
        <uri>http://viveksharma.com/TECHLOG/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 1.9.5.177">Subtext</generator>
    <updated>2008-02-10T17:30:04Z</updated>
    <entry>
        <title>PowerShell Book Recommendations</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2008/02/10/powershell-book-recommendations.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2008/02/10/powershell-book-recommendations.aspx</id>
        <published>2008-02-10T17:30:04-08:00:00</published>
        <updated>2008-02-10T17:30:04Z</updated>
        <content type="html">&lt;p&gt;Someone asked me to recommend a few books, so here they are: &lt;/p&gt;  &lt;p&gt;1) Windows PowerShell Cookbook by &lt;a href="http://leeholmes.com/blog" target="_blank"&gt;Lee Holmes&lt;/a&gt; (from PS Team) &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.oreilly.com/catalog/9780596528492/" target="_blank"&gt;&lt;img src="http://www.oreilly.com/catalog/covers/9780596528492_cat.gif" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;2) Windows PowerShell in Action by Bruce Payette (from PS Team) &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.manning.com/payette/" target="_blank"&gt;&lt;img src="http://www.manning.com/payette/payette_cover150.jpg" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3) For Exchange specific stuff, I actually haven't tried any (makes sense as we were writing code most of the time :). Here are a few I dug up on the web, they look promising: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sapienpress.com/exchange.asp" target="_blank"&gt;&lt;img src="http://www.sapienpress.com/image/Exchange_Management_Shell_TFM-1.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In fact, a few guys I know wrote a very nice book that should definitely be on the top of the list. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.com/Professional-PowerShell-Exchange-2007-SP1/dp/0470226447/ref=sr_1_2/103-9221207-6881408?ie=UTF8&amp;amp;s=books&amp;amp;qid=1188276506&amp;amp;sr=8-2" target="_blank"&gt;&lt;img src="http://contentcafe.btol.com/Jacket/Jacket.aspx?SysID=quantum&amp;amp;CustID=books&amp;amp;Key=0470226447&amp;amp;TYPE=S&amp;amp;Return=0" /&gt;&lt;/a&gt;  &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Here's to more books, fame and fortune from these fine authors! &lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/49.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/49.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/49.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/49.aspx</trackback:ping>
    </entry>
    <entry>
        <title>ExchangeLabs will pwn you!</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2007/10/12/exchangelabs-will-pwn-you.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2007/10/12/exchangelabs-will-pwn-you.aspx</id>
        <published>2007-10-12T01:10:58-07:00:00</published>
        <updated>2008-01-29T01:05:36Z</updated>
        <content type="html">&lt;p&gt;So its been a long time since I last posted (last December actually!). A lot has happened since then: Exchange 2007 has shipped, Vista has shipped, Office 12 has shipped... and I've been working on, well, &lt;em&gt;new stuff&lt;/em&gt;. Since &lt;a href="http://msexchangeteam.com/archive/2007/10/08/447213.aspx"&gt;Terry unveiled on the team blog&lt;/a&gt; that we have a program called Exchange Labs, I might as well reveal that &lt;a href="http://exchangelabs.com/"&gt;http://exchangelabs.com&lt;/a&gt; also happens to be the &lt;em&gt;new stuff&lt;/em&gt; that I'm working on. &lt;/p&gt;
&lt;p&gt;I can't totally mention specifics, except that we are enabling a service at ** *** *, which by itself is really cool. And that's just the begining, we're also going to work on *******, *****, ***, **, ***, **, ***** ** ****, *** ****, and not to mention ******* **** *******! Apologies for ****'ing out some words, the censors around here are totally unreasonable :-) Given the new focus, I'll be posting more service and services related stuff on the blog. &lt;/p&gt;
&lt;p&gt;But I still love and use powershell, so I'll continue to sprinkle odds and ends on the blog as well. &lt;a href="http://blogs.technet.com/evand/default.aspx"&gt;Evan&lt;/a&gt; actually is a good guy to watch for more powershell goodies. Thanks for reading the blog and posting comments, I appreciate it very much!    BTW: The title is a side-effect of me spending lots of time with &lt;a href="http://halo3.com/"&gt;Halo 3&lt;/a&gt;. Here is the &lt;a href="http://en.wikipedia.org/wiki/Pwn"&gt;wikipedia entry for 'pwn'&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/47.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/47.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/47.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/47.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Announcing the Exchange 2007 PowerShell Scriptacular demo pack!</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/12/21/announcing-the-exchange-2007-powershell-scriptacular-demo-pack.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/12/21/announcing-the-exchange-2007-powershell-scriptacular-demo-pack.aspx</id>
        <published>2006-12-21T18:12:49-08:00:00</published>
        <updated>2008-01-28T23:52:33Z</updated>
        <content type="html">&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Dear Exchange 2007 Enthusiast(s), &lt;/p&gt;
&lt;p&gt;I'd like to announce the Exchange 2007 PowerShell Scriptacular (&lt;a href="http://www.viveksharma.com/techlog/attache/MS_Exchange_PowerShell_Scriptacular_V1.0.zip"&gt;download zipfile&lt;/a&gt;) demo pack. What is it you ask? Well... this collection of Exchange PowerShell scripts was developed by Mihai Jalobeanu and Vivek Sharma while they (we) developed the Exchange Management Shell. We had a lot of fun writing these scripts, and we used them to showcase the innovations in Exchange 2007 System Management--we also promised that when Exchange 2007 is released to the wild, that we'd make our favorite scripts available to everyone. So here they are! &lt;/p&gt;
&lt;p&gt;If you want our exact demo setup: to get started, put everything in a directory (d:\scripts or something), and run generate. You need datafiles and you need to customize initvars.ps1. If you don't, the demo pack won't work. &lt;/p&gt;
&lt;p&gt;Or you can just take a look at the scripts and learn from the bits and pieces that interest you. &lt;/p&gt;
&lt;p&gt;Note: These are Microsoft copyrighted samples, are provided as-is and confer no warranties or rights. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Script Pack Contents: &lt;/strong&gt; &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;addfakeservers.ps1 and removefakeservers.ps1 &lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;NOT standalone&lt;/em&gt;. Makes it looks like your demo setup has more than one server. We use a very useful feature of Exchange 2007 setup to make this work. Basically we use the /provisionedserver switch to create pre-provisioned servers (AD objects). The admin interface detects these as servers, even though the hardware has not been installed yet. This enables server delegation and pre-provisioning in  Exchange topologies. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;balancemailboxes.ps1&lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;Standalone&lt;/em&gt;. This script shows how you can use PowerShell to easily load balance mailboxes by size across servers. Key thing is the use of get-mailboxstatistics and move-mailbox. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;cleanup.ps1 and generate.ps1&lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;NOT standalone&lt;/em&gt;. Cleanup.ps1 completely restores your demo environment to a basic-just-installed-Exchange state. New car smell not included. Generate kicks off everything else to generate the demo environment. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;initvars.ps1&lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;NOT standalone&lt;/em&gt;. Standard variables shared by all the scripts. Called by generate.ps1. MAKE SURE TO EDIT THIS FILE to customize this for your environment. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;mailstorm.ps1 and mailstorm2.ps1 &lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;Standalone with caveats&lt;/em&gt;. What's a demo Exchange enviroment without some email? BTW: this is the one script that is likely to not just work automatically in your environment. This is because we assume some basic auth settings to make the Hub server accept mail. This step is done in generate.ps1 so make sure you do that if you plan to use this script by itself. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;multi-matrix.ps1&lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;Standalone&lt;/em&gt;. Totally totally useless. But cool damnit. This is the matrix unloaded ... er... powershelled. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;out-email.ps1&lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;Standalone&lt;/em&gt;, with caveats. Just like the name implies, sends content over mail. You can pipe text to it. get-content c:\sometext.txt | out-email -to &lt;a href="mailto:jimmy@crackcornandidontcare.com"&gt;jimmy@crackcornandidontcare.com&lt;/a&gt; -subject "Report". It uses the "from" from initvars.ps1 so make sure to copy those lines as needed to make it standalone. &lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;out-html.ps1 and out-ie.ps1 &lt;br /&gt;
    &lt;br /&gt;
    &lt;em&gt;Standalone&lt;/em&gt;. I already posted these to &lt;a href="http://www.viveksharma.com/techlog"&gt;http://www.viveksharma.com/techlog&lt;/a&gt; earlier. &lt;br /&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The datafiles are politician names, committees, standard drafts of the European Union. We've used US congress / house data in the past too---anything goes, it was publicly available data so it works great for demos. &lt;/p&gt;
&lt;p&gt;The scripts (and their latest versions) can always be found at: &lt;a href="http://www.viveksharma.com/techlog"&gt;http://www.viveksharma.com/techlog&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;-Mihai Jalobeanu and Vivek Sharma &lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/46.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/46.aspx</wfw:comment>
        <slash:comments>10</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/46.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/46.aspx</trackback:ping>
    </entry>
    <entry>
        <title>How to get DL membership in Exchange 2007</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/10/22/how-to-get-dl-membership-in-exchange-2007.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/10/22/how-to-get-dl-membership-in-exchange-2007.aspx</id>
        <published>2006-10-22T23:10:33-07:00:00</published>
        <updated>2008-01-28T23:53:24Z</updated>
        <content type="html">&lt;p&gt;Abshishek reminded me of this with &lt;a href="http://abhishek225.spaces.live.com/blog/cns!13469C7B7CE6E911!189.entry?_c11_blogpart_blogpart=blogview&amp;amp;_c=blogpart#permalink"&gt;his post&lt;/a&gt; on how to figure out &lt;em&gt;Security Group&lt;/em&gt; membership using PowerShell. But Distribution Groups are a whole different beast. So how do you do it? One way is to use the GUI: the awesome &lt;a href="http://msexchangeteam.com/archive/2006/10/20/429233.aspx"&gt;Exchange Management Console&lt;/a&gt; already shows you group membership. And on the cmdline you can do this in Exchange 2007: &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Using server side filtering (faster):&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;   &lt;code&gt;$filterid = (get-user Administrator).Identity get-group -filter { Members -eq $filterid }&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Using &lt;/strong&gt;&lt;strong&gt;client side filtering (slower):&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;   &lt;/strong&gt;&lt;code&gt;get-group | where { $_.Members -like '*Admin*' }&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;This can be adapted to do nested membership as well---I'll leave it to you to figure out how.&lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/45.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/45.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/45.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/45.aspx</trackback:ping>
    </entry>
    <entry>
        <title>How to record your shell session</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/10/22/how-to-record-your-shell-session.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/10/22/how-to-record-your-shell-session.aspx</id>
        <published>2006-10-22T11:10:00-07:00:00</published>
        <updated>2008-01-28T23:54:39Z</updated>
        <content type="html">&lt;p&gt;PS&amp;gt; Start-Transcript &lt;br /&gt;
PS&amp;gt; # do a bunch of stuff &lt;br /&gt;
PS&amp;gt; Stop-Transcript # or just quit the shell &lt;/p&gt;
&lt;p&gt;This will create a file (by default in your My Documents folder) that is a verbatim copy of your shell session. No more copy and paste needed from the shell to notepad! A few other things of note: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;This is the only way to capture verbose and warning information as those cannot be redirected from the shell like errors can (don't ask me why, but make sure to tell &lt;a href="http://blogs.msdn.com/powershell"&gt;Jeffrey Snover &lt;/a&gt;about this) &lt;/li&gt;
    &lt;li&gt;You can start a transcript by default every time you start your shell by putting 'start-transcript' in your profile.ps1 file &lt;/li&gt;
    &lt;li&gt;There can change the location of the text file that is created. Look at get-help start-transcript for more details &lt;/li&gt;
&lt;/ul&gt;
Have fun! &lt;img src="http://viveksharma.com/TECHLOG/aggbug/44.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/44.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/44.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/44.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Looking for feedback on PowerShell and Exchange</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/10/20/looking-for-feedback-on-powershell-and-exchange.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/10/20/looking-for-feedback-on-powershell-and-exchange.aspx</id>
        <published>2006-10-20T10:10:21-07:00:00</published>
        <updated>2008-01-29T00:09:29Z</updated>
        <content type="html">Every once in a while its important to take a step back and see where we can improve---I already have a list of around ~150 things I'd like to improve in the Shell (Exchange and PowerShell), but I'd like to hear what you a) like about the shell and b) would like to see improved. You can leave comments, trackbacks on your own blogs, or mail me directly at (munging the address to defeat the spammers): vivek (at) thiswebpage'sdomainname.com   Here are some examples I found recently:
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://blogs.3sharp.com/Blog/deving/archive/2006/10/19/2300.aspx"&gt;Devin comments&lt;/a&gt; on how easy it is to move databases through cmdline and wonders why it isn't easy to move queues as well. &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://groups.google.com/group/microsoft.public.windows.powershell/browse_thread/thread/3083c79d24dabf24/36045ed7a911d7c4#36045ed7a911d7c4"&gt;Newsgroup commentary &lt;/a&gt;from a user on how much it rocks to use the Exchange cmdlets to do management, and why AD management from PowerShell isn't just as easy (I don't work for AD team, but rest assured, I'm still working hard on making this happen). &lt;/li&gt;
&lt;/ul&gt;
So let us know what you like (or like a lot) so we can continue making it better and what you would like to see improved / fixed / added so we can plan for our future releases or work up some cool community snippets (after all, that is one huge advantage of the shell). Remember, if you don't speak up, I can't hear you, and thus I can't do anything about any issues :)  &lt;img src="http://viveksharma.com/TECHLOG/aggbug/43.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/43.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/43.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/43.aspx</trackback:ping>
    </entry>
    <entry>
        <title>A strict shell is sometimes a good shell</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/10/14/a-strict-shell-is-sometimes-a-good-shell.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/10/14/a-strict-shell-is-sometimes-a-good-shell.aspx</id>
        <published>2006-10-14T20:10:35-07:00:00</published>
        <updated>2008-01-29T21:30:18Z</updated>
        <content type="html">&lt;p&gt;Sorry for yet another hiatus, times have been busy. To make up for it, here is one of my favorite improvements in PowerShell (BTW: this change was driven partly by REAL IT administrators at Microsoft---thanks folks, you rock!). So here goes. Do you know that in a normal session of PowerShell, unassigned variables are really "null" by default? This is an advantage for folks who love PERL and other Unix-y tools as they can use this assumption to their advantage. But, it also has potential pitfalls---let's say you make one minor mistake in a script and type $&lt;strong&gt;myvariabel&lt;/strong&gt; instead of $&lt;strong&gt;myvariable&lt;/strong&gt;. Well you can imagine the longer the script, the longer the debugging session. So, there is a mode available in PowerShell, thankfully, which lets you be more strict in how the shell treats unassigned variables. Note the behavior change: &lt;strong&gt;Default behavior:&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;PS&amp;gt; $foo &lt;br /&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;PS&amp;gt; &lt;br /&gt;
PS&amp;gt; $foo -eq $null &lt;br /&gt;
True&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;See the problem? No? Well, I'll let you write some complex scripts and get back to me on that one. Here's how you turn off this loose behavior: &lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;PS&amp;gt; set-psdebug -strict &lt;br /&gt;
PS&amp;gt; $foo &lt;br /&gt;
The variable $foo cannot be retrieved because it has not been set yet. At line:1 char:4 + $foo &amp;lt;&amp;lt;&amp;lt;&amp;lt; PS&amp;gt; $foo "is the best variable!" The variable $foo cannot be retrieved because it has not been set yet. At line:1 char:4 + $foo &amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;Use it to your advantage, but since it does change the way the shell interprets variables, learn to use it before turning it on everywhere. I recommend turning it on during scrip execution at first.&lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/42.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/42.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/42.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/42.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Sorting top users and then moving them (2003/2007)</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/09/19/sorting-top-users-and-then-moving-them-20032007.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/09/19/sorting-top-users-and-then-moving-them-20032007.aspx</id>
        <published>2006-09-19T05:09:43-07:00:00</published>
        <updated>2008-01-29T21:34:06Z</updated>
        <content type="html">&lt;p&gt;Brian asked in the &lt;a href="http://www.viveksharma.com/techlog/2006/05/09/technet-webcast-follow-up-out-html-out-ie/"&gt;comments&lt;/a&gt;: &lt;em&gt;"... I am looking for a monad scipt/command that will allow me to sort user on e2k3 by size then move either the top or bottom X number of users..."&lt;/em&gt; &lt;/p&gt;
&lt;p&gt;Try this on Exchange 2007, for 2003, you can use get-wmiobject cmdlet to read &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_wmiref_cl_exchange_mailbox.asp"&gt;Exchange 2003 information using WMI&lt;/a&gt;. This is how you would get the top X users per server (you can optionally do this per database by passing in -database to get-mailboxstatistics): &lt;/p&gt;
&lt;p&gt;&lt;code&gt;get-mailboxstatistics -server Myserver | sort TotalItemSize -desc | select -first 10&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then you can move this list directly using move-mailbox:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;get-mailboxstatistics -server Myserver | sort TotalItemSize -desc | select -first 10 | move-mailbox -target Server2\DataBase2&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;For 2003, its a bit more complicated as we don't have cmdlets for 2003, but fortunately you can use the excellent WMI compatability in PowerShell to read Exchange information. For example:&lt;/p&gt;
&lt;p&gt; &lt;code&gt;get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName MyServer | sort Size&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;This will return a list of mailboxes, which is then sorted, then you can apply the same tricks as before. The one big difference is that since we're dealing with WMI objects (as compared to get-mailboxstatistics objects as in Exchange 2007), you'll have to tweak the pipeline to make things work for moves:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;get-wmiobject -class Exchange_Mailbox -Namespace ROOT\MicrosoftExchangev2 -ComputerName MyServer | sort Size -desc | select -first 10 | foreach { move-mailbox $_.LegacyDN -targetdatabase server2\database2 }&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;Now, a caveat.... I believe this should work but having upgraded all my servers to 2007, I can't quite test it :) Also, please refer to &lt;a href="http://gsexdev.blogspot.com/2005/11/using-monad-and-wmi-with-exchange-2003.html"&gt;this post&lt;/a&gt; by Glen for more information. I believe I've given enough data to point you all in the right direction, so give it a shot and play around with it. Remember, you can always use -whatif and -validate in move-mailbox, which means you can run the commands without any fear :)&lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/41.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/41.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/41.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/41.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Guess who&amp;#8217;s back&amp;#8230; back again!</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/09/16/guess-whos-back-back-again.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/09/16/guess-whos-back-back-again.aspx</id>
        <published>2006-09-16T17:09:49-07:00:00</published>
        <updated>2006-09-16T17:09:49Z</updated>
        <content type="html">&lt;p&gt;As you can tell, I'm back from my month long vacation. It was great! I visited family in India and made my way to several awesome places and also visited Katy in Nepal, pictures to be posted later when I sort through all 1,000 of them! &lt;/p&gt; &lt;p&gt;Anyway, thought I'd kick off blogging again with some fun tricks. If you read the MS Exchange Team blog, you would have spotted the article on &lt;a href="http://msexchangeteam.com/archive/2006/08/08/428619.aspx"&gt;The Secret Decoder Ring&lt;/a&gt;. Long story short, the default admin group and routing group in Exchange 2007 are named quite oddly: &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Exchange Administrative Group (FYDIBOHF23SPDLT)&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;Exchange Routing Group (DWBGZMFD01QNBJR)&lt;/strong&gt;  &lt;/p&gt;&lt;p&gt;I actually didn't know what they meant either... only a few people on the team knew. During a presentation by a fellow PM on the team on the subject, I decided to solve the puzzle using PowerShell. Here is how I got started. &lt;/p&gt; &lt;p&gt;#1. Assume the letters are the results of a cipher &lt;/p&gt; &lt;p&gt;In all ciphers, there is a generating function, so the goal is to guess the generating function. If you can guess the generating function, you can work backwards and construct the original message. &lt;/p&gt; &lt;p&gt;#2. Use PowerShell to examine each letter &lt;/p&gt; &lt;p&gt;We want to look at each letter in a sequence. There are several ways of doing this: &lt;/p&gt; &lt;p&gt;Boring standard way: &lt;/p&gt;&lt;code&gt; &lt;p&gt;$str = "FYDIBOHF23SPDLT" &lt;br /&gt;for($i =0; $i -lt $str.Length; $i++) { $str[$i] } &lt;/p&gt;&lt;/code&gt; &lt;p&gt;Cool powershell way. First examine what is available for you to use using get-member or gm: &lt;/p&gt;&lt;code&gt; &lt;p&gt;"FYDIBOHF23SPDLT" | gm &lt;/p&gt;&lt;/code&gt; &lt;p&gt;You'll see that Strings have an interesting method: &lt;/p&gt;&lt;code&gt; &lt;p&gt;GetEnumerator Method System.CharEnumerator GetEnumerator()&lt;/p&gt;&lt;/code&gt; &lt;p&gt;You see that it returns a CharEnumerator. What does this do?  Best way to find out is to try it out: &lt;/p&gt;&lt;code&gt; &lt;p&gt;PS&amp;gt; "Test".GetEnumerator() &lt;br /&gt;T&lt;br /&gt;e&lt;br /&gt;s&lt;br /&gt;t&lt;/p&gt;&lt;/code&gt; &lt;p&gt;As you can see, each character in the string is returned immediately as a seperate entity. Useful. &lt;/p&gt; &lt;p&gt;#3. Now that we know how to get to each letter in the coded message, its time to guess the generating function. We know that each letter represents an actual value, so it should be straightforward to automate "guessing" the function. From past experience I knew that text ciphers are generally based on a either a rotation scheme (each letter in a code represents another letter). So the best place to start is to write a script that takes the string and then strong arms the rotation (i.e. runs the text through different rotations): &lt;/p&gt;&lt;code&gt; &lt;p&gt;"FYDIBOHF23SPDLT".getenumerator() | % { [char]([int]$_- 20 }  &lt;/p&gt;&lt;/code&gt; &lt;p&gt;What is the above doing? Let me explain what's going on. The result of the call to GetEnumerator() returns characters, which are then passed to a foreach that basically rotates that letter by a given number (in this example it rotates each letter by 20). But that actually returns another list of characters, which is a little annoying. That's not the main problem, its still not automatable, but at least if we had pure human labor and this was a real code to crack, we could throw humans at the problem by letting them guess arbitrary numbers. The real world code crackers, however, rely on automation. &lt;/p&gt; &lt;p&gt;Another explanation of what [Char] [int] does. Each letter returned is a "char" which in technical lingo is a special type representing a readable or non-readable character (like "L"). Well we need to be able to operate on this as a number for our code cracking, so we need to cast it to a number or integer. This is done by applying [int] to the value we want to covert. In PowerShell all literals are either string or nums at the end of the day, so you have to be careful of this trick. For example: &lt;/p&gt;&lt;code&gt; &lt;p&gt;[int]'f' &lt;/p&gt;&lt;/code&gt; &lt;p&gt;fails but: &lt;/p&gt;&lt;code&gt; &lt;p&gt;[int][char]'f' &lt;/p&gt;&lt;/code&gt; &lt;p&gt;works. Can you figure out why? Anyway, back to the exercise, in our case remember that GetEnumerator() returns a CharEnumerator, which coincidentally is a char, so we just need to cast the current letter coming through the pipeline to a [int] and then operate on it, in our case rotating negatively (subtracting) the current char by the given rotation amount. For example: Rot = 1, letter = B, code = A. This is because if you walk back from B by one letter you get A. &lt;/p&gt; &lt;p&gt;#4. Automate the function to walk through a huge list of rotatations. Step #3 gave us a way to apply a rotation &lt;/p&gt;&lt;code&gt; &lt;p&gt;filter guesser&lt;br /&gt;{&lt;br /&gt;  $rot = $_ &lt;br /&gt;  "FYDIBOHF23SPDLT".getenumerator() | % { [char]([int]$_- $rot }  | &amp;amp;{&lt;br /&gt;    process &lt;br /&gt;    {&lt;br /&gt;      $local:s += $_ &lt;br /&gt;    }&lt;br /&gt;    end&lt;br /&gt;    {&lt;br /&gt;      $s &lt;br /&gt;    } &lt;br /&gt;  } &lt;br /&gt;}&lt;/p&gt;&lt;/code&gt; &lt;p&gt;This looks complicated but really what its doing is defining a function that takes numbers and then applies those numbers as rotations to the code. So for example, this works: &lt;/p&gt;&lt;code&gt; &lt;p&gt;PS&amp;gt; 1..5 | guesser &lt;br /&gt;EXCHANGE12ROCKS&lt;br /&gt;DWBG@MFD01QNBJR&lt;br /&gt;CVAF?LEC/0PMAIQ&lt;br /&gt;BU@E&amp;gt;KDB./OL@HP&lt;br /&gt;AT?D=JCA-.NK?GO&lt;/p&gt;&lt;/code&gt; &lt;p&gt;And whoala, there's our secret right there. Looks like the code was using 1 as a rotation :) &lt;/p&gt; &lt;p&gt;To impress your friends (or scare away the ladies), knowing that the rotation is 1, in the future you could just do this: &lt;/p&gt;&lt;code&gt; &lt;p&gt;"FYDIBOHF23SPDLT".getenumerator() | % { [char]([int]$_- 1 }  &lt;/p&gt;&lt;/code&gt; &lt;p&gt;But wait, what about the other message DWBGZMFD01QNBJR? You'll find that 1..200 doesn't yield anything useful. But you should be able to figure that out without changing any of the functions above. Its a nice PowerShell trick that I will leave as an exercise. &lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/40.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/40.aspx</wfw:comment>
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/40.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/40.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Community Run Scripting Contest</title>
        <link rel="self" type="text/html" href="http://viveksharma.com/TECHLOG/archive/2006/09/16/community-run-scripting-contest.aspx" />
        <id>http://viveksharma.com/TECHLOG/archive/2006/09/16/community-run-scripting-contest.aspx</id>
        <published>2006-09-16T14:09:05-07:00:00</published>
        <updated>2008-01-29T21:31:17Z</updated>
        <content type="html">&lt;p&gt;Thanks to Josh for organizing this. In addition to the offical &lt;a href="http://www.microsoft.com/technet/scriptcenter/topics/exchange/contest/default.mspx"&gt;Microsoft One-Liner contest&lt;/a&gt; for Exchange 2007, Josh has started his own &lt;a href="http://joshmaher.wordpress.com/2006/08/25/powershell-scripting-for-exchange-2007/"&gt;scripting contest&lt;/a&gt; for PowerShell and Exchange. The best part about it is, that the winner gets a signed copy of the upcoming PowerShell book from Bruce Payette, one of the leading designers of PowerShell! &lt;/p&gt;
&lt;p&gt;Wow, nice job Jeffrey and Josh. So go forth and submit some scripts to both the &lt;a href="http://www.microsoft.com/technet/scriptcenter/topics/exchange/contest/default.mspx"&gt;official contest&lt;/a&gt; and &lt;a href="http://joshmaher.wordpress.com/2006/08/25/powershell-scripting-for-exchange-2007/"&gt;Josh's&lt;/a&gt;. To sweeten the deal, if you end up winning either contest, I'll put your name, company, winning entry etc. on the official team blog (2 million readers per month), my blog, the Exchange Wiki and the PowerShell team blog... the publicity and fame alone is worth at least a few thousand dollars of advertising money :) &lt;/p&gt;&lt;img src="http://viveksharma.com/TECHLOG/aggbug/39.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://viveksharma.com/TECHLOG/comments/39.aspx</wfw:comment>
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://viveksharma.com/TECHLOG/comments/commentRss/39.aspx</wfw:commentRss>
        <trackback:ping>http://viveksharma.com/TECHLOG/services/trackbacks/39.aspx</trackback:ping>
    </entry>
</feed>