SQLvariations: SQL Server, a little PowerShell, maybe some Hyper-V Rotating Header Image

PowerShell

Atlanta PowerShell Group – October Meeting

PoShAfter a short summer break we’re glad to get back to business with PowerShell.  We’re very excited to have Mark Mitchell ( blog | twitter ) dropping by to show us how to create GUIs with PowerShell Smile

Date: 10/19/2010 (Tuesday) 6:00pm EDT (GMT-4)

Location:
New Horizons Atlanta
211 Perimeter Center Parkway Suite 200
Atlanta, GA 30346

Phone:
(770) 270-2000

Agenda:
6:00pm: Introductions and Opening Remarks and free pizza and soft drinks.
6:15pm: Creating PowerShell Graphical Interfaces – Mark Mitchell
7:15pm: Script Club
7:45pm: Giveaway: Multiple copies of Lee Holme’s “Windows PowerShell Cookbook”

Speaker Bio:

Map picture

Mark Mitchell has been working in IT for 30 years. He has worked about half his career time as an independent consultant, and the rest in the employment of companies. Mark has built or supported applications ranging from Finance, Mortgage Banking, HR, Transportation, Billing, Manufacturing, Project Management, and Sales Order systems; Running on Mainframe, Unix, and Windows platforms.  Mark has worked with and designed Databases from Network(IDMS), hierarchical(IMS), and Relational(Oracle,SQL Server). Compiled languages of Cobol,Pascal/Delphi,VB,C/C++,ABAP(SAP),Java,C#. For Y2K, Mark rewrote a dBase shopfloor management application as an ASP web based application using a SQL Server backend.

Mark Mitchell’s Scripting history:

  • 1981 scripting mainframe editors (Wylbur, TSO/SPF-Clists ,VM/CMS)
  • 1984 Dos batch scripts
  • 1996 Unix bash scripting with SED and AWK.
  • 1998 VBScript and Windows Scripting Host
  • 2000 CScript, and Perl
  • 2005 AutoIt
  • 2008 came across PowerShell

In January 2009, volunteered to learn enough about PowerShell to do a presentation for the Microsoft Professionals group, And then promptly found an Atlanta PowerShell MVP – Hal Rottenburg ( blog | twitter ) to do it – in January 2010.

Mark Mitchell has been active in the Microsoft developer community in Atlanta attending meetings of Microsoft Atlanta Professionals, Atlanta MDF(SQL Server), Atlanta SharePoint User Group, Atlanta .Net User group, and Atlanta PowerShell User Group. He has attended the SQL Saturday, SharePoint Saturday, CodeStock, Devlink, Atlanta Code Camp, and ReMixAtlanta conferences.

Mark has built 5 of his own desktop computers over the last 10 years, and one of those computers that has never been connected to the internet – dedicated entirely to music composition and recording, with terabytes of sound libraries. Mark plays Keyboards,Guitar,Bass,flute,violin, and has sung in choirs. He is also a semi-professional photographer.

 

Live Meeting: http://www.livemeeting.com/cc/UserGroups/join?id=JGK9RJ&role=attend&pw=gh%3D*258FbRegistration: http://www.powershellgroup.org/atlanta.ga

I’ll Be Speaking at SQL Saturday #49 in Orlando

imageWe’ve worked with the organizers of SQL Saturday #49 to be able to bring you a full day line up of PowerShell but it get’s even better.  In addition to myself and the usual Florida crew of PowerShell-for-SQL speakers, as luck would have it Microsoft Scripting Guy Ed Wilson and the Scripting Wife just happened to be on vacation in Orlando that very weekend!  Open-mouthed smile 

I’ll be doing my intermediate session on PowerShell to give those scripts one last run through before choosing what to show off at the Summit.  If you’ve seen my beginner session in Tampa, Jacksonville, or Miami this one picks up and builds on that one.  Not much has changed for the intermediate session since Columbia but it is a long car ride down there and I’m not driving so we’ll see if I come up with something new.  I hope to see you there.

