• SQL 2012 Unattended installation & Configuration file creation

    Introduction

    In many cases you might be faced with a requirement to perform an unattended SQL Server 2012 installation. To perform SQL Server 2012 installation you need to perform many choices and steps to configure your installation so the question is how to provide all these details during an unattended installation?

    Solution

    There are many methods to perform SQL 2012 unattended installation, one of these methods is to perform image preparation which is greatly enhanced in SQL 2012. This might be a topic for a different post but for this post I wanted to concentrate on another method which is to use a configuration file to configure the installation.

    To perform an unattended installation using a configuration file it is simple you just need to write the following command line at a new command prompt.

    Setup.exe /ConfigurationFile=SQLConfigurationFile.ini

    Simple, right? But the question now is how can I generate this configuration file?

    Actually the answer is also very simple.

    1.      You simply start setup normally by double clicking on Setup.exe

    2.      Click on installation on the left.

    3.      Click on “New SQL server stand-alone installation or add features to an existing installation”

    4.      Go through the normal setup and choose all components you wish to be installed during the unattended installation.

    5.      On the “Ready to Install” screen you will find the path to the created configuration file as per the screen below
    clip_image002

    6.      Copy the created configuration file and then cancel this installation.

     

  • Use of SignalR for Real-Time Messaging on Windows RT Devices

    Introduction

    One of the challenges using Windows RTs is to send messages from a store application deployed on one Windows RT tablet (Surface RT in my case) to the other application on another Windows RT tablet. It is a challenge, mainly because it requires push (two-way communications, like WCF duplex channel) messaging and limitations on Windows RT platform (can’t be domain-joined, no queues, you can’t deploy any Win-32 type application, app container etc.).

    About SignalR

    SignalR, developed by an MS team, is an API (part of ASP.NET framework, starting from .NET 4.5+) that provides simplified real-time and bi-directional communication. So, the relevant keywords would be:

    • Real-time communication
    • Bidirectional (send/receive)
    • Enriched push services: It can broadcast the message to all, to one, or to all but one, etc.
    • Hubs/Persistent connection
    • Durable: It uses one of the following APIs (listed in order) for underline communication – that is available in the client:
      • web sockets,
      • server sent events,
      • forever frames,
      • long polling

    Link to SignalR Server API

    Link to SignalR Client API

    Link to SignalR Hub API

    Solution

    The solution detailed here demonstrates a case scenario in which tablet users communicate each other by sending messages from the store applications deployed in their Windows RT devices.

    Project structure

    • Device 1: A store application named “SignalR.ClientX” running on clientX tablet: It lets clientX to start a session with a group code and to send messages to all/one/group-by clients associated with the group name.
    • Device 2: A store application named “SignalR.ClientY” running on clientY tablet(s). It lets clientYs to join to an existing session (created by the client) by providing group code and to send messages to participants.
    • SignalR Server (Host):
      • A cloud service application named “SignalR.Cloud” hosted on the Windows Azure.
      • A web application named “Microsoft.AspNet.SignalR.Server.Web” deployed to cloud services. This is exactly same bits taken from SignalR site. Or get it from nuget package console in VS IDE by typing ‘Install-Package Microsoft.AspNet.SignalR.Sample’

    clip_image001[4]

    Figure#1: POC solution structure

    How it works

    clip_image003[4]

    Figure#2: POC solution message flow

    As you see, the solution combines Windows Azure cloud services representing SignalR server and 2 Windows store applications representing SignalR clients running on Surface RT devices. Unfortunately, I can’t cover all those things in the picture, so will focus on client API calls for now.

    Here are the simplified steps:

    • Create a hub connection

    _hubConnection = new HubConnection(_url);

    • Create a proxy from the connection with the name of the Hub (the name given in your server side code)

    _hubProxy = _hubConnection.CreateHubProxy(_hubName);

    • Start the connection (asynchronous Task)

    await _hubConnection.Start();

    • Execute a method on the server side hub (asynchronous Task).

    var joinGroupResponse =

    await _hubProxy.Invoke<string>("JoinGroup", _hubConnection.ConnectionId, groupName);

    How to run it

    • To run this project, you need to have a Windows Azure membership and a service bus (sb) namespace (not covered here, please visit here to start)
    • Update the connection string named ‘Microsoft.ServiceBus.ConnectionString’ in the web.config file with your sb credentials
    • Re-built the solution (check SignalR references, if not get the nuget packages )
    • Deploy cloud service to your Windows Azure
    • Deploy ClientX app to a Win RT tablet
    • Deploy ClientY app to another Win RT tablet
    • Run ClientX app, enter a session code then click ‘Start Session’ button
    • Run ClientY app, enter the code then click ‘Join To Session’ button

    From there, you can send messages from either app. All the messages passed/received along with their trace data are written to textbox (center panel).

    clip_image005[4]

    Figure#3: HubConnection (Client) class members

    clip_image007[4]

    Figure#4: Hub (Server) class members

    Conclusion

    Please note these:

    • Use of SignalR is not limited to this scenario (Windows store application), and in fact, it’s is quite large (desktop, web, phone, etc.). Please see the links provided below for further details.
    • The demonstrated solution is also applicable for offline session scenario. In this case, an on premise Windows Server Service Bus can be used for hosting SignalR server API.
    • Source code is shared for further help.
    • SignalR uses persistent and dedicated connections, so, you need to align your server connection capabilities with number of clients you provision.

    In conclusion, you must consider SignalR API when developing modern applications wherever you need to have push-based functionality. Big thanks goes to the SignalR team, well done in a short time!

    References

  • Fixed: BizTalk 2013 BAM Portal configuration problem

    The Problem

    When configuring BizTalk Server 2013 RTM on a multi-computer environment you might face multiple issues that are new and did not exist in previous versions of BizTalk server. One of these issues that I faced was when you try to configure the BAM portal after you have configured the BAM Alerts service. Of course you already know that the BAM alerts in BizTalk 2013 is using a new model of Database mail instead of SQL server 2005 notification services (finally) but it seems this caused some problems. In this scenario the configuration failed and when you open the log you see this error.

    Error encountered: Could not install BAM Portal, error with regard to “BAM Management Web Service User”

    Error thrown: “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”

    The Solution

    When I started looking at this error I started thinking that the BizTalk configuration application is corrupted so I restarted it, with no luck. I then restarted the entire machine with no luck. I then started to look into the log file more carefully and found that there is another error being reported before this one complaining about a problem with one database role called “NSSubscriberAdmin” in the BAM Alert Application database.

    I opened this database and I could not find this role defined in it. I started to search the internet for someone who faced this problem with BizTalk 2013 and I found one here. He is suggesting to just add the role “NSSubscriberAdmin” to the BAM Alert Application database. So I did this and it worked.

    BUT when I started thinking of what I did, I thought this is wrong since the configuration application did something using this role and this role is not used anywhere in the application so this must hunt me back sometime later. So I opened the SQL management studio and looked at this role and what the configuration application did to it. I found that it actually added the BAM Management Web Service user to this role! So this will be used by this service; what I found also is that there is another role in this database called “BTS_SubscriberAdmin” role (rings any bells ;) ) so I am thinking this is the true role that the configuration application should have used. So what I did is that I added the “BAM Management Web Service User” to this role “BTS_SubscriberAdmin”. I hope that this is enough to make the solution work with no problems. J

    Happy BizTalking ;)

  • Fixed: BizTalk 2013 BAM tools configuration problem

    The Problem

    When configuring BizTalk Server 2013 RTM on a multi-computer environment you might face multiple issues that are new and did not exist in previous versions of BizTalk server. One of these issues that I faced was when the BizTalk Server and the database server are two separate servers. I was trying to configure only BAM tools and without the configuration of the BAM alerts. Of course you already know that the BAM alerts in BizTalk 2013 is using a new model of Database mail instead of SQL server 2005 notification services (finally) but it seems this caused some problems. In this scenario the configuration failed and when you open the log you see this error.

    [Info] BAMTools Determining version of Microsoft SQL Server installed on server.

    [Error] BAMTools Error configuring

     Error determining version of Microsoft SQL Server installed on server. (Microsoft.BizTalk.Bam.CfgExtHelper.Utility)

     A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)

     The system cannot find the file specified ()

    The Solution

    This is a known and reported issue in BizTalk server 2013 and there are two workarounds for this issue:

    1-     Install SQL Server 2005 Notification services on the BizTalk server machine. (again L) I personally do not like this option as you are installing something you are not using.

    2-     Configure the SQL server 2012 database mail and configure both the BAM tools and BAM alerts at the same time. This is a good option if you are going to use BAM alerts but if you are not going to use it then you are configuring a feature that you will not be using.

    The official and recommended solution for this is to install the already available Hot Fix for this issue. This hot fix would be automatically installed on the BizTalk server if it has internet access, but like my case where the servers does not  have internet access I had to manually download and install it. Please find the download for this hot fix here.

    http://support.microsoft.com/kb/2838133

     

  • Part 4: Step-by-Step Exchange 2007 to 2013 Migration

    In part 1 we covered the deployments steps for Exchange 2013, in Part 2 of this series we covered Exchange 2013 configurations and testing, in part 3 started our migration process. In this final post we will walk through the final steps in migration, then remove our legacy server.

    8.Public Folder Migration

    This phase is very well documented online, accordingly we will walk through the steps with minimum explanations, to understand the whole processes check this Link.

    Before you begin Download all four of the Microsoft Exchange 2013 public folder migration scripts.

    Preparation (take a snapshot from current Public Folders)

    Open Exchange 2007 Management Shell and run the following commands:

    Get-PublicFolder -Recurse | Export-CliXML C:\PFMigration\Legacy_PFStructure.xml

    Capture1

    Get-PublicFolderStatistics | Export-CliXML C:\PFMigration\Legacy_PFStatistics.xml

    Capture2

    Get-PublicFolder -Recurse | Get-PublicFolderClientPermission | Select-Object Identity,User -ExpandProperty AccessRights | Export-CliXML C:\PFMigration\Legacy_PFPerms.xml

    Capture3

    Rename Folders with backslash

    If the name of a public folder contains a backslash \, the public folders will be created in the parent public folder when migration occurs. You have to rename any public folders that have a backslash in the name.

    To get Public folders with backslash, run the following command:

    Get-PublicFolderDatabase | ForEach {Get-PublicFolderStatistics -Server $_.Server | Where {$_.Name -like "*\*"}}

    Capture4.1

    Change the public folder name as shown below:

    Set-PublicFolder -Identity 000000001A447390AA6611CD9BC800AA002FC45A0300D13A87259D34A142BB480F3E89AA82BF00004FD5389E0000 -name "MCS TF2"

    Capture5

    Make sure there is no previous record of a successful migration

    Get-OrganizationConfig | Format-List PublicFoldersLockedforMigration, PublicFolderMigrationComplete

    Capture6

    Generate the CSV files

    On Exchange 2007 run the below script to create the folder name-to-folder size mapping file, the file will create the folders and its sizes

    .\Export-PublicFolderStatistics.ps1 PFStat.csv e12-01

    Capture7

    image

    Copy this file to Exchange 2013 and run the below script to create the second CSV, which will let you know how many mailboxes will be required for your folders based on the mailbox you will set as show below:

    .\PublicFolderToMailboxMapGenerator.ps1 1GB PFStat.csv FolderToMailbox.csv

    Capture8

    As I have a very small PF only one Mailbox is required as below:

    image

    Create the required mailbox/s as shown below:

    New-Mailbox -PublicFolder Mailbox1 –Database DB01 –HoldForMigration: $true

    Capture10

    Start the Migration Request

    New-PublicFolderMigrationRequest -SourceDatabase (Get-PublicFolderDatabase -Server e12-01.contoso.local) -CSVData (Get-Content FolderToMailbox.csv -Encoding Byte)

    Capture11

    Check the status

    Once the migration reached the AutoSuspended state as shown below, proceed to the next steps, otherwise you must wait as this may take some time based on your PF size.

    Get-PublicFolderMigrationRequest | Get-PublicFolderMigrationRequestStatistics

    Capture12

    Lock Down PF for Migration (Down time is required, as during this phase PF will bot be accessible for all users)

    Set-OrganizationConfig -PublicFoldersLockedForMigration:$true

    Capture13.1

    Set-PublicFolderMigrationRequest -Identity \PublicFolderMigration -PreventCompletion:$false
    Capture14

    Resume-PublicFolderMigrationRequest -Identity \PublicFolderMigration

    Capture15

    Test and Unlock the PF Migration

    I will configure a test user to use the new PF using the following command:

    Set-Mailbox -Identity mohsaeed -DefaultPublicFolderMailbox mailbox1

    Capture16

    Open the test user mailbox and run some tests: Create new post, view old posts, check permissions

    If all tests passed successful proceed to next step.

    Get-Mailbox -PublicFolder | Set-Mailbox -PublicFolder -IsExcludedFromServingHierarchy $false
    Capture17

    Set-OrganizationConfig -PublicFolderMigrationComplete:$true

    Capture18

     

    Decommissioning Exchange 2007

    Remove Mailbox Databases, open Exchange 2007 management shell, and run the following command:

    Get-MailboxDatabase | Remove-MailboxDatabase

    Capture

    Remove your PF Databse using guidelines in this link.

    Open cmd, navigate to bin directory and run the below command:

    Setup.com /mode:uninstall

    Capture4

    Regards,

    Mohammad