• Notes from the field–Other method to generate 2000 messages in the queues of your Exchange servers

     

     

    1) Just create a text file and put in the following

    from: blabla@domain.com
    to: Recipient@domain.com
    subject: pick up folder test
    This is the body

    2)Then save the file as EML file extension
    3)stop the transport sevrice
    4)copy and paste the file to the pickup folder
    If you hold contol-v it will paste it constantly, then just monitor the folder item count until it's pastes it to the amount of messages you want to queue

    More information on http://support.microsoft.com/kb/297700

     

    Thanks to my colleague and buddy Ed Bringas (former US Escalation Engineer, now Canadian Senior PFE) for this other tip !

     

    Sam

  • Notes from the field–Bulk create 2000 mailboxes and their associated AD accounts from a CSV file + generating 2000 messages in the queues of an Exchange 2007 server in a Lab (to be continued)

     

     

    - The prerequisite step is to create a “Test” OU

    - Then the first step is to create a CSV file using Excel containing 2000 test user names and a minimum set of attributes for these users (Display Name, sAMAccountName, UserPrincipalName, First Name, Last Name). Easy with the “fill series function” of Excel

    image

    image

     

    Then save the file as a CSV file using Excel.

    - The second step is to import that CSV file as 2000 mailboxes using the following script from David Hall from his Signal Warrant blog (giving back to Caesar what is Caesar’s Smile thank you very much David for this simple script !– Just comment my article if you want me to remove your script from my blog page). I modified it very slightly, you can refer to David’s blog for the original one, or create one on your own from scratch using this Technet article - Using the Exchange Management Shell for Bulk Recipient Management.

    Here is a paste from the slightly modified Dave’s script, I left the comments anyways as they are very useful to make it work:

     

    <#

          ** THIS SCRIPT IS PROVIDED WITHOUT WARRANTY, USE AT YOUR OWN RISK ** 

       

        .SYNOPSIS

              Create new mailboxes in Exchange 2010 and the corresponding user in Active Directory.

     

          .DESCRIPTION

              Use the New-Mailbox cmdlet to create mailboxes. The script will prompt you for the default password for all users.

            All accounts are set to prompt the user to change the password at first logon. It then prompts for what OU you want to put the users in,

            change the OU variable AD paths and variable names to correspond to your AD structure. 

            Once the users are created a log file is written to the $logPath.

     

        .REQUIREMENTS

            1.  If you run this script from somewhere other than Exchange server you will need Exchange Management tools installed.

            2.  The mailbox.csv file filled out.

            3.  The proper Exchange RBAC role (Exchange 2010) or permission (Exchange 2007) to create mailboxes.

            4.  The CSV file will need the following columns; Display Name, sAMAccountName, UserPrincipalName, First Name, Last Name

            5.  set-executionpolicy remotesigned

            6.  Customize the $csvPath, $userDB, $logPath and the OU names and variables to match your infrastructure.

     

        .NOTES

            Tested with Exchange 2010, Windows 7, Windows Vista, Windows Server 2003, Windows Server 2K8 and 2K8 R2

     

          .AUTHOR

                David Hall | http://www.signalwarrant.com/

               

          .LINK

               

    #>

     

    # If not called, install the Exchange PSSnapin – Exchange 2007 only – use the “Import-Module” commandlet appropriately for Exchange 2010

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue

     

    # Supply the password for all the newly created accounts

    $password = read-host "Enter Default Password for all accounts created" -AsSecureString

    $ou = ""

     

    # Define these as you wish

    # You'll need a provisionned Mailbox.csv file, and a test database

    $csvPath = "C:\TEMP\mailboxes.csv"

    $userDB = "TestDB"

    $logPath = "c:\TEMP\log.txt"

     

    # you can change the OU and associated variable names to fit your needs

    $ou = "DOMAINA.CONTOSO.CA/TestUnit"

     

     

    Import-CSV "$csvPath" | ForEach {

    New-Mailbox `

    -Password $password `

    -Name $_.'Display Name' `

    -Alias $_.'sAMAccountName' `

    -OrganizationalUnit $ou `

    -sAMAccountName $_.'sAMAccountName' `

    -FirstName $_.'First Name'`

    -LastName $_.'Last Name'`

    -DisplayName $_.'Display Name' `

    -UserPrincipalName $_.'UserPrincipalName' `

    -Database $userDB `

    -ResetPasswordOnNextLogon $true

    } | out-file $logPath -append

     

    Write-Host -foregroundcolor Cyan "Users created, view the log at $logPath"

     

    Exit

     

    - The third step is to create a Distribution Group containing these 2000 mailboxes (very easy as well using the Active Directory Users and Computers console)

    - Then the last step is to use a quick Powershell script (a very simple script that wraps the Send-MailMessage default commendlet) to send one message to this DL, or simply to use an OWA connection to the “Administrator” mailbox or whichever mailbox you have on your Lab environment)

    As an example, here is a script that John Milner wrote and posted on one of his blog’s article (thank you very much John ! – Just comment my article if you want me to remove your script from my blog page).

    One handy feature of John’s script is that he use a parameter that allows to specify the size of the attachment, and create an attachment using the fsutil command within the script. Neat ! Smile

     

    # If not called, install the Exchange PSSnapin – Exchange 2007 only – use the “Import-Module” commandlet appropriately for Exchange 2010

    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue

     

    function Send-MailMessages {

    <#

    .SYNOPSIS

    Generate a constant flow of messages for diagnostic purposes.

     

    .DESCRIPTION

    This script is designed to assist in generating email messages for testing external message flow to and from your messaging infrastructure.

    The ability to quickly send a batch of messages with an attachment on a schedule can help track flow issues or to simply be used to confirm mail routing.

     

    .EXAMPLE

    Send-MailMessages -To Test@Test.com -From Admin@Contoso.com -MessageCount 10 -SecondsDelay 10 -AttachmentSizeKB 1

    Send 10 emails to Test@Test.com every 10 seconds with a 1MB Attachment

     

    .EXAMPLE

    Send-MailMessages -MessageCount 48 -SecondsDelay 1800

    Send an email every 30 minutes for 24 hours.

     

    .LINK

    http://jfrmilner.wordpress.com/2010/08/26/send-mailmessages

     

    .NOTES

    File Name: Send-MailMessages.ps1

     

    Author: jfrmilner

     

    Email: jfrmilner@googlemail.com

    Requires: Powershell V2

    Requires: Exchange Managemnent Shell (Only used to auto find the smtpServer)

    Legal: This script is provided "AS IS" with no warranties or guarantees, and confers no rights. You may use, modify, reproduce, and distribute this script file in any way provided that you agree to give the original author credit.

    Version: v1.0 - 2010 Aug 08 - First Version http://poshcode.org/*

    Version: v1.1 - 2012 April 26 - Fixed when only a single HT Server is available. Added check for existing file. Fixed attachment parameter to use varible.

    #>

     

    param ( [Parameter(Mandatory=$false)] $To = "Test@WingtipToys.com", [Parameter(Mandatory=$false)] $From = "Postmaster@contoso.com", $AttachmentSizeKB=$null, $MessageCount=2, $SecondsDelay=10 )

     

    $messageParameters = @{

     Body = $null | ConvertTo-Html -Body "<H2> Test Message, Please ignore </H2>" | Out-String

     From = $from

     To = $to

     SmtpServer = @(Get-TransportServer)[0].Name.ToString()

     }

     

    if ($AttachmentSizeKB) {

     

    if ((Test-Path $Env:TMP\$($AttachmentSizeKB)mbfile.txt) -ne $true)

          {

          fsutil file createnew $Env:TMP\$($AttachmentSizeKB)mbfile.txt $($AttachmentSizeKB * 1KB)

          }

     

    $messageParameters.Add("attachment", "$Env:TMP\$($AttachmentSizeKB)mbfile.txt") }

     

    1..$MessageCount | % { sleep -Seconds $secondsDelay ; Send-MailMessage @messageParameters -Subject ("Mailflow Test Email - " + (Get-Date).ToLongTimeString() + " Message " + $_ + " / $MessageCount") -BodyAsHtml }

    }

     

     

    Then execute John’s function :

    Send-MailMessages -To BugsRogers@domaina.contoso.ca -From Administrator@domaina.contoso.ca -MessageCount 1 -SecondsDelay 0 -AttachmentSizeKB 150

     

    The problem is :

    • - A Distribution List with 2000 recipients won’t be deflated by a hub server if the recipients are on a mailbox serer on the same AD site as the HUB
    • - We have to either :
      • Put 2000 mailboxes in a DB, dismount that DB, send a message to these 2000 mailboxes
      • Or put 1 mailbox in a test DB, dismount that DB, send 2000 messages to that mailbox
      • Or create 2000 .EML files, and put all of these on the Pickup directory of the HUB server.
      • Or have a lab with 2 AD sites, with HUB/CAS/MBX server in that sites, and send a message to a DL with 2000 members from the other AD site.

     

    Then what I tried that worked so far:

    - Put one user in a temp DB (named “TempDB”)

    - dismount TempDB

    - Using the function brought by John Milner’s script above (I slightly modified his script a bit to change the “AttachmentSizeMB” parameter with “AttachmentSizeKB” to have smaller attachments), type :

    Send-MailMessages -To Buck1.Rogers1@domaina.contoso.ca -From Administrator@domaina.contoso.ca -MessageCount 2000 -SecondsDelay 0 -AttachmentSizeKB 150

    That works as the Perfmon testimonies it (Messages Queued for Delivery counter):

    image

     

     

    To be continued …

  • Powershell V2 : Links for Multi-threading techniques

     

    Udated 10/12/2014 – Ryan Witschger blog address – the most useful and clear article so far in my opinion explaining how to do the best multithreading tasks, using Jobs and using .Net

     

    Multi-Threading in PowerShell V2

    • Using Jobs:

              http://www.get-blog.com/?p=22

    • Using .NET multithreading

              http://www.get-blog.com/?p=189 

     

    Microsoft documentation about Jobs

    http://msdn.microsoft.com/en-us/library/dd878288%28VS.85%29.aspx

    PowerShell internals and PowerShell threading (using .NET)

    http://www.codeproject.com/Articles/261193/ps

     

     

    The [RunspaceFactory] and [PowerShell] Accelerators (Using .NET)

    http://www.nivot.org/post/2009/01/22/CTP3TheRunspaceFactoryAndPowerShellAccelerators.aspx

     

    I’ll post some of my examples once I succeed running them using .NET threading inside Powershell. Using Jobs is the easiest part, but takes more CPU resource from what I read so far…

     

    Sam

  • Updated 4th July 2013 - Bookmark - Exchange Server Build Numbers

     

    Exchange Server and Update Rollups Build Numbers (en-US)

    http://social.technet.microsoft.com/wiki/contents/articles/240.exchange-server-and-update-rollups-build-numbers-en-us.aspx

    Great Barghav, thanks !

     

    *New* Specific to Exchange 2013 and its Cumulative Updates:

    http://social.technet.microsoft.com/wiki/contents/articles/15776.exchange-server-2013-and-cumulative-updates-cus-build-numbers.aspx 

     

     

    Other links :

    Exchange Server Build Numbers and Release Dates up to Exchange 2010 SP1 RU1

    http://technet.microsoft.com/en-us/library/hh135098.aspx

     

     

     

    Sam

  • Outlook 2007/2010–Some basic advice if you experience odd behaviour, startup latencies, calendar item losses ...

    •On an Outlook station of a user who complains about Outlook startup latencies :

     

    –From the file-level antivirus on the desktop/laptop, Exclude files present

    • in the following directories (whichever is applying to your Windows version (Windows XP, Windows Vista or Windows 7)
    • %userprofile%\Application Data\Microsoft\Outlook (Outlook system files)
    • %userprofile%\Local Settings\Application Data\Microsoft\Outlook (Windows XP/Vista, shortcut to "AppData\Local\Microsoft\Outlook" on Windows 7)
    • %userprofile%\AppData\Local\Microsoft\Outlook (Windows 7 location)

    ->Or exclude *.nk2, *.dat, *.srs, *.xml, *.otm, OutlPrnt, *.ost, *.ost.tmp, *.obi and *.oab files from these directories.

    Note 1: if you don’t want to exclude the whole *.xml extensions, which is understandable, you can just exclude the Policy*.xml and *autodiscover.xml files only.

    Note 2: If you still are reluctant about excluding too many files, the following have to be excluded anyways or sooner or later you WILL be exposed to OST or OAB corruption,Outlook cached mode having more latencies that Outlook Online mode, or Calendar meetings being corrupted or simply not updated for you: *.OST, *.PST, *autodiscover.xml, policy*.xml, *.ost.tmp, OutlPrnt, and *.oab 

     

    • Exclude all PST files that the user uses (*.pst)

    -> or the best option is to plan to replace the use of PST files by the Exchange 2010 personal archiving feature (to be discussed with the IT team)

     

    - Check the startup time without any Add-Ons (disable or uninstall them all, and if not possible, open an Outlook profile on an other “neutral” desktop/laptop with a simple Outlook client – without add-ons installed)

    • If without add-ons there are no more latencies, then add the add-ons one by one and restart Outlook until you see the latencies to identify a potential guilty add-on.

     

    – If no add-ons are causing the issues, take and analyse a network trace on the Outlook workstation

    •Check for dropped network frames

    •Check for client/server disconnections ([RST] or [ACK, RST])

    •Check for proper server connection (i.e. outlook is not trying to reach other servers before reaching the final one)

     

    –If nothing it noticed on the Network trace analysis, take an outlook application trace and check if there is an issue with the application installation itself (Outlook troubleshooting mode in the advanced options)

    - Outlook troubleshooting mode useful files :

    > The Outlook troubleshooting transport log file %UserProfile%\AppData\Local\Temp\Outlook logging\Opmlog.log
    > The application and system event logs from the Laptop having the issue in both CSV and EVTX formats.
    > the Application and System event Logs from the machine where the problem has been reproduced:

    - All the following from the %TEMP% directory :

    o The OLKRPCLOG_DD_MM_YYYY_HH_MM_SS_X.ELT files

    o The oldisc.log file

    o The logcalb2 file

    o The “Outlook logging” subdirectory (there will be a couple of text files inside)

    o The OlkCalLogs subdirectory