Sunday, August 28, 2011

HP Touchpad freezes during an over the air update (v3.02)

I pushed the update button on my HP touchpad and after a few minutes I got this screen:

webosdoctor_alertscreen

Upon visiting www.palm.com/ROM you find that the TouchPad has frozen and you need to get WebOSDoctor to fix the TouchPad.

The first thing you need to do is to log into your WebOs account: https://ps.palmws.com/palmcsext/console/pages/LoginPage.iface

Once you login, you will find a button called “Device Options”. Choose the “Get WebOS Doctor” option.

You will have to confirm that you have the correct version of Java (1.5 or above at the time of writing this post).

The download will have an extension of jnlp. Once the file has downloaded, double click on it. This will start the download… image

Once WebOs doctor starts up, click through all the screens:

image

At some point you will arrive at a “charging device screen”. If your device does not have at least 25% charge, it will begin charging the device. Once at the 25% charge point, the update will start.

image

Once the update starts, the screen on the TouchPad should change from the exclamation to the HP logo. Sit back and wait. If everything goes well, your TouchPad should come back on.

But in my case, everything didn’t go well and I could not get my TouchPad to boot up (it just got stuck at the HP logo).

Here are the different things you can try: (what worked for me, is what you should try as the last resort and hence appears at the end)

  1. Restart the TouchPad: You do this by holding the top power button (1) and the center button down (2) for approximately 10 seconds.
    image
    Now reconnect the TouchPad to your computer and re-run webOs Doctor.
  2. If that doesn’t work, next try and get your TouchPad into a special mode (don’t know what its called – but you will see a USB symbol on the screen).
    To do this, you need to restart the touchpad just as you did in step 1. But this time once the TouchPad powers down, hold down the Volume Up button and don’t let go until the TouchPad restarts. Once it has restarted, you should see the USB symbol on your screen.
    Reconnect the TouchPad to your computer and re-run webOS Doctor.
  3. If that too doesn’t work, then try and force the TouchPad back to the previous version of WebOS (3.0). Do that by following the steps below:

The following assumes you are running a Windows machine. If not, some of the steps (the batch file, the commands to run the jar files, etc may be different).