Here’s the lineup:

Start Time PowerShell
09:00 AM Maximo Trinidad
Working with SQL Server – SQLPS
10:15 AM Aaron Nelson
The Dirty Dozen: PowerShell Scripts for Busy DBAs
11:30 AM Aaron Nelson
PowerShell 2.0 Beyond the Dirty Dozen
01:15 PM Ron Dameron
Why a DBA Should Learn PowerShell (MINI)
01:30 PM Ronald Dameron
Automate Login Administration & Compliance Reports
02:45 PM Ed Wilson
Windows PowerShell Best Practices for SQL DBA’s
04:00 PM Chad Miller
ETL with PowerShell

Announcing the New PowerShell Virtual Chapter of PASS!

pass_logo_thumbWe are very excited to announce the new PowerShell Virtual Chapter of PASS!  What is a Virtual ChapterPASS Virtual Chapters are forums where SQL Server Professionals from around the world can communicate with others who have similar interests and face similar challenges.  Think of it this way, PASS Chapters unite the SQL Server Community from a geographical perspective, Virtual Chapters unite the community based on common interests in a specific discipline.

What will the new PowerShell Virtual Chapter do?  Our primary mission is holding Live Meetings every month featuring free training from around the world.  We plan to archive the presentations for you to watch on demand and highlight articles and blogs that will interest our members.  This Virtual Chapter is headed up by top professionals from around the US: Ben Miller ( blog | twitter ), Chad Miller [no relation that I’m aware of] ( blog | twitter ), Lars Rasmussen ( blog | twitter ), Peter Schott ( blog | twitter ), and Aaron Nelson ( blog | twitter ).

 We will start things off next Wednesday with our first presentation. Here is the schedule through the end of the year.  Smile We are currently looking for speakers for next year.

Wednesday October 20th 12 pm EDT (GMT-4) – Presenter Chad Miller
Wednesday November 17th 1 pm EST (GMT -5) – Presenter Aaron Nelson
Wednesday December 15th 1 pm EST (GMT -5) – Presenter Peter Schott

Chad Miller will get us started with an introduction to PowerShell as a command line for one-off tasks or automation in the DBA world. Basic PS principles and syntax will be covered. Get your proverbial DBA feet wet with a tool that can make your database and sysadmin life better than it was before! Bigger, stronger, faster. (Cue Bionic Man theme)

Chad Miller
Chad hails from the land of rocket launches, oranges, and alligators where he started the Tampa PowerShell User Group. Chad is the DBA for SQL Server and Manager of Database Administration for a shop supporting SQL Server, Oracle, and Informix, acts as coordinator for the SQL Server PowerShell Extensions CodePlex project, and maintains an active blog at http://sev17.com/author/chad-miller/ .

How do I attend? Registration for the event is now open.
*When you register you’ll get a calendar reminder for the event.

I’ll be Speaking at SQL Saturday #48 in Columbia, SC

image I’ll be speaking at SQL Saturday #48 this weekend and I am happy to announce I will be unveiling my more advanced PowerShell session to help people customize scripts for their own environment.  I will be showing off several new scripts that I built for my session at the PASS Summit this year.  Please be ready to give plenty of brutal feedback on these scripts so that I can incorporate that feedback in the final versions that I take to the Summit.

Map picture

Besides my two sessions I will be joined by Eric Humphrey ( blog | twitter ) and Microsoft Scripting Guy Ed Wilson ( blog | twitter ) who will also be speaking about PowerShell.  Eric totally stole the idea for his session from me but hey I guess ‘Great Minds Think Alike’ ;-)   Just a quick glance at the schedule shows experts descending on Columbia from Richmond, Tampa, Orlando & Alabama just to name a few so don’t even think of coming up with some lame excuse that it’s too far to drive.  We’ll also be joined by a bunch of SQL Experts from Microsoft’s Charlotte campus so it’s definitely work the trip and I hope to hear you heckle me there!

