Flaphead on TechNet

Check out my "other" blog at http://blogs.flaphead.dns2go.com/default.aspx

Flaphead on TechNet

  • get-exchangeserverplus.ps1 v1.3

    So after the release of Rollup Update 5, wouldn't it be nice if you could run a simple PowerShell script to check all your exchange servers and see what Rollup they have applied

    Well now you can ;-) get-exchangeserverplus.ps1

    http://blogs.flaphead.dns2go.com/archive/2007/10/31/get-exchangeserverplus-ps1-v1-3.aspx

  • get-allqueues.ps1 v1.0

    Can remember if I posted this or not, but I forgot who handy it is.

    basically if just runs get-queue, but for all you Exchange 2007 Hub Transport Servers

    Ah, but what is really cool is this .. You can do "stuff" with the output

    http://blogs.flaphead.dns2go.com/archive/2007/11/09/get-allqueues-ps1-v1-0.aspx

  • Technical White Papers for Exchange Server

    The white papers in this section provide technical information about Exchange Server features and functionality.

    To print a white paper, click Printer Friendly Version in your Web browser.

    http://blogs.flaphead.dns2go.com/archive/2007/11/09/technical-white-papers-for-exchange-server.aspx

  • A Month in Exchange: November 2007

    DOWNLOADS for October 2007
    EVENTS / WEBCASTS: November 2007
    NEW ON-DEMAND WEBCASTS for Exchange, released in October 2007
    New KB's in October 2007

    http://blogs.flaphead.dns2go.com/archive/2007/11/09/a-month-in-exchange-november-2007.aspx

  • Certain Windows Server 2003 hotfixes have been repackaged to be compatible with Windows Server 2003 Service Pack 2 (SP2)

    Nooooooooooooo ... Certain Windows Server 2003 hotfixes have been repackaged to be compatible with Windows Server 2003 Service Pack 2 (SP2)
  • TabletPC

    So I am looking to buy my own TabletPC and I am finding it really hard to find a decent website that list out a comprison (If you know one, let me know)

    So here is a little summary: http://blogs.flaphead.dns2go.com/archive/2007/03/14/tabletpc.aspx

  • Microsoft Device Emulator 2.0 -- Standalone Release

    Check this blog out .... I have done some testing

    Microsoft Device Emulator 2.0 -- Standalone Release

  • A troubleshooting guide to the Exchange Calendar Update Tool (Msextmz.exe)

    This is a bit late A troubleshooting guide to the Exchange Calendar Update Tool (Msextmz.exe)
  • Windows Server 2003 Service Pack 2

    It's out now .. check out my other blog ..  Windows Server 2003 Service Pack 2
  • Update for Daylight Saving Time changes in 2007 for Exchange 2003 Service Pack 2 (KB 926666)

    More DST: http://blogs.flaphead.dns2go.com/archive/2007/02/01/update-for-daylight-saving-time-changes-in-2007-for-exchange-2003-service-pack-2-kb-926666.aspx
  • A month in Exchange: January 2007

    I wrote this over on my other site: http://blogs.flaphead.dns2go.com/archive/2007/02/01/a-month-in-exchange-january-2007.aspx

    It has downloads and KBs from January 2007 and Webcasts for February

  • 24 Hours of Exchange Server 2007

    It actually started last week, but here are the 24 x1 hour sessions.  A bit like the TV series I suppose, so that would make Harold Wong our version of Jack Bauer, but Harold is saving the world by spreading the love & adoption of Exchange 2007 ;-)

     http://blogs.flaphead.dns2go.com/archive/2007/01/23/24-hours-of-exchange-server-2007.aspx

  • More DST 2007

    This is turning into a REALLY REALLY BIG issue. 

    I blogged this earlier: http://blogs.flaphead.dns2go.com/archive/2007/01/23/more-dst-2007.aspx

  • Windows PowerShell TechNet Webcasts

    Looks like a weeks worth of Windows PowerShell Webcasts.  The times for the rest of the world are a bit pants - 1930 - 2100 UK time!

    They are only level 200, but a good place to start

    6 Nov 2006
    TechNet Webcast: And Now for Something Completely Different: Introducing Windows PowerShell (Level 200)
    http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032313495%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e
    You have probably heard by now about this new technology from Microsoft, first code-named “Monad” and now officially named Windows PowerShell. What is this? Do I want to learn this? Do I have to learn this? Where do I get it? How does it work? Not to worry, the Scripting Guys are here to answer your questions. In this first of five Webcasts, the Scripting Guys introduce you to Windows PowerShell and give you an overview of how it works and what it is all about.

    7 Nov 2006
    TechNet Webcast: One Cmdlet, Two Cmdlet, Three Cmdlet, Four: An Introduction to Windows PowerShell Commands (Level 200)
    http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032313500%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e
    Doeth the Eagle mount up at thy commaund and make her nest on high?" No, that is not a typo; apparently, that is how the word 'command' was spelled back in the 1600s. Boy, how things have changed: the word is now spelled 'cmdlet', or at least it is if you are a Windows PowerShell developer. In this webcast, the Scripting Guys explore these new beasts known as cmdlets, the heart and sound of the new Windows PowerShell command shell and scripting technology from Microsoft.

    8 Nov 2006
    TechNet Webcast: Objects, Objects everywhere: Working With Objects in Windows PowerShell (Level 200)
    http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032313503%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e
    One of the most interesting new features introduced by Windows PowerShell is the ability to work with objects directly from the command line. Although you might be familiar with the concept of objects as a Windows Script Host (WSH) user, as a Windows PowerShell user, you need to live and breathe objects. In this webcast, the Scripting Guys explore all things related to objects in Windows PowerShell. During the presentation, the Scripting Guys help you instantiate a small Microsoft .NET object for you to call your own

    9 Nov 2006
    TechNet Webcast: New Kid on the Scriptblock: Writing Scripts with Windows PowerShell (Level 200)
    http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032313975%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e
    Yes, Windows PowerShell is a great tool for working at the command line; however, it also happens to be an equally good tool for writing scripts. On day four of our Windows PowerShell week of webcasts, the Scripting Guys introduce you to the fine art of writing scripts with Windows PowerShell.

    10 Nov 2006
    TechNet Webcast: Amazing but True: Things You Never Dreamed You Could Do with Windows PowerShell (Level 200)
    http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032313506%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e
    In this fifth and final Windows PowerShell week webcast, witness definitive proof that the Loch Ness monster exists; meet a man who was abducted by aliens; and hear from a real, live ghost. But that is nothing! Just wait until the Scripting Guys show you some of the incredible things that you can do with Windows PowerShell. Do not miss it!

  • CDO and daylight savings change in GMT - potential issues next week!

    Junners reminded me of this, 910268 Meetings are unexpectedly moved one hour ahead in the last week of October in Exchange Server 2003

    Typically there are only four Sundays in October so normally this is not a problem, however in certain years there are five and 2006 is one of them. So after next Sunday we may get calls that appointments are 1 hour out, especially from customers using Blackberry. You’ll be pleased to know that the next occurrence of this issue won’t happen until 2010, 2011 and 2016.  Also a supported hotfix is now available from Microsoft.

    NB: You must install Microsoft Exchange Server 2003 Service Pack 2 (SP2) before you apply the hotfix

  • Getting Disk Usage Information

    Nice bit of code and uses WMI!


    Source: http://jtruher.spaces.live.com/Blog/cns!7143DA6E51A2628D!138.entry

    Some of you might know that I've spent a lot of time on UNIX systems.  One of the scripts that I used a bunch was /etc/dfspace.  If you don't know what dfspace is, it's a simple wrapper for df that provides disk usage info in a more human readable format than the output of df.  Since I really miss having that on Windows, I built it in powershell using the Get-WMIObject cmdlet.  Here's how it looks when you run it:

    PS> dfspace
    name                  Size (MB) free (MB) percent
    ----                  --------- --------- -------
    C:                   152,499.84 76,827.33   50.38

  • Powershell and the Registry

    Originally Posted here: http://blogs.flaphead.dns2go.com/archive/2006/09/08/3548.aspx


    Brett touched on this a while back, and I just wanted to pad things out a bit.

    So as brett mentioned, you can access the registry like a file system in powershell. 

    So start up powershell and type:

    PS C:\> sl HKLM:
    PS HKLM:\>

    Now you can sl, cd and chdir are all an alias for Set-Location, so you can use either.  You can see the aliases for Set-Location by typing:

    PS HKLM:\> get-alias | where-object {$_.Definition -eq "Set-Location"}

    CommandType     Name                            Definition
    -----------     ----                            ----------
    Alias           sl                              Set-Location
    Alias           cd                              Set-Location
    Alias           chdir                           Set-Location

    Now you can type dir and navigate the registry like the file system using cd etc etc.  How cool is that.  You can also get it to “auto fillin” by using <TAB>.

    So that is okay, but what about the properties of keys?  Well get to the key you want and show it’s properties like this:

    PS HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters> get-itemproperty .

    PSPath                  : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHIN E\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
    PSParentPath            : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT
    PSChildName             : Parameters
    PSDrive                 : HKLM
    PSProvider              : Microsoft.PowerShell.Core\Registry
    NbProvider              : _tcp
    NameServerPort          : 137
    CacheTimeout            : 600000
    BcastNameQueryCount     : 3
    BcastQueryTimeout       : 750
    NameSrvQueryCount       : 3
    NameSrvQueryTimeout     : 1500
    Size/Small/Medium/Large : 1
    SessionKeepAlive        : 3600000
    TransportBindName       : \Device\
    EnableLMHOSTS           : 1
    DhcpNodeType            : 4

    If you want a specific property you can get it by typing:

    PS C:\> $(Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters).DHCPNodeType
    4

    so this is cool too.  So now in a cmdlet I want to store a variable from a registry key entry.  How do I do that?  Well the same as above

    PS C:\> $regkey = $(Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters).DHCPNodeType
    PS C:\> $regkey
    4

    Okay, so what else.  You can do this:

    PS HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters> dir -recurse

    and it wil list all the folders and subfolder under the key.  What I have not been able to find yet is get an output similar to reg.exe /enum.  If anyone know hows to let me know

    Anyway so this is how you read from the registry, what about writing?.  So create a new key just do this:

    PS HKLM:\SYSTEM\CurrentControlSet\Services\NetBT> md test

       Hive: Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT

    SKC  VC Name                           Property
    ---  -- ----                           --------
      0   0 test                           {}

    PS HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\test> New-ItemProperty . -name Fred -value "hello"

    PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\test
    PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT
    PSChildName  : test
    PSDrive      : HKLM
    PSProvider   : Microsoft.PowerShell.Core\Registry
    Fred         : hello

    and if I want to change the value for Fred

    PS HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\test> Set-ItemProperty . -name Fred -value "goodbye"
    PS HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\test> Get-ItemProperty .

    PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\test
    PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT
    PSChildName  : test
    PSDrive      : HKLM
    PSProvider   : Microsoft.PowerShell.Core\Registry
    Fred         : goodbye

    How cool is that.  Hope this helps more to come soon

  • Outputting Powershell Commands

    Originally Posted here: http://blogs.flaphead.dns2go.com/archive/2006/08/31/3538.aspx


    My buddy Brett asked me about this a few weeks ago and I never managed to get to him .. sorry buddy! So I decided to come back to everyone.

    After playing with powershell a bit you get an idea of the power you have.  So something that really makes it rock is the ability to pipe the output from a command to another command.

    So I have a few to show you.

    OUT-HTML
    This will Pipe the output of command to a HTML table.  You can get the source from Viveks web site (
    http://www.viveksharma.com/techlog/attache/out-html.web.txt)

    Okay so:
    PS > dir *.ps1

        Directory: Microsoft.PowerShell.Core\FileSystem::C:\

    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    -a---        31/08/2006     14:32       2037 format-hex.ps1
    -a---        24/07/2006     22:16       1713 For_Loops.ps1

    Becomes (this is just a snip):

    PS > dir *.ps1 | out-html

    PS C:\_> dir *.ps1 | out-html
    <style>
    <!--
    body { font: Helvetica }
    table { font: 12pt Helvetica; border: 0px}
    td { border: 1px solid lightgray; padding-left: 15px; padding-right: 15px }
    p.header { font: 16pt Helvetica; color: DarkBlue }
    p.normal { font: 14pt Helvetica; }
    -->
    </style>
    </head>
    <body>
    <p class="header" align='center'><strong>Output Generated by paulfl at: 31/08/2006 15:56:02 on machine paulfl-m400 </strong></p>
    <p class='normal' align='center'><strong>Command line:</strong> dir *.ps1 | out-html</p><br>
    <table border="1" cellpadding="0" cellspacing="0" align="center">
    <tr>
            <td align="center" style="background-color: darkblue"><p class="table" style="color: white"><b>PSChildName</b></p></td>
            <td align="center" style="background-color: darkblue"><p class="table" style="color: white"><b>PSDrive</b></p></td>
            <td align="center" style="background-color: darkblue"><p class="table" style="color: white"><b>PSIsContainer</b></p></td>
            <td align="center" style="background-color: darkblue"><p class="table" style="color: white"><b>PSParentPath</b></p></td>
            <td align="center" style="background-color: darkblue"><p class="table" style="color: white"><b>PSPath</b></p></td>

    OUT-IE
    This is cool, as it lets you output the command to an IE window.  You can see where I am coming from, can’t you.  Combine out-html and out-ie and you get a nice table in a new IE window.  out-ie is quite a simple bit of code, and vivek details it here:
    http://www.viveksharma.com/techlog/2006/05/09/technet-webcast-follow-up-out-html-out-ie/

    so when I do the following, it list out a dir *.ps1 into a new IE window in a formatted table.  How cool is that!

    PS > dir *.ps1 | out-html | out-ie

    OUT-GRID
    This is quite cool.  I found the source here: http://abhishek225.spaces.live.com/PersonalSpace.aspx?_c11_blogpart_blogpart=blogview&_c=blogpart&partqs=amonth%3D5%26ayear%3D2006, right down the bottom of the page.

    So the following command will open up a data grid application and display the results!

    PS > dir *.ps1 | out-grid

    AND FINALLY
    Once you have collated all the out– you want, you should copy them in to C:\Program Files\Windows PowerShell\v1.0  That way you can use them at any PS> prompt!

    I have seen a few more too, but I can’t find them on the web, so if anyone can find: out-chart and out-email let me know and I will post them up

  • Exchange 2007 Powershell: Get-Tip

    Originally Posted here: http://blogs.flaphead.dns2go.com/archive/2006/08/17/3514.aspx


    You know if you start the Exchange Management Shell, it gives you a “tip”.  Well it would seem that it has 80 of them!  So I thought it would be good to list them all out

    You can just type get-tip in the Exchange Management Shell, but if you want a specific one type get-tip 8 and you wil get #8.  Anyway here is the current list and the commands so you can list it yourself! ;-)

    [PS] C:\>for ($i=1; $i -lt 81; $i++) {get-tip $i}

    – OR -

    [PS] C:\>1..80 | foreach { get-tip $_ }


    Tip of the day #1:
    To return all scripts that are found in your path, type:

     Get-Command -Type ExternalScript

    And for a useful shortcut, assign it in your profile as:

     Function Get-Scripts { -Command -Type ExternalScript }

    Tip of the day #2:
    Are you tired of typing a long command every time that you want to do something?
    Alias it! Type:

     Set-Alias GetSg Get-StorageGroup

    For all the current aliases, type:

     Get-Alias

    Tip of the day #3:
    The Exchange Management Shell is a calculator too! Try it directly in the command line:

     1.2343+3123 or (23/435)*2

    Tip of the day #4:
    Command line 911! Do you need help? Type:

     Help <cmdlet-name>  or  <cmdlet-name> -?

    You can also perform wildcard character searches and partial name matches:

     Help *UM*

    And you can get more details about a cmdlet by using:

     Get-Command <cmdlet-name>

    Tip of the day #5:
    A quick shortcut to get all the parameters for a cmdlet is:

     Get-Command <cmdlet-name> | format-list Definition

    or abbreviated:

     Gcm <cmdlet-name> | fl Def*

    Tip of the day #6:
    The tilde character (~) should be familiar to Unix users. It represents the shortcut to your root directory. To see what it's evaluated to by default, type:

     Dir ~

    You can use it as a useful shortcut:

     Cp SomeFile "~\My Documents"

    Tip of the day #7:
    Do you want to move mailboxes? Type:

     Move-Mailbox

    You can move all users from server SRV1 to server SRV2 as follows:

     Get-Mailbox -Server SRV1 | Move-Mailbox -Target SRV2

    Tip of the day #8:
    CTRL+C is the equivalent of the hard-break command in the Exchange Management Shell. If a command is taking too long to run or you want to cancel an operation quickly, press CTRL+C to stop execution.

    Tip of the day #9:
    Pushd and Popd work the same way in the Exchange Management Shell as they do in cmd.exe. Type:

     Pushd <location>

    Tip of the day #10:
    XML over everything! The Exchange Management Shell treats XML as a native type, so that you can do interesting things like:

     $Sample = [XML](Get-Content SomeXMLFile.xml)

    This command assigns $Sample to the actual XML object. To see it, type:

     $Sample

    To navigate it, type:
    $Sample.Prop1.Prop2

    No need for text parsing when you want to load XML data!

    Tip of the day #11:
    Identity is your friend. Identity is a powerful construct that lets you view, modify, or remove a particular Exchange object or configuration set by referring to it by a friendly name. Additionally, you can even specify server name as part of the identity. For example: the following command will try to find "First Storage Group" on the localhost because no server was specified:

     Get-StorageGroup "First Storage Group"

    If you know exactly where "First Storage Group" is, you can use:

     Get-StorageGroup "Server1\First Storage Group"

    This same pattern can be applied to all Active Directory-based configurations.

    Tip of the day #12:
    Cmdlets that end in "Config" manage singleton configuration, either one per server or organization. For these tasks, you don't have to specify an identity because there is only one instance of the configuration. You may have to specify the Server parameter if the configuration is per server.

    Tip of the day #13:
    To get a list of all users on an Exchange 2007 server who are not Unified Messaging-enabled type, use:

     Get-UmMailbox | ForEach { If($_.UmEnabled -Eq $False){$_.Name}}

    Tip of the day #14:
    To get a list of all users on an Exchange 2007 server who are Unified Messaging-
    enabled type, use:

     Get-UmMailbox | ForEach { If($_.UmEnabled -Eq $True){$_.Name}}

    Tip of the day #15:
    To display the user's alias formatted in a table together with the user's Exchange 2007 server name and telephone extension, type:

     Get-UmMailbox | Format-Table ServerName,@{e={$_.SamAccountName};Label="User Alias"},@{Expression="Extensions";Label="Telephone numbers"}

    Tip of the day #16:
    To display the list of UM IP gateway server names that are disabled for outbound calling and hunt groups that are associated with a UM IP gateway server, use:

     Get-UmIpGateway | ForEach {If($_.OutCallsAllowed -Eq $False){ "Gateway Name = " +$_.Name;ForEach ($HuntGroup In $_.Huntgroups){"Huntgroups " + $Huntgroup

    Tip of the day #17:
    If you want to test all IP Block List providers, you just have to pipe the Get-IpBlockListProvider cmdlet to the Test-IpBlockListProvider cmdlet:

     Get-IpBlockListProvider | Test-IpBlockListProvider -IpAddress 192.168.0.1

    Tip of the day #18:
    Before you remove an object by using the Remove verb, use the WhatIf parameter to verify the results are what you expect.

    Tip of the day #19:
    Sometimes it's useful to convert a cmdlet's output to a string to interoperate with native cmdlets. For example, type:

     Get-Command | Out-String | Findstr "command"

    Tip of the day #20:
    Do you want to find a specific string in the output of a cmdlet? Match-String is a grep clone that is useful for matching output with strings. Try it out:

     Dir | Match-String "somename"

    Tip of the day #21:
    Get all Win32 WMI information, such as perfmon counters and local computer configurations. For example, type:

     Get-WMIObject Win32_PerfRawData_PerfOS_Memory

    Tip of the day #22:
    Tired of spam? Who isn't? You can configure real-time block list (RBL) providers with the Exchange Management Shell by running the following two commands:

     Set-IPBlockListProvidersConfig -Enabled $True -InternetEnabled $True

    and then

     Add-IPBlockListProvider -Name <Name of RBL Provider> -LookupDomain <FQDN of RBL Provider> -ResultType Any

    Tip of the day #23:
    Access the event log from the Exchange Management Shell. To retrieve the whole event log, run:

     Get-EventLog | Format-List

    To retrieve all Exchange-related events, run:

     Get-EventLog Application | Where ($_.Source -Ilike "*Exchange*")

    Tip of the day #24:
    You can arrange the output of most cmdlets in a more readable manner by piping the output of the cmdlet to Format-List or Format-Table. For example, type:

     Get-EventLog Application | Format-List

    Tip of the day #25:
    One benefit of the Exchange Management Shell is that cmdlets can emit objects to the console. You can then manipulate this output and organize it in interesting ways. For example, to get a quick view in tabular format, use Format-Table:

     Get-Mailbox | Format-Table FirstName,LastName,ServerName

    Tip of the day #26:
    Did you forget a property name? Not a problem because you can use wildcard characters to retrieve all properties that match the part of the name that you specify:

     Get-Mailbox | Format-Table First*,SMTP*

    Tip of the day #27:
    Do you want to work with data that is contained in a CSV file? Use Import-CSV to assign the data to an object. For example, type:

     $MyCSV = Import-CSV TestFile.CSV

    You can then manipulate the data easily in the Exchange Management Shell. For example, if there is a column called Mailboxes in the CSV data, you can use the following commands to sort or group the data by the Mailboxes column:

    To sort: $MyCSV | Sort Mailboxes
    To group: $MyCSV | Group Mailboxes

    Tip of the day #28:
    This command spins through all your mailbox servers and reconnects all the uniquely identified but disconnected mailboxes in any one of the mailbox stores:

     Get-ExchangeServer | `
      Where { $_.IsMailboxServer -Eq '$True' } `
      | ForEach { Get-MailboxStatistics -Server $_.Name `
      | Where { $_.DisconnectedDate -NotLike '' } `
      | ForEach { $Var | Connect-Mailbox -Identity `
        $_.MailboxDisplayName } }

    Tip of the day #29:
    Tab completion reduces the number of keystrokes that are required to complete a cmdlet. Just press the TAB key to complete the cmdlet you are typing. Tab completion kicks in whenever there is hyphen (-) in the input. For example:

     Get-Send<tab>

    should complete to Get-SendConnector. You can even use regular expressions, such as:

     Get-U*P*<tab>

    Pressing the TAB key when you enter this command cycles through all cmdlets that  match the expression, such as the Unified Messaging Mailbox policy cmdlets.

    Tip of the day #30:
    Do you want to create a group of test users in your lab? Use this command:

     1..100 | ForEach { Net User "User$_" MyPassword=01 /ADD /Domain; Enable-Mailbox "User$_" -Database "<Mailbox Database>" }

    Tip of the day #31:
    Do you love the Exchange Management Shell's Tip of the Day? Try this out:

     Get-Tip

    Tip of the day #32:
    Do you want to change the authentication settings on an Outlook Web Access virtual directory? Try the following command as an example. It changes authentication from forms-based authentication to Windows authentication:

     Set-OwaVirtualDirectory -Identity "OWA (Default Web Site)" -FormsAuthentication 0 -WindowsAuthentication 1

    Tip of the day #33:
    Do you want to set the properties on all or some Outlook Web Access virtual directories? Pipe the output of Get-OwaVirtualDirectory to the Set-OwaVirtualDirectory cmdlet. For example, the following command sets the Gzip level for all Outlook Web Access virtual directories:

     Get-OwaVirtualDirectory | Set-OwaVirtualDirectory -GzipLevel High

    Tip of the day #34:
    Do you want to remove an ActiveSync device from a user's device list? Type:

     Remove-MobileDevice

    This cmdlet can be helpful for troubleshooting devices that do not synchronize successfully with the server.

    Tip of the day #35:
    Do you want to clear all data from a mobile device? Use:

     Clear-MobileDevice

    Specify a time of day to clear the device, or let the task complete the next time that the device connects to the server.

    Tip of the day #36:
    Do you want to see a list of all devices that synchronize with a user's mailbox? Type:

     Get-MobileDeviceStatistics

    A variety of information is returned including device name, operating system, and last sync time.

    Tip of the day #37:
    Has one of your users asked you to recover their mobile device synchronization password? To return the user's password, type:

     Get-MobileDeviceStatistics -ShowRecoveryPassword

    Tip of the day #38:
    Do you want to move the storage group path to another location? Type:

     Move-StorageGroupPath -EdbFilePath DestFileName

    To change only the path setting without moving data, use this command together with the ConfigurationOnly parameter. This command is especially useful for disaster recovery. Caution: Misuse of this cmdlet will cause data loss.

    Tip of the day #39:
    Do you want to move your database path to another location? Type:

     Move-DatabasePath -LogFolderPath DestFolderName

    To change the file path setting without moving data, use this command together with the ConfigurationOnly parameter. This command is especially useful for disaster recovery. Caution: Misuse of this cmdlet will cause data loss.

    Tip of the day #40:
    Not all parameters of a task are viewable through Get-Command. To get a dynamicparameter, type:

     Get-DynamicParameters <Cmdlet>

    Tip of the day #41:
    To set the dial restrictions on a specific Unified Messaging dial plan, type:

     $Dp = Get-UmDialPlan -Identity <Your_DialPlan_Identity>
     $Dp.ConfiguredInCountryGroups.Add("Group1,91xxxxxxxxxx,91xxxxxxxxxx")
     $Dp.ConfiguredInCountryGroups.Add("Group1,9xxxxxxxxxx,91xxxxxxxxxx")
     $Dp.ConfiguredInCountryGroups.Add("Group1,9xxxxxxx,9xxxxxxx")
     $Dp.AllowedInCountryGroups.Add("Group1")
     $Dp.OutsideLineAccessCode = 9
     $Dp | Set-UmDialPlan

    Tip of the day #42:
    Do you want to reconnect a large number of disconnected mailboxes? Type:

     Get-MailboxStatistics | Where {$_.DisconnectDate -ne $Null} | Connect-Mailbox -Database <MailboxDatabase>

    Tip of the day #43:
    Do you need an easy way to add a new primary SMTP address to a group of mailboxes? The following command creates a new e-mail address policy that assigns the @contoso.com domain to the primary SMTP address of all mailboxes with Contoso in the company field:

     New-EmailAddressPolicy -Name Contoso -RecipientFilter {Company -Eq "Contoso"} -EnabledPrimarySMTPAddressTemplate "@contoso.com"

    Tip of the day #44:
    Do you want to retrieve a group of objects that have similar identities? You can use wildcard characters with the Identity parameter to match multiple objects. Type:

     Get-Mailbox *John*
     Get-ReceiveConnector *toso.com
     Get-JournalRule *discovery*

    Tip of the day #45:
    Do you want to configure a group of objects that have similar identities? You can use a wildcard characters with the Identity parameter when you use a Get cmdlet and pipe the output to a Set cmdlet. Type:

     Get-Mailbox *John* | Set-Mailbox -ProhibitSendQuota 100MB

    This command matches all mailboxes with the name "John" in the mailbox's identity and set the ProhibitSendQuota parameter to 100MB.

    Tip of the day #46:
    Most cmdlets let you pass the output of one noun to another noun in order to view or modify related objects. For example, you might want to set the mailbox limit on all mailboxes that reside in a specific mailbox database on a server. You can do this by using this command:

     Get-MailboxDatabase "Executives" | Get-Mailbox | Set-Mailbox -ProhibitSendQuota 300MB

    This command retrieves all the mailboxes that reside in the "Executives" mailbox  database and sends their ProhibitSendQuota value to 300MB.

    Tip of the day #47:
    Forgot what the available parameters are on a cmdlet? Just use tab completion! Type:

     Set-Mailbox -<tab>

    When you type a hyphen (-) and then press the Tab key, you will cycle through all the available parameters on the cmdlet. Want to narrow your search? Use wildcard characters with a part of the parameter's name. Type:

     Set-Mailbox -Prohibit*<tab>

    Tip of the day #48:
    Say goodbye to ping. Say hello to Test-MapiConnectivity! Use Test-MapiConnectivity to troubleshoot connectivity problems between your users and your servers. Combine Test-MapiConnectivity with a variety of cmdlets to target your specific issue without having to manually dig for the information:

    Mailboxes: Get-Mailbox <Mailbox Name> | Test-MapiConnectivity
    Mailbox databases: Get-MailboxDatabase <Database Name> | Test-MapiConnectivity
    Servers: Get-MailboxServer <Server Name> | Test-MapiConnectivity

    Tip of the day #49:
    Do you want to add an alias to multiple distribution groups that have a similarname? Type:

     Get-DistributionGroup *Exchange* | Add-DistributionGroupMember -Member kim

    This command adds the alias "kim" to all distribution groups that contain the word "Exchange".

    Tip of the day #50:
    Do you want to record exactly what happens when you're using the Exchange Management Shell? Use the Start-Transcript cmdlet. Anything that you do after you run this cmdlet will be recorded to a text file that you specify. To stop recording your session, use the Stop-Transcript cmdlet. Notice that the Start-Transcript cmdlet overwrites the destination text file by default. If you want to append your session to an existing file, use the Append parameter:

     Start-Transcript c:\MySession.txt -Append

    Tip of the day #51:
    Here's a handy tip for repeating a command a given number of times. Instead of writing a For loop, use the following syntax:

     1..10 | ForEach { "do something here" }

    For example, the following command creates 10 new storage groups that have the names sg1 through sg10 on the server TestServer:

     1..10 | ForEach { New-StorageGroup -Name "sg$_" -server TestServer }

    Tip of the day #52:
    Do you want to know when your mailbox databases were backed up last? Type:

     Get-ExchangeServer | Get-MailboxDatabase -Status | Format-Table Name, *Back*

    Tip of the day #53:
    Do you want to move all the mailboxes from one mailbox database to another? You can do this easily by using the following command:

     Get-MailboxDatabase <Source Mailbox Database> | Get-Mailbox | Move-Mailbox -TargetDatabase <Destination Mailbox Database>

    You can even use wildcard characters with the Get-MailboxDatabase cmdlet to consolidate mailboxes from multiple source mailbox databases into a single destination mailbox database.

    Tip of the day #54:
    Do you have a user who has network access but maintains an external mail account outside your Exchange organization? With Exchange Server 2007, you can now create mail-enabled users that are regular Active Directory accounts, but also behave like mail-enabled contacts. By using the Enable-MailUser cmdlet, you can add e-mail contact attributes to any existing Active Directory user who does not already have a mailbox on an Exchange server. Users in your Exchange organization will then be able to send e-mail messages to that user's external mail account. Type:

     Enable-MailUser -Identity <Active Directory Alias> -ExternalEmailAddress <Destination SMTP Address>

    Tip of the day #55:
    Do you want to change the default prohibit send quota for a mailbox database? Type:

     Set-MailboxDatabase <Mailbox Database Name> -ProhibitSendQuota <New Quota Size>

    You can specify a bytes qualifier when you use the ProhibitSendQuota parameter.
    For example, if you want to set the prohibit send quota to 200 megabytes, type:

    ProhibitSendQuota 200MB

    You can also configure the IssueWarningQuota parameter and the ProhibitSendReceiveQuota parameter in the same way.

    Tip of the day #56:
    Do you want to know what version of Exchange Server each of your servers is running? Type:

     Get-ExchangeServer | Format-Table Name, Version

    Tip of the day #57:
    Do you want to know which Exchange 2007 servers have not yet been configured with a valid product key and whether their trial period has expired? Type:

     Get-ExchangeServer | Where { $_.IsExchange12TrialEdition -Eq $true } | Format-Table Name, *Trial*

    Tip of the day #58:
    Do you want to determine whether a server is running Exchange Server 2007 Standard or Exchange Server 2007 Enterprise? Type:

     Get-ExchangeServer <Server Name> | Format-Table Name, Edition

    If you want to view which edition all your Exchange servers are running, omit the <Server Name> parameter.

    Tip of the day #59:
    Do you want to create a new resource mailbox that can be used to book a meetingroom? Type:

     New-Mailbox -Name <Conference Room Name> -UserPrincipalName <Alias or SMTP Address> -Database <Mailbox Database> -OrganizationalUnit <Organizational Unit> -ResourceType Room

    This command creates a disabled Active Directory user with a mailbox that accepts meeting requests from users.

    Tip of the day #60:
    Do you want to add a disclaimer to all outbound e-mail messages? Type:

     $Condition = Get-TransportRulePredicate FromScope
     $Condition.Scope = "Internal"
     $Condition2 = Get-TransportRulePredicate SentToScope
     $Condition2.Scope = "External"
     $Action = Get-TransportRuleAction ApplyDisclaimer
     $Action.Text = "Sample disclaimer text"
     New-TransportRule -Name "Sample disclaimer" -Condition @($Condition, $Condition2) -Action @($Action)

    Tip of the day #61:
    Do you want to control the properties of e-mail messages sent to a specific domain? Use the RemoteDomain cmdlets. Create a new remote domain by using the New-RemoteDomain cmdlet. Type:

     New-RemoteDomain -Name "Contoso.com Configuration" -DomainName contoso.com

    Then modify the properties that you want for this remote domain by using the Set-RemoteDomain cmdlet:

     Set-RemoteDomain "Contoso.com Configuration" -AutoReplyEnabled $True -AutoForwardEnabled $True

    Tip of the day #62:
    <>

  • Powershell 101: IF .. Else

    Originally Posted here: http://blogs.flaphead.dns2go.com/archive/2006/08/14/3509.aspx


    Okay as a beginner this took a bit of time to perfect so here goes. For some of you hardened programmers this might be a bit basic, but I had to start somewhere.  My background is cmd and vbs files with some html chucked in, so this syntax is new to me

    Simple IF, Else

    $a = "Powershell"
    IF ($a -eq "PowerShell")
    {
     "Statement is True"
    }
    ELSE
    {
     "Statement is False"
    }

    You can condence this to:

    $a = "Powershell"
    IF ($a -eq "PowerShell"){ "Statement is True"} ELSE { "Statement is False"}

    Now if you want to check for a NULL then it gets fun

    $b = “Hello”
    IF ($b -eq $NULL)
    {  
    "B is NULL"
    }
    ELSE
    {
     "B is NOT NULL"
    }


    So you have whole load of conditional statement like these:

    Operator

    Definition

    -lt

    Less than

    -le

    Less than or equal to

    -gt

    Greater than

    -ge

    Greater than or equal to

    -eq

    Equal to.  If the left hand side of the operator is an array and the right hand side is a scalar, the equivalent values of the left hand side will be returned

    -ne

    Not Equal to. If the left hand side of the operator is an array and the right hand side is a scalar, the not equivalent values of the left hand side will be returned

    -contains

    Determine elements in a group, this always returns Boolean $True or $False.

    -notcontains

    Determine excluded elements in a group, this always returns Boolean $True or $False.

    -like

    Like - uses wildcards for pattern matching

    -notlike

    Not Like - uses wildcards for pattern matching

    -match

    Match - uses regular expressions for pattern matching

    -notmatch

    Not Match - uses regular expressions for pattern matching

    -band

    Bitwise AND

    -bor

    Bitwise OR

    -is

    Is of Type

    -isnot

    Is not of Type

    These operators are the case-sensitive counterparts:

    Operator

    Definition

    -clt

    Less than (case sensitive)

    -cle

    Less than or equal to (case sensitive)

    -cgt

    Greater than (case sensitive)

    -cge

    Greater than or equal to (case sensitive)

    -ceq

    Equal to  (case sensitive)

    -cne

    Not Equal to (case sensitive)

    -clike

    Like (case sensitive)

    -cnotlike

    Not Like (case sensitive)

    -ccontains

    left hand side contains right hand side in a case sensitive manner

    -cnotcontains

    determine excluded elements in a group in a case sensitive manner

    -cmatch

    Match (case sensitive)

    -cnotmatch

    Not Match (case sensitive)

    Other operators:

    Operator

    Definition

    +

    Add

    -

    Subtract

    *

    Multiply

    /

    Divide

    %

    Modulo

    -not

    logical not

    !

    logical not

    -band

    binary and

    -bor

    binary or

    -bnot

    binary not

    -replace

    Replace (e.g.  "abcde" –replace "b","B") (case insensitive)

    -ireplace

    Case-insensitive replace (e.g.  "abcde" –ireplace "B","3")

    -creplace

    Case-sensitive replace (e.g.  "abcde" –creplace "B","3")

    -and

    AND (e.g. ($a -ge 5 -AND $a -le 15) )

    -or

    OR  (e.g. ($a –eq "A" –OR $a –eq "B") )

    -is

    IS type (e.g. $a -is [int] )

    -isnot

    IS not type (e.g. $a -isnot [int] )

    -as

    convert to type (e.g. 1 -as [string] treats 1 as a string )

    ..

    Range operator (e.g.  foreach ($i in 1..10) {$i }  )

    &

    call operator (e.g. $a = "Get-ChildItem" &$a executes Get-ChildItem)

    . (dot followed by a space)

    call operator (e.g. $a = "Get-ChildItem" . $a executes Get-ChildItem in the current scope)

    -F

    Format operator (e.g. foreach ($p in Get-Process) { "{0,-15} has {1,6} handles" –F  $p.processname,$p.Handlecount } )

  • Windows PowerShell .. Updated 8 Aug 2006

    Originally Posted here: http://blogs.flaphead.dns2go.com/archive/2006/08/02/3492.aspx


    Okay so I am joining the craze and I wanted to start with a list of resources I have discovered so far:


    Blog of Windows PowerShell team: http://blogs.msdn.com/powershell/

    Windows PowerShell ScriptCenter:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

    Vivek Sharma: http://www.viveksharma.com/techlog

    Glen's Exchange Dev Blog: http://gsexdev.blogspot.com/

    Andrew Watt: http://www.mmmug.co.uk/cs/blogs/andrew_watt_mvp/default.aspx

    PowerShell For Fun: http://mshforfun.blogspot.com/

    Scott Hanselman: http://www.hanselman.com/blog/CategoryView.aspx?category=PowerShell

    Lee Holmes (Precision Computing): http://leeholmes.com/blog/

    Windows Powershell SDK: http://windowssdk.msdn.microsoft.com/en-us/library/ms714469.aspx

    I have some code snippets to come soon too.  If I have missed any links of please let me know and I can add them

    Updated 3rd Aug 2006

    /\/\o\/\/ PowerShelled: http://mow001.blogspot.com/

    Windows Power Shell Wiki: http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki

    The PowerShell Script Centre: http://www.reskit.net/monad/samplescripts.htm

    Computer Performance: http://computerperformance.co.uk/powershell/index.htm

    Keith Hill's Blog: http://keithhill.spaces.live.com/blog/

    Windows PowerShell Community Extensions: http://www.gotdotnet.com/workspaces/workspace.aspx?id=bd8982c2-9e47-4793-b7c8-35a4c9105330

    Updated 8th Aug 2006

    Getting more and more links as I start to dig!

    http://jdhitsolutions.blogspot.com/

     

    http://monadblog.blogspot.com/

     

    http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/

     

    http://www.leeholmes.com/blog/TheStoryBehindTheNamingAndLocationOfPowerShellProfiles.aspx

     

    http://www.leeholmes.com/blog/AHistoryBrowsingPrompt.aspx

     

    http://monadblog.blogspot.com/2006/06/prompt-function.html

    http://del.icio.us/powershell

    http://www.exchangeninjas.com/PSSMisc

  • Sim Blog

    So I also have a blog here: blogs.flaphead.com and I will now sim blog anything that looks relevant, so enjoy
  • Webcast: Exchange Activesync Troubleshooting Deep Dive

    Webcast video, Slide deck and demos are here: Webcast: Exchange Activesync Troubleshooting Deep Dive

  • Exchange 2003 Tools Update

    Last night we release a set of updated tools for use with Exchange 2003.  Here is a list:

  • Exchange 2003 Microsoft Server ActiveSync and VSAPI

    This is was blogged over here: http://feeds.feedburner.com/flaphead?m=245

    … In "Exchange VSAPI" there are really 3 ways a message item can be scanned in the Information Store.

    http://blogs.flaphead.dns2go.com/archive/2005/10/10/3150.aspx