You can use the following steps to force your TouchPad to v3.02. I did mine and it worked! (but remember YOU ARE DOING ALL OF THE BELOW AT YOUR OWN RISK).

  1. Follow steps 2 above. This is important, otherwise, WebOS doctor will not recognize your TouchPad.
  2. Download the v3.0 file from HP’s site: (v3.0, because I am assuming the v3.02 over the air update hosed up your TouchPad and you need to try and unbrick it) http://palm.cdnetworks.net/rom/touchpad/wd300wifi/webosdoctorp300hstnhwifi.jar
    note: if you would like – you can first try using the 3.2 webOS file, but that didn’t work for me (http://palm.cdnetworks.net/rom/touchpad/p302r0d08012011/wifip302rod/webosdoctorp302hstnhwifi.jar).
  3. This next step is not needed if you have already have the NovaCom drivers installed on your machine. If you don’t, then most likely in step 8 below, WebOS wont detect your machine.
    - Download Novacom Universal Installer from: http://code.google.com/p/universal-novacom-installer/downloads/detail?name=UniversalNovacomInstaller.jar&can=2&q=
    - Double click the file “UniversalNovacomInstaller.jar”
    - Click the Install button and in the next window, select the “file” button and point it at the file you downloaded in step 2. After a few seconds you will get a security prompt (on Windows) and after clicking yes, the drivers to connect to your TouchPad should get installed successfully.
  4. There is a simple way to do steps 4,5,6, and that is to use a batch file. If you are comfortable with batch files, then go directly to step 7. Open a command prompt (in Windows, go to run, type “Cmd” and hit enter).
  5. Change your current directory to the Java folder (typically: c:\Program Files (x86)\Java\Jre6).
  6. Next run the following command:
    java.exe –jar “c:\pathToTheWebosdoctorp300hstnhwifi.jar_fileThatYouDownloaded”
  7. Or instead of steps 4,5,6, just copy the following lines into a BAT file and run the bat file.

    c:
    cd\
    REM the following path maybe different on your computer. Adjust accordingly. It’s the path to java.exe
    cd "Program Files (x86)\Java\jre6"
    REM If you are using the 302 file – then change the 300 below to 302.
    REM I downloaded the jar file from step to c:\temp. If you used a different folder, adjust accordingly.
    java.exe -jar c:\Temp\webosdoctorp300hstnhwifi.jar
    pause
  8. The above will start up WebOs doctor and in addition it will show you progress information in the command window. This can be useful to monitor what is happening with the WebOS doctor’s progress. It definitely helps to calm the nerves when the progress bar is stuck and you have no idea whether the TouchPad is bricked or doing work.
  9. Reconnect your TouchPad, and click through the WebOS doctor’s windows and hopefully it starts the installation process and manages to get past the 4%, 8%, 12% progress points (those were the points at which I had my most problems).
  10. Once it completes, you will get a Done message. Unplug your Touchpad from the computer. After that point your TouchPad will restart. Be patient. My machine stayed in the HP logo screen for almost 5 minutes (thought it was bricked again). But at some point, the logo began magically pulsating. After that in about another 5 minutes, the TouchPad started up and I was taken to the setup screen!.
  11. Done, done and done!

Yeehaw! my TouchPad is back!

Useful links:

1. 5Ts to fixing your TouchPad (HP): http://kb.hpwebos.com/wps/portal/kb2/na/touchpad/touchpad/wifi/solutions/article/17222_en.html

2. NovaCom installer: http://code.google.com/p/universal-novacom-installer/

3. WebOS Faqs (HP): http://www.hpwebos.com/us/support/downloads/pre/recoverytool/webosdoctor_faq_carrier_en.html4.

4. How to recover: http://www.webos-internals.org/wiki/How_to_recover

5. TouchPad forums: http://forums.precentral.net/hp-touchpad/index51.html

Wednesday, August 24, 2011

SlowCheetah! finally transformations come to app.config files

Visual Studio has had since VS2010 (or maybe it was VS2008) a way to setup multiple configuration files for different types of build configurations. But unfortunately, this ability was provided on to web projects (web.config files) and was not available for app.config files.

SlowCheetah changes that. SlowCheetah, allows you to setup multiple config files for the different configurations that you have for your app.config files. Sweet!

Right click on your App.config file and you get the “Add Transform” option.

image

Selecting Add Transform adds multiple config files (one for each build configuration)

image

The transformation syntax is exactly the same as the one used for Web Application Project Deployment. For more info read: http://msdn.microsoft.com/en-us/library/dd465326(VS.100).aspx

Here is an example:

Original App.config
image
App.Debug.Config
image
Leads to this (when you hit F5)  
image

One of the coolest features is the fact that you can preview the transformation without having to run a build:

image (very, very cool).

Now, what I need to figure out is how to get the transformations to occur during a TFS build.

Enabling a Windows Feature via a script

image

Here is a quick way:

dism.exe /online /Enable-Feature:MSMQ-HTTP /PackageName:Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~6.1.7601.17514

The above example enables MSMQ-HTTP support. (you can exclude the PackageName in this case, as the default package is “Microsoft-Windows-Foundation-Package”)

To list all features installed, run:

dism.exe /online /Get-Features

For more help regarding dism run:

dism.exe /online /Enable-Feature /? or

dism.exe /online /?

Friday, August 19, 2011

Using Powershell Community Extensions (Pscx) to create an MSMQ queue

First get PSCX from: http://pscx.codeplex.com/

Unzip PSCX to “C:\Windows\System32\WindowsPowerShell\v1.0\Modules” (you could also install it only to your profile, not going into that here)

Install the module by running the following command: install-module pscx (needs to be run each and every powershell session).

Create the queue using the command: new-msmqueue -name rajstest -force -private -machineName mymachinename

Tuesday, August 16, 2011

Time oriented databases

Came across this old PDF but it has lots of ideas regarding creating databases that are time-oriented:

Developing Time-Oriented Database Applications in SQL: http://www.cs.arizona.edu/~rts/tdbbook.pdf

More info:

http://www.simple-talk.com/sql/t-sql-programming/temporal-data-techniques-in-sql-/

Dear Oracle–here is a free lesson in usability

If you are going to send me password to replace the one I forgot, please do not include extra characters and confuse me.

So the question is: When I try and log-in to my account using the temporary password, do I, or don’t I have to include the square braces around the alphanumeric characters (for those who don’t know, the answer is: you ignore the square braces and use only the characters between them).

image

TFS–Rolling back a change

The rollback feature is not available via the GUI. At one point (prior to TFS 2010), the rollback functionality used to exist in TFS power tools, but its now in the tf.exe utility.

To use it, open up a Visual Studio command prompt.

Navigate to the folder which maps the TFS folder to your system (the workspace).

Run the following command: (TFS 2010)

tf rollback /changeset:xxxxxx

or

tf rollback /changeset:from~to

Saturday, August 13, 2011

Summary: How Microsoft manages development projects using TFS

Came across this slightly old series of posts by the developer division at Microsoft that shows how they used TFS to manage their software development (specifically of Orcas).
  1. Our process
  2. Feature Crews
  3. Planning a release
  4. Tracking Progress
  5. Tracking multiple projects
    1. Addendum
  6. Tracking Risk
  7. Tracking quality gates
  8. Transparency in reporting
Some of the interesting things that I found from the posts:
image_2
The process involved the planning stages (scenario, value proposition, experience) and the implementation stage (features). The experiences most directly relate to epics. The goal was to break down epics (experiences) into features that could be easily implemented within an iteration (or two). One of the interesting things to note is that how a handful of scenarios can break-down into 1000s of scenarios. (for every epic (experience) there were approximately 4 features).
image_6
Each feature is implemented by a “feature crew”
Development occurs of a branch pulled from the trunk for each feature (Chapter 2)
image_7)
Chapter 2 is extremely interesting as it goes into the lifecycle described by the above diagram.
  1. Branch code.
  2. Checkpoint 1: demo design and get feedback
  3. Checkpoint 2: demo completed functionality
  4. Merge code from main into the branch
  5. Quality gates: before check-in to main branch can be done, a set of quality gates need to be satisfied
  6. Code is checked in. Because of the quality gates, the quality of the main branch is kept high