Start Time Large Session BI 1 BI 2 DB Admin 1 DB Admin 2 DB Dev 1 DB Dev 2 Misc
08:15 AM SQLSat Staff
Opening Remarks
             
8:30 AM Alejandro Mesa
Parameter Sniffing
Jessica Moss
Make Reporting Services Work For You
Stuart Ainsworth
Confessions of a Data Integrator: Bad Designs
Andy Warren
DBA 101: The Basics
Sergey Pustovit
SQL Server Performance Related DMVs
Alex Tocitu
PowerSQL(CLR)
Eric Humphrey
Things To Do With PowerShell & SMO
William Pearson
Attribute Discretization in Analysis Services
9:45 AM Andy Leonard
Database Design for Developers
Wayne Snyder
Information Visualization – Making great Charts
John Welch
Creating Custom Components for SSIS
Janis Griffin
SQL Server Service Broker – An Overview
Aaron Nelson
The Dirty Dozen: PowerShell Scripts for Busy DBAs
Matthew Campbell
Going Spatial
Andrew Kelly
Maximizing Plan Re-use in SQL 2008
Jose Chinchilla
Get Cert! Get Cred!
11:00 AM Sergey Pustovit
SQL Server Diagnostics Tools Unleashed
Evan Basalik
Troubleshooting SSRS Performance
William Pearson
Getting Started with MDX
Sandra Mueller
Data Files and Transaction Logs — beyond the GUIs
Geoff Hiten
Clustering for Mere Mortals
Tim Chapman
How, where, why, and when to use Dynamic SQL
Rafael Salas
Managing Database Schemas With VS201 DB projects
Andy Warren
Building a Professional Development Plan
12:00 PM Stuart Ainsworth
Lunch & Red Gate Software Demo
             
1:15 PM Andrew Kelly
Storage and I/O Best Practices for SQL Server
Andy Leonard
SSIS Design Patterns
Mark Tabladillo
Data Mining with PowerPivot 2010
David Taylor
To click or to type, that is the question.
Aaron Nelson
PowerShell 2.0 Beyond the Dirty Dozen
Brett Tomson
T-SQL Enhancements in SQL Server 2008
Alex Tocitu
CLR 101
Chris Skorlinski
Top 5 fastest ways as DBA to get fired
2:30 PM Ed Wilson
Windows PowerShell Best Practices for SQL DBA’s
Julie Smith
Cool Tricks to Pull from your SSIS Hat
Sandra Mueller
OLTP (yes!) Databases and Cube Design
Ben DeBow
Consolidated SQL Server Architectures
Evan Basalik
Diagnosing connectivity issues with SQL Server
Stuart Ainsworth
You Got XML In My Database? What’s Up With That?
Bob Langley
Introduction To Column Level Encryption
Eric Humphrey
Object Relational Mappers for the DBA
3:45 PM Geoff Hiten
Bad SQL
Jessica Moss
Who Needs a Data Warehouse?
Jose Chinchilla
Business Intelligence: Decaffeinated Please!
Chris Skorlinski
Introduction to Transactional Replication
Janis Griffin
Tuna Helper – Proven Process for Tuning SQL
Brett Tomson
What’s New In SSRS 2008 (With Added R2 Flair)
John Welch
Processing Flat Files with SSIS
Rafael Salas
Planning your ETL architecture with SSIS
4:45 PM SQLSat Staff
Closing Ceremonies & Raffle
             

Finding SQL Servers with PowerShell

image Have you ever clicked a drop-down to connect to one of your databases and noticed an instance that you don’t remember setting up? Or maybe a server that was recently setup for some new application in your organization, that no one mentioned it needing SQL, but you come back from your day off and notice that server is now one of your available SQL Servers? If your office is like mine those things happen all too often.

There are several different methods to finding out just how many SQL Servers are running on your “network” right now. Each method has pros and cons. But the biggest problem that I run into is: ‘what is defined as the network?’ Is it just the network of computers at your office? Does it include servers at your collocation facility? What if you have a completely separate domain for Development?

