3 Things To Do If Invoke-SqlCmd Is Not Recognized in Windows PowerShell

I had a client request a data export from their web application to be FTP’d to a server of theirs on a daily basis. So, I quickly set about writing a sqlcmd script to pull out the data that I needed and save it to a file. It wasn’t long before I wanted the deliciousness that Windows PowerShell provides, and a quick search showed me ‘Invoke-Sqlcmd‘. When I tried to run it, I got this error:

The term 'invoke-sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program.

The term 'invoke-sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program.The source script that I was using to guide me assumed that invoke client was available when it wasn’t. After a lot of reading and trial and error, I was finally able to get it to run on my machine, and then also on the server.

Since all of the steps I required weren’t listed in one place, I thought I’d list them here in case it helps anyone:

  1. Install SQL Server 2008 R2 Management Objects using Web PI (I’m not sure about versions prior to 2008 R2… if you have more info, please let us know in the comments)
  2. Install ‘Windows PowerShell Extensions for SQL Server’ from the Microsoft® SQL Server® 2008 R2 Feature Pack page (it’s about halfway down the page).
  3. Run these two commands before calling invoke-sqlcmd in your script:
    Add-PSSnapin SqlServerCmdletSnapin100
    Add-PSSnapin SqlServerProviderSnapin100

Hopefully this helps someone!


Cufon not Working in IE

A buddy was having trouble with Cufon not working in Internet Explorer (and, as usual, it was working in other browsers). His site was in Drupal, and we couldn’t find any problems. It was also weird that IE didn’t have the little error indicator in the bottom corner. The only thing that made me uncomfortable


More Features in Pluralizer

If you haven’t read the introduction to Pluralizer, I’d suggest checking it out first. Here are a few more things that Pluralizer can do, if you find the need arises. Format Numbers Whenever you’re writing the number itself (i.e. using the {_} placeholder), you can format it like you would if you were using String.Format.


Introduction to Pluralizer for .NET

Let’s say you want to output a sentence that varies slightly, depending on the number of users that are in your system. For example, you want it to say one of these variations (a common predicament in my experience): There is 1 registered person. There are 398 registered people. To achieve this, you typically have


Manage OpenID Access to Your Google Account

I am a huge fan of federated authentication technologies such as OpenID and OAuth. I’ve finally started diving into the DotNetOpenAuth library (more on this in the future, I’m sure). So I downloaded the MVC Relying Party sample project, F5′d it, authenticated using my Google account, and all was peachy. By the way, anyone with any


Recover From the iPhone Recovery Mode

I finally agreed to apply the iOS 4.0.2 update that iTunes was nagging me about. I’m a very security-conscious person, but I wasn’t in a hurry to patch the PDF vulnerability because it was easily avoided (indeed, I avoid using the browser at all these days because it’s abhorrently slow), and there are many reports


Web Application Tools and Resources

wanted to summarize a list of useful web applications used in the development of web applications, used throughout the entire software development life cycle. This is mostly a spot for me to record the gems (or at least the apps-that-have-possibilities).


GrandMaster Roc Raida

I was listening to the latest episode of IndieFeed Hip Hop on the way into work this morning, and in it Roc Doogie was giving shouts to the greats who have died, J-Dilla, Jam-Master Jay, etc., and then he mentioned one that caught me off guard, Roc Raida. I forgot about that. He died last


Response to Dan Zambonini re:Stack Overflow

This is in response to Dan Zambonini’s article on the design of the excellent programming Q&A site, Stack Overflow. In it, Dan suggests some improvements that could be made to the user experience. By the time I typed out my thoughts, he had closed the comments. So, I thought I’d stick ‘em up here.


Beware eMusic Spam

How I busted eMusic.com and their email address racket.