Another interesting thing about this chapter is that one of the quality gates was a code-coverage percentage of 70% through automated testing.
Some of the interesting quality gate categories used were:
image_8
Chapter 4 discusses how features were assigned “ball-park” estimates. Estimates for all features were aggregated into a single excel work-book which was then used to determine the order in which features were to be implemented.
In chapter 5, the post discusses about how TFS allowed the different feature teams to use whatever development model that suited them (Agile, Waterfall, etc). Communication of the state of the feature implementation was done via a single tab in TFS that needed to be updated once per week. The tab itself is minimal in the amount of information it collects. (looks like the dev-div used a custom template and the post describes the Progress tab in detail). There were 4 dates that were key during a feature implementation. All dates did not have to be committed to at the beginning of the feature implementation project. Instead the process followed was:
At the start of the feature crew, the team needed to commit to a checkpoint 1 date, and estimate the checkpoint 2 and finish dates. At checkpoint 1, the team would commit to a checkpoint 2 date, and estimate the finish date. At checkpoint 2, they would commit to a finish date.
Another interesting item tracked was the risk. This was tracked via 3 codes: green, yellow and red
Green = We will meet the dates
Yellow = We are at risk
Red = We will miss the dates
Tracking of multiple projects (chapter 6) was done via reports generated of off TFS. This report was used in a weekly meeting of feature team managers, the program manager and product manager. The report presented all features that were currently in flight. This was done using a red, yellow, green report that showed:
  • Green - The percentage of work completed, when compared to the entire project
  • Yellow - The percentage of work completed in the last reporting period, typically 1 week.
  • Red - The number of hours of work remaining.
  • You'll also note that the date the feature crew is scheduled to complete is included with the name of the feature crew.