The first method I’m going to point out to you is really easy to use but it’s results vary depending on your network rights and where you run it from, but, it still can find machines that you didn’t even know about so lets have a look. Wait, why would I start out with an example that’s so imperfect? Because this method uses the same .Net components that are used to generate the list of servers you see when you click on the “<Browse for more>” option in the drop down of the SSMS connection window*. This means that you’ll see a list that you recognize (probably). Fire up the ISE and kick off this command:

[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources()

Now if you’re just on you laptop or sitting at home or something you’ll probably get a nice short list like this: image But if you’re at work, you’ll get back a much longer list; maybe even longer than you expected :-)

Heck how many servers just came back anyways! The answer to that question is really easy, just pipe the output of the command to Measure-Object and find out like this:

[System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources() | Measure-Object

and you’ll get some output like this:

image Now like I said earlier, these results are going to vary depending on where you run the command so here’s what I recommend. Run this command from your desk. Then try it from a machine that is on a different network segment that you’re usually on – like a Dev domain. Then go home, VPN in and run the command, see how many you get back now.

OK that’s great but with all of these variances can I do anything useful with this example? Sure you can. Take your results and put them in a table. First build a simple table to use:

CREATE TABLE FoundSQLServers (
ServerName VARCHAR(128),
InstanceName VARCHAR(128),
IsClustered VARCHAR(3),
VersionNumber VARCHAR(64)
)

Then build some insert statements off of the results like this:

$SQL = [System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources() | ` foreach {
"INSERT INTO dbo.FoundSQLServers VALUES ('$($_.ServerName)', '$($_.InstanceName)', '$($_.IsClustered)', '$($_.Version)')" ` >> C:\Temp\INSERTFoundSQLServers.sql
        }

To open up the file that was just created in Management Studio just run this

Ssms.exe C:\Temp\INSERTFoundSQLServers.sql

…and you should get some nice insert statements for that table like this:

INSERT INTO dbo.FoundSQLServers VALUES ('WIN7ULT', 'KILIMANJARO', 'No', '10.50.1600.1')

Go ahead and insert those rows into your table, maybe even give the table a little bit different name like: FoundSQLsFromVPN or FoundSQLsFromDev. Run some queries to compare the results you get from different network segments; see which servers we found both at home (through VPN) and at work from your desk; and more importantly which ones are only found from one of those locations. We’ll take a look at a couple of different methods I’ve learned about in future posts but I wanted to get you started with finding out how well this method finds your servers and knowing how your network location can affect it. Just in case you’ve recently started a new job or something ;-)

Special Thanks: I just wanted to take a moment to thank Grant Fritchey ( blog | twitter ) for doing a tech-check on this post and helping convey my points a little more concisely.

* Small Disclaimer: I was told that it’s the same .Net component used by applications like SSMS but since I don’t work at Microsoft and I’m not a developer I wouldn’t even know where to start to verify this but the list produced has always been very similar or down-right identical.

SQL Saturday #46 Raleigh Code and Slides

SQLSaturday46Raleigh Well I don’t know about the attendees but I sure had a lot of fun during my PowerShell session at SQL Saturday #46 in Raleigh.  I promised some folks that I would blog out my code and slides that I used ASAP.   Here are the slides I used and more importantly here are the scripts

Grant Fritchey ( blog | twitter ) was nice enough to snap a shot of me telling a Developer in the audience what I thought about how many steps it takes in PowerShell to use ADO.Net :-)

I’ll post some more details about the event later since I want to get this code out however while I’m at it I’d like to mention that:  For the first time in my short speaking career (and quite possibly the last) I had the largest audience of any session in my room. :-D :-D

Speaking About PowerShell at SQL Saturday in Raleigh

image I’ll be speaking at SQL Saturday #46 in Raleigh this weekend!  I’m really excited to be speaking at this event because I talked Microsoft Scripting Guy Ed Wilson ( blog | twitter ) into being a presenter too :-)   and take a wild guess what we’ll both be speaking about!  It wasn’t really hard to get Ed to join us actually; I sent him a tweet saying something like ‘Hey Ed can you come out and speak to us SQL folks’ and his reply was ‘I’ll submit something tonight’.  Might want to keep that in mind the next time that you’re looking for a speaker. 

