PowerShell “fun” with text to speech

Writing code can be rather far from glamorous if not downright boring sometimes. PowerShell has its appeal but it is at the end of the day still an administrative framework for task and configuration automation.  Even saying that can hurt… If you’re looking to spice it up a bit the following may help.

function prompt { $text = ‘You are great!’, ‘Hero!’, ‘What a checker you are.’, ‘Champ, well done!’, ‘Man, you are good!’, ‘Guru stuff I would say.’, ‘You are magic!’    ‘PS> ‘    $host.UI.RawUI.WindowTitle = Get-Location    (New-Object -ComObject Sapi.SpVoice).Speak(($text | Get-Random)) }

prompt

 

Exceptions when installing SharePoint 2010 on Windows 7

If you’re a SharePoint developer you probably sway between using VMs and real hardware. Installing SharePoint 2010 on Windows 7 is actually a pretty easy thing to do so long as you follow the steps methodically. That said it is not always perfect and there are two commonly found bumps when installing on a clean machine. Fortunately their fixes are as easy as one could hope for.

When you run the configuration wizrd you may get the following exceptions. Their resolution is pretty simple.

If you get:

An exception of type System.IO.FileNotFoundException was thrown.  Additional exception information: Could not load file or assembly ‘Microsoft.IdentityModel, Version 3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′ or one of its dependencies.  The system cannot find the file specified.

Download and install the Windows Identity Foundation Pack from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=eb9c345f-e830-40b8-a5fe-ae7a864c4d76&displaylang=en

If you get:

An exception oftype Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown. Additional exception information: Failed to call GetTypes on assembly Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Could not load file or assembly ‘System.Web.DataVisualition, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find thefile specified.


Download and install Chart Controls from here: http://www.microsoft.com/downloads/details.aspx?FamilyId=130F7986-BF49-4FE5-9CA8-910AE6EA442C&displaylang=en

You can get more details here: http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx

Exceptions when installing SharePoint 2010 on Windows 7

Troubleshooting problems encountered with the SharePoint 2010 Configuration Wizard

For something with so few options the SharePoint 2010 Configuration Wizard should just work. Sadly it does not always do what it is supposed to do. When it does not your options are pretty much limited to common sense, event logs, and the Configuration Wizards logs themselves which found in the LOGS folder in C:Program FilesCommon FilesMicrosoft Shared Web Server Extensions14

They’re not perfect but they normally are sufficent enough to get started down the right path if you have a really obscure issue.

For example, lets say that you are having some kind of connectivity issues at the specify configuration server and database screen after opting to create a new farm. Inside this file you can find the parameters being set such as the user in the standard DOMAINUN format and their password as a series of ***** followed by mention of the functions as they are being stepped through by the installer. Very helpful if you are trying to figure out where the break is occurring!

A point to take away is that knowing the local time that you are running through the steps can be very helpful.

Moving large numbers of records with SqlBulkCopy

Sometimes you have to move large amounts of data in, out, or around SQL. There are plenty of ways to do that but few are as fast as using SqlBulkCopy. It is not fast. It is blazingly fast. As with anything else it has its place and limitations but it is well worth understanding at the least.
It is pretty easy to work with as the below example shows…
static void CopyData(DataTable sourceTable, SqlConnection destConnection)
{
// new method: SQLBulkCopy:
using (SqlBulkCopy s = new SqlBulkCopy(destConnection))
{
s.DestinationTableName = “SalesCopy”;
s.NotifyAfter = 10000;
s.SqlRowsCopied += new SqlRowsCopiedEventHandler(s_SqlRowsCopied);
s.WriteToServer(sourceTable);
s.Close();
}
}

When used properly it can make seemingly large data volume transactions trivial.