image_9
An interesting thing to note in this post is the culture shift that occurred by the transparency that occurred with data that was available up and down the chain regarding project status:
In this culture of openness, management had to let go of "holding people to their original dates, no matter what" and those on the feature crew had to let go of "presenting the project status in the best possible light" or "hiding bad news".
Chapter 7 discusses the risk information that is entered into the Progress tab that was discussed earlier in chapter 5. The risk information is pulled into an excel report and all those teams that are not green need to explain why the progress tab as well as in a weekly meeting as to why the team maybe slipping. Again an interesting part about this post is that the division was making the mind shift to transparency, where it was better to let the team know early than latter that you were going to be late. The team itself realized that sometimes slips occurred because of issues that were out of the control of the team.
image_8
Quality gate tracking is discussed in Chapter 8. The tracking itself is done via the Quality Gates tab in TFS.
image_2 (1)
The final chapter (Chapter 9) shows the reports that was used by the top management to keep track of the progress that was being made across scenarios, value proposition, experiences and features. (basically a drill-down report).
image_2 (2)
The entire series is an extremely good read and I strongly suggest that you read them (as what I have done here is to only summarize the series, mainly so that I would have them all in one location). Thanks to Greg Boer for doing an excellent job of documenting how TFS was being used within the dev-division at Microsoft.
More info:
Ever Wonder How We Build Software at Microsoft? Now You Can Read All About It!

Tasks that go into stabilizing a software product

Found this interesting page that describes all the stages that can be part of the stabilization phase of a software product: Chapter 10: Stabilizing Phase (Technet). Although the page is part of “UNIX Custom Application Migration Guide“, the information contained in the page is very pertinent to any software product that needs to be stabilized prior to being delivered.

Friday, August 12, 2011

Enterprise Library–Routing of logged messages

A quick diagram I drew up to help me remember how Enterprise Library’s logging configuration file routes messages using filters, categories and severity.

image

The priority filters and logging enabled filters are set within the LogFilters node and are the first level of filtering applied to log-messages.

image

The category assigned to a message is then used to determine which listeners/sinks are written to via the categorySources node. At the category level, the switchValue is used to log on those messages with a Severity level set to that level and above. (All logs all severity messages).

image

Tuesday, August 09, 2011

Finding your friends on Spotify using their usernames

Kind of ridiculous that this is not part of the UI, but you have to use a special syntax to perform the search:

type spotify:user:username in the search box

Username HAS to be in lower-case.

Sunday, August 07, 2011

Confucius on failing

Our greatest glory is not in never falling, but in rising every time we fall ~ Confuciusimage

Saturday, August 06, 2011

Create a Facebook app using Google Sites

Here is a really simple way to create a Facebook application using Google Sites.

Note: If you have your own web-page, you can use it instead of Google Sites. I am using Google Sites to host the page that will be shown as a Facebook app.

What you need:

  1. Google Sites subscription: http://sites.google.com/
  2. Facebook Developer app subscription: https://developers.facebook.com/apps
    1. You need to verify your account before you can create your Facebook app.

