PowerShell Basics

PowerShell
I'm just learning how to use PowerShell. I've been trying to spend time with it over the last year, ever since I saw Allen White's presentations at the PASS Summit last year. I just haven't had the time. But recently, my company has been performing a multi-phased data center move. Because of it, I've needed to run tests & updates, disable jobs, all kinds of things on different sets of servers on different days. To paraphrase the old Superman cartoons "This looks like a job <voice gets deeper> for PowerShell." I'm not even remotely qualified to begin teaching anyone PowerShell. I had problems recently getting an IF conditional statement to work correctly. However, in the interest of sharing, in case you're thinking about picking it up (do) or you're actively…
Read More

SQL Server 2008 PowerShell Mini-Shell

PowerShell
I went right back to working on learning PowerShell after the last blog post. I no more than get started when I stumble across the explanation for the mini-shell used by SQL Server 2008. It makes sense and should be read. I still don't know enough about how PowerShell works to get all miffed over Microsofts (minor?) error, but I'm glad that they're aware of the dirt they kicked up.
Read More

Learning PowerShell in SQL Server 2008

PowerShell
This blog post is pretty interesting. http://concentratedtech.com/content/index.php/2008/06/sql-server-2008-powershell-no-no-no-no-no/   SQL Server 2008 comes with sqlps.exe, which is what this guy is ranting about.   To get around it, you can do this. Open the regular powershell command prompt. Run this:   notepad $profile   This opens up the profile used by PowerShell under your login. Now you can add these lines and save the file:   add-pssnapin SqlServerProviderSnapin100 add-pssnapin SqlServerCmdletSnapin100   You should now be able to run SQL Server commands through the regular PowerShell prompt. Depending on how you configure and run Powershell, you may also have to add those lines to scripts you create.   I may not have this quite right. I'm still learning. Here's a suggestion that I should be updating the console file? He's solving the…
Read More