Map picture

Take a look at the schedule and you’ll see that it’s packed with SQL Server experts so come on out and join
 us, the football hasn’t gotten all that good yet so you’ve got no reason not to.  Also, I have a new demo that Lee Holmes helped me get working that if you love to hate extracting data from Excel, this will make your life much simpler. 

Start Time Track 1 Track 2 Track 3 Track 4 Track 5 Track 6
8:30 AM Andy Leonard
Build Your First SSIS Package
Rafael Salas
Dimensional Modeling: Why Should You Care?
Sergey Pustovit
SQL Server Performance Related DMVs
Kevin Boles
Common TSQL Programming Mistakes*
Flavio Almeida
Self-Service BI with PowerPivot
Geoff Hiten
Clustering for Mere Mortals
9:45 AM John Welch
Processing Flat Files with SSIS
Mark Tabladillo
Data Mining with PowerPivot 2010
Jana Sattainathan
Partitioning in SQL Server 2005/2008
Tim Chapman
How, where, why, and when to use Dynamic SQL
Jessica Moss
Who Needs a Data Warehouse?
Aaron Nelson
The Dirty Dozen: PowerShell Scripts for Busy DBAs
11:00 AM Chris Skorlinski
Introduction to Change Data Capture
Mark Tabladillo
Document Classification using DMX in SSAS
Andrew Kelly
Maximizing Plan Re-use in SQL 2008
Kevin Goode
Embracing the CLR
Mike Davis
Reporting Services 2008 R2, the New Stuff
Brian Kelley
Fortress SQL Server
12:00 PM         SQL Saturday
Red Gate Software
 
01:00 PM John Welch
Patterns for SSIS Configuration and Deployment
William Pearson
Attribute Discretization in Analysis Services
Grant Fritchey
Identifying and Fixing Performance Problems using
Andy Leonard
Database Design for Developers
Jason Hall
Recipe for a Happy DBA – A Guide for SQL Server De
Ed Wilson
Windows PowerShell Best Practices for SQL DBA’s
02:15 PM Andy Leonard
SSIS Design Patterns
Steve Wright
The Shade Tree Mechanic’s Guide to SSAS
Thomas LaRock
Performance Tuning Made Easy
Allen White
XQuery Basics
Geoff Hiten
Bad SQL
Brian Kelley
The Dirty Business of Auditing
3:30 PM Chris Skorlinski
Integrating CDC and SSIS for Incremental Data Load
Mike Davis
Using Parameters in SQL Server Reporting Services
Kevin Goode
Statistics, how to prove everything but the truth.
Kevin Boles
Advanced TSQL Solutions
SQL Saturday
Q & A — Stump the Speakers
Amy Styers
Virtualizing SQL Best Practices
4:30 PM         SQL Saturday
SWAG Give Away
 

Columbus and Edmonton Code and Slides

I spoke in Columbus, GA and Edmonton, um…, somewhere in Canada on back to back nights this Tuesday and Wednesday. (I’m kidding, I know it’s in Alberta, and you guys like the Jets right? ;-) ) I used the same slide deck for both sessions; well, for Edmonton I didn’t even use a slide deck, but the scripts I covered were a little different.

image I’ve recently learned that if you only have PowerPoint 2007 you’ll need to download this viewer because I built the slides in PowerPoint 2010. Here are the scripts for Columbus and Edmonton.

I think both events went really well and got a lot of people saying: ‘Hey, this PowerShell stuff could work in my environment’. I really hope they catch the fever! I’d love to speak to each of these groups next year and see what questions they come up with and see how much they’re using it. I’ve got a more advanced session that I will be debuting a little later this year so hopefully I’ll get to share it with them too.

Huge thanks to Jonathan Boulineau ( twitter ) and Colin Stasiuk ( blog | twitter ) for all they do for their groups all year long.