Steps:

  1. Create a Google site using the blank template:
    1. Click the “Create New Site” button
      image
    2. Choose the blank template and leave all other options at their default values.
      Click create site.
      image
    3. Once the site has been created, you need to set the width of the page:
      Go to the Manage Site option (under More Actions).
      image
    4. Select “Site Layout”
      Click the “Change site layout” button
      Change the site width to 700px (this is what I found was the optimum width for the site without any side-bars)
      Uncheck the “Sidebar” checkbox
      image
      Click Ok
      Click the Save Changes button.
    5. Click on the “Return to site” link (top left)
    6. Your home page should now display with the selected width. Add some content to this page.
      image
      Take note of the page url. This is the URL you will use as the canvas url when you setup the facebook app later. The url is typically of the format: https://sites.google.com/site/SITE-NAME/ (where SITE-NAME is the name choosen in step 2).
    7. Create a privacy information page (its required when you setup your Facebook App).
      Click the “Create Page” button
      image
    8. Name the page Privacy (or PrivacyInformation or something similar)
      Select the default options and click the Create Page button.
      image
    9. Add some basic privacy information on this page. (eg: No privacy information available).
    10. That’s it. You are done with the Google Sites portion.
  2. Create the Facebook app:
    1. Go to the Facebook Developer app: https://developers.facebook.com/apps
    2. Put in a name for your app
      image
    3. After a few seconds you will be taken to the Basic Info page.
    4. Fill in the basic info section (setting the category).
      image
      Fill in the contact info: (only email and privacy url’s are required. the Privacy URL is the url to the page created in step (1).(8) above.
      image
    5. Click the Save Changes button.
    6. Select the “On Facebook” link on the left and then the “Canvas Settings” button.
      image
    7. You need to enter the Canvas and Tab urls.
      image
      The Canvas and Tab url is the url to the Google sites home page you created in step (1).(6).
      For the Secure Canvas and Secure Tab url, just change the http to https (eg: http://sites.google.com/site/fbtestraj/ to https://sites.google.com/site/fbtestraj/)
      Also enter a name for the tab.
      Click on Save Changes.
    8. Next click on the “View App Profile Page” in the side bar.
    9. Add relevant information to your App’s Profile page.
    10. Finally, click on the “Go to App” button and the app will be added to your profile.

Here is what my test Facebook test app looks like (its called: Raj’s Test App: https://www.facebook.com/apps/application.php?id=211134738936140)
image

If you are a developer, then you can further customize this page using scripts (and if you are using your own website to host the page, then other web-application frameworks such as .Net). This done through the authorization mechanism.

Reference:
https://developers.facebook.com/docs/guides/canvas/

Friday, August 05, 2011

Miracle Man

Another quote I recently heard from a co-worker:

You rush a miracle man, you get rotten miracles
- Miracle Max from the movie: The Princess Bride

Occam’s Razor

In a previous post I wrote about a new quote I heard called “Hanlon’s Razor”.

Here is another one that I have liked for many years and actually used in a lot of my work (algorithm development), and its called Occam’s razor and which can be summarized as “the simplest explanation is most likely the correct one.”

Occam’s Razor: lex parsimoniae

translating to law of parsimony, law of economy or law of succinctness, is a principle that generally recommends, when faced with competing hypotheses that are equal in other respects, selecting the one that makes the fewest new assumptions.

Hanlon’s Razor

Never attribute to malice that which is adequately explained by stupidity. – Hanlon’s Razor

And a similar quote by Sir Bernard Ingham: “cock-up before conspiracy” (where cock-up refers to mistakes or foul-ups).

Thursday, August 04, 2011

Task estimation on Agile Projects

imageTypically I have used the planning poker estimation sequence when performing task estimation (1,2,3,5,8,13). Here the numbers represent hours instead of story-points as they normally do during User-Story estimation. We used a cut-off of 13, the number of hours above which we think the task should be broken down. The basic idea behind it was that using the planning poker sequence for the number of hours a task would take, provided a buffer to the estimates.

Recently we had a discussion at work on whether tasks should be estimated in just plain hours as estimated by the developers, or whether we should use the planning poker sequence to drive the number of hours estimate.

imageThe first thing to realize: its important to use different units for your user-story estimates vs. task estimates. This is accomplished by using story-points for user-stories and hours for estimates. This is useful because story-points are an abstract entity, making it easier to realize that the story-points are trying to capture not just effort, but also complexity and risk. In addition, it makes you also realize that story-points (as opposed to another unit like ideal hours) cannot be directly converted to number of hours that the user-story will take (although one can estimate this after a few sprints have passed and we have a team sprint velocity metric).

Back to the topic on hand: Based on research I have done, I am now a convert to using just plain hours for the task estimates (instead of using the planning poker sequence). Here is why:

  • User stories are large, complex and have a lot of uncertainty and risk. They are harder to estimate. Hence we use the planning poker sequence to reiterate the fact that there is probably going to be a magnitude of difference in the amount of work/time it will take to complete the user-story.
  • Tasks are how user-stories are broken down when it comes time to implement a user-story. An important point to remember is that a 3 hour task and an 5 hour task are not different by an order of magnitude, which is what the story-points reflect. Instead, the 2 tasks are different by 2 hours and that’s all there is to it. In addition, it is perfectly alright to have a task that would take 4 hours.  By sprint planning stage, the risk and complexity associated with a user-story should be known. In addition, tasks are typically items that the developers know about and can estimate well. Finally, the number of tasks that need to be estimated are normally small because they are done for the current sprint (where the sprints typically last from 1 to 4 weeks – smaller the better). Because of the shorter time horizon on tasks, one shouldn’t have to pad the estimates for tasks. Hence, one shouldn’t have to use the planning poker sequence, and should just use the actual time estimate for that task.

Remember, based on the cone of uncertainty: Story points are useful for long-term estimation. Hours are better for short-term estimation.

Some other notes:

Task estimation should still be done by involving all the team-members. The user-story should be broken down into tasks and estimates should be presented by all team-members at the same time (just as one would do during a planning poker session). Any differences in estimates should be discussed and a consensus estimate in number of hours for the task should be arrived at. (This in my mind is a modified wide-band delphi estimation technique).

Normally, I have done sprint-planning in two separate sessions:

session 1: break down the user-story into tasks

session 2: generate estimates for the tasks.

Its important to also realize that an estimate is not the same as a commitment to deliver (i.e., an estimate of 8 hours for a task is not the same as committing to deliver the work in 8 hours). Hence the commitment session should be separated from the estimation session. The team commits to what it believes it can deliver within a sprint, given the estimates of all the tasks, other work that the team needs to do and other factors.

Its interesting to note that in the 2011 Scrum Update, the following is said (further validating the fact that estimates are not commitments):

Development Teams do not commit to completing the work planned during a Sprint Planning Meeting. The Development Team creates a forecast of work it believes will be done, but that forecast will change as more becomes known throughout the Sprint.

Comments by Geoffrey Corey (Agile mentor):

User stories are still abstract things and should be story pointed. Planning poker and relative estimating with a benchmark story are two ways to do that. The purpose for the story points is to prioritize and identify high risk or nebulous stories that either are broken down or are candidates for a spike solution. Once the stories are sized and prioritized then a time box (sprint) can be set and based on sprint velocity user stories can be added. At that point it is useful to break down just those stories in the sprint into tasks.  

I totally agree that tasks should be done in hours, not story points. You can then add up the task hours and build a chart showing Story | Story Point | Total # of task hours.   This will show you if your story point estimates are in line with task estimates.   For example,  you many have around 20 hours of tasks to do for a 5 point story.   If you are within +/- 4 it appears you were consistent in story point estimates for all the 5 point stories.   If you have on 5 pt story that is 60 hours of tasks, then you might want to pop the flare early before the sprint and inspect what went wrong and if you should repackage the sprint.

Velocity is still done by story points.    Task estimation is just a validation of the planning poker estimate.

User story to task validation chart:

 

Story

Story Point

Total # of task hours

1

as a user I would like to pay using a credit card

5

25

2

as a user I would like to pay using a debit card

5

23

3

as a user I would like to register my account

3

15

4

as user I would like to login using Facebook Connect

3

25

5

as user I would like to reset my password

5

15

* the 3rd story probably has a bad story point estimate. the same is probably true for story 5.

References:

  1. Task estimation: Do or don’t? http://www.agilejournal.com/articles/columns/column-articles/1232-task-estimation-do-or-dont
  2. Are you using planning poker for estimating tasks? Maybe you should reconsider it… http://geeks.ms/blogs/jlsoria/archive/2011/05/19/are-you-using-planning-poker-for-estimating-tasks-maybe-you-should-reconsider-it.aspx
  3. Sprint and release planning should be in different units: http://blog.mountaingoatsoftware.com/sprint-and-release-planning-should-be-in-different-units
  4. Why I don’t use Story Points for Sprint Planning: http://blog.mountaingoatsoftware.com/why-i-dont-use-story-points-for-sprint-planning
  5. Separate estimating from committing: http://blog.mountaingoatsoftware.com/separate-estimating-from-committing 
  6. Agile estimation and the cone of uncertainty: http://agile101.net/2009/08/18/agile-estimation-and-the-cone-of-uncertainty/
  7. How to implement Scrum in 10 easy steps: http://www.allaboutagile.com/how-to-implement-scrum-in-10-easy-steps/
  8. Wideband Delphi: http://en.wikipedia.org/wiki/Wideband_delphi

Monday, August 01, 2011

Powershell: Test for variable existence

If variable name is helloWorld (referenced as $helloWorld):

test-path variable:\helloWorld

return true if the variable has been defined and false if variable has not been defined.

PowerShell 64 bit and Sql Cmdlets

I was getting the following error when I tried to execute a script that tried to load the Sql Powershel cmdlets.

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
This error occurred only 64 bit machines and only when I ran the 64 bit version of Powershell.
To get around it – I had to go through the following 2 steps:

Step 1: update the registry to insert an entry in the Wow6432Node hive.
After installing Sql Management Studio on the machine where you are seeing this error, run the following script to setup the registry correctly.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps]
"Path"="C:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\SQLPS.exe"
"ExecutionPolicy"="RemoteSigned"

Step 2: Install and add the powershell cmdlets.

Next run the following Powershell script to install the Sql powershell cmdlets.

#
# Add the SQL Server Provider.
#
if ($SqlServerMaximumChildItems -ne $Null -and $SqlServerMaximumChildItems -ge 0)
{
    write-host '$SqlServerMaximumChildItems is defined - sql provider is already loaded. Exiting load routines....'
    exit
}
else
{
    write-host '$SqlServerMaximumChildItems is not defined - continuing to check if sql provider needs to be loaded'
}
$ErrorActionPreference = "Stop"
$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps"
if (Get-ChildItem $sqlpsreg -ErrorAction "SilentlyContinue")
{
    throw "SQL Server Provider for Windows PowerShell is not installed."
}
else
{
    $item = Get-ItemProperty $sqlpsreg
    $sqlpsPath = [System.IO.Path]::GetDirectoryName($item.Path)
}

#
# Set mandatory variables for the SQL Server provider
#
Set-Variable -scope Global -name SqlServerMaximumChildItems -Value 0
Set-Variable -scope Global -name SqlServerConnectionTimeout -Value 30
Set-Variable -scope Global -name SqlServerIncludeSystemObjects -Value $false
Set-Variable -scope Global -name SqlServerMaximumTabCompletion -Value 1000

Push-Location
cd $sqlpsPath
$framework=$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())
Set-Alias installutil "$($framework)installutil.exe"
#following needs to be done only once on any machine – the script must be run
#in a Powershell window that has been spawned with admin priviledges

installutil Microsoft.SqlServer.Management.PSSnapins.dll
installutil Microsoft.SqlServer.Management.PSProvider.dll

# Load SqlServerProviderSnapin100
if (!(Get-PSSnapin | ?{$_.name -eq 'SqlServerProviderSnapin100'}))
{
    if(Get-PSSnapin -registered | ?{$_.name -eq 'SqlServerProviderSnapin100'})
    {
       Add-PSSnapin SqlServerProviderSnapin100
       write-host "Loading SqlServerProviderSnapin100 in session"
    }
    else
    {
       write-host "SqlServerProviderSnapin100 is not registered with the system." -Backgroundcolor Red –Foregroundcolor White
       break
    }
}
else
{
  write-host "SqlServerProviderSnapin100 is already loaded"

# Load SqlServerCmdletSnapin100
if (!(Get-PSSnapin | ?{$_.name -eq 'SqlServerCmdletSnapin100'}))
{
    if(Get-PSSnapin -registered | ?{$_.name -eq 'SqlServerCmdletSnapin100'})
    {
       Add-PSSnapin SqlServerCmdletSnapin100
       write-host "Loading SqlServerCmdletSnapin100 in session"
    }
    else
    {
       write-host "SqlServerCmdletSnapin100 is not registered with the system."
       break
    }
}
else
{
  write-host "SqlServerCmdletSnapin100 is already loaded"
}

Pop-Location
write-host 'initializeSqlServerProvider.Ps1 has completed'