Last week I spoke to the Atlanta PowerShell User Group about Remoting and Background Jobs. There are a couple different flavors of Remoting but the one I’m most excited to show people is called Implicit Remoting. What if you were on a machine that only had SSMS 2005 and you had to run something against a remote server that had SSMS 2008? Enter Implicit Remoting. With Implicit Remoting, essentially you temporarily download the cmdlets from the remote machine onto your local machine. When you execute the cmdlet it runs against the remote machine. Before we start I want to set the scene. On your local machine you need to have PowerShell 2.0. The remote machine needs PowerShell 2.0 and SSMS 2008 installed. Setting up the Remove Server Log into the remote server via Remote Desktop and create a profile (notepad $pshome\profile.ps1) that contains this: add-pssnapin SqlServerCmdletSnapin100 add-pssnapin SqlServerProviderSnapin100 Next create a new Remoting Configuration to load your SQL Items into your profile: (* I used the ISE profile) Register-PSSessionConfiguration -Name SQLSupport ` -StartupScript C:\Users\YourUserNameHere!!!\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1 Setting Up Your Local Machine Open a Power Shell window that has no profile loaded. Run the following: $RemoteSession = New-PSSession -ComputerName MyRemoteServer -ConfigurationName SQLSupport Connect to the remote session you just defined in the variable: Enter-PSSession $RemoteSession Run this command to test your setup. You will see the SQL Server cmdlets from the snapin that was loaded with the Remoting Configuration. get-command invoke-sqlcmd Exit the session: Exit-PSSession Now we want to Import invoke-sqlcmd. This will allow you to run your scripts against the remote server session that you defined. This might not seem like much, but if you are working over a VPN from home this could be very useful. Plus you don’t have to keep switching between your local shell and the remote one (*more on that another day). Import-PSSession $RemoteSession -CommandName invoke-sqlcmd get-command invoke-sqlcmd Putting it to Use Now that all of this is done what command will you run? Well anything. Just because I wanted to see if it could be done I went ahead and ran Back Woodys ‘backup all user databases script’. Run anything you want, but a good start is something simple like: invoke-sqlcmd -query “sp_databases” -database master ` -serverinstance localhost | format-table Your Environment Now please think outside the box because the SQL cmdlets might not be the ones that you personally want to download. I was just using them as a common example us SQL folks could talk about. You might be more interested in downloading the Clustering cmdlets in your case. Or, you might see this as a tool to centralize scripts that someone else in your company might ocassionally use but doesn’t need to worry about keeping locally (think CodePlex projects). You might even want to do the reverse for some reason, you might want to be able to download cmdlets from your local machine to a server for a one time use so that you don’t have to install anything. Either way I hope you remember this as one of the tools available to you. Happy scripting. del.icio.us Tags: PowerShell,SQL Server 2008,Remoting,Implicit Remoting
July, 2010:
I’ll be speaking at SQL Satrurday #40 in Miami
It feels like forever since I spoke at a SQL Saturday! The South Florida SQL Saturday will be help on July 31st, 2010 at Devry University – South Florida, 2300 SW 145 Ave, Miramar, FL 33027. Event checking will be at 7:30 with the Keynote beginning at 8:00 and sessions beginning at 8:30. I can’t wait to get down there. Max Trinidad ( blog | twitter ) has put together an entire day of PowerShell training for this event and I get to be one of the speakers! I’ll be doing my PowerShell for Data Professionals session. Which I am very proud to say I will be presenting a longer and more in depth version of this session at this year’s PASS Summit, so come cathch the preview! I’ve got a new trick to show the fine folks of South Florida and I can’t wait to get their feedback. Besides myself the three other PowerShell speakers are going to be: Ronald Dameron ( blog | twitter ), David Corrales from Sapien, and of course Maximo Trinidad. Here’s what that PowerShell track is going to look like: Ronald Dameron Why SQL Server DBAs should learn PowerShell Ronald Dameron Automate ID Administration w/ PowerShell & SQLPSX Aaron Nelson PowerShell for the Data Professional David Corrales Sneak Preview: SAPIEN’s Visual PowerShell 2011 Maximo Trinidad Working with SQL Server – SQLPS Maximo Trinidad Using PowerShell with SQL Server Agent
FWIW: #EXCHHelp or #EXCHGHelp?
I saw a tweet on the #SQLHelp hotline last night from Mike Talon ( blog | twitter ) asking “Is there an #Exchange version of #SQLHelp?” My immediate reaction was: Wow!! What a compliment to the #SQLPASS community that other communities want to help each other like we do! [Insert Giant Community Pat-On-The-Back] I know less than nothing about Exchange. I’m pretty sure that it runs on Windows and I of course know that you can manage with PowerShell Oh, and my Outlook doesn’t work if it can’t connect to Exchange; and that’s pretty much it. So in the spirit of #SQLHelp I had to lend what hand I could, and that’s only in naming. The key is to be short and recognizable. #EXCHelp Can’t do it because people could mistake the hash for Excel. #EXCHHelp Was my suggestion because it’s short and hopefully recognizable to them. #EXCHGHelp Was Mike’s idea, he said that EXCHG was a common way of referencing Exchange. I really have no idea what’s going to be a success for them here but I wish them the best of luck in getting the word out on whichever hashtag they settle on.
Please Join Us for #PoShHelp
I am We are now monitoring #PoShHelp on twitter for #PowerShell help The #SQLHelp hashtag has been an overwhelming success and it is time for PowerShell to get their own help tag. The PowerShell community is incredibly generous and this tag can help those generous and knowledgeable folks impart their wisdom when you are struggling. I think #PoShHelp will be a great success. How to Ask #PoShHelp Questions Sign up for a Twitter account. You don’t have to follow anyone, but if you want to, I’d suggest following Steven Murawski’s PowerShell Twitterers list instead of individual people. Brent Ozar has a post on how to use Twitter lists, but in a nutshell, they let you keep in touch with a lot of people who focus on a particular topic. The cool part is that their tweets don’t clutter up your main Twitter page, which is important because there’s several hundred PowerShell folks on Twitter as of this writing. When you need help, write a tweet and include #PoShHelp in the tweet, like this: Why not just use the #PowerShell hashtag that everyone already uses? People use that hashtag for anything PowerShell related. Blogs, news stories, events, pictures, funny stories, training, even problems: all things that someone wants to let everyone else in the community know about. The problem is that it can become very chatty and so I can’t have tweetdeck notify me every time that someone says something about PowerShell. I do have a job ya’ know What not to use the #PoShHelp hashtag for? Pretty much the #1 rule is: Don’t use the #PoShHelp tag for marketing. The tag is there for people to help other people they may have never met. Because of this (and just how insanely generous all these PowerShell people are) they might setup the advanced notifications in twitter apps like tweetdeck to notify them every time someone asks for #PoShHelp. If you’re trying to promote software, events, or your blog (and the blog post has nothing to do with how you helped someone that asked for #PoShHelp) then don’t use #PoShHelp just use #PowerShell. While the PowerShell community isn’t quite as large as the SQL community it’s still pretty darn big and everyone I’ve ever learned PowerShell from is on twitter. * Please Note: A portion of this post was completely ripped off and hacked back together from a post Brent Ozar originally did on the #SQLHelp hashtag
Atlanta PowerShell User Group July Meeting
Please come join us for our sixth meeting When: Tuesday July 20, 2010 at 6 pm Where: 211 Perimeter Center Parkway, Suite 200, Atlanta, GA 30346 How: Please RSVP so we can get a head count, bring your laptop if you can What: People from all over Atlanta getting together to talk PowerShell The July meeting of the Atlanta PowerShell User Group will be all about Jobs and Remoting. The presentation will be presented by Aaron Nelson, aka SQLvariant. <—Oh wait, that’s me! Some of the items covered include: How to run PowerShell scripts without having to wait for them to complete. How to run PowerShell scripts on multiple remote systems. How to interactively run PowerShell on remote systems. much much more. Please RSVP so we can get a head count. Pizza and drinks are provided by the ALTPUG thanks to UGSS.org Our meeting will be held at the New Horizon’s training center at 211 Perimeter Center Parkway, Suite 200, Atlanta, GA 30346. Click here for directions and a map. We currently do not have access to the site’s computers so bring your laptop if you can.
PowerShell Learning Resources
Yesterday a conversation on twitter about PowerShell learning resources lead me to realize that: The PowerShell tab on my own site could use some updating BUT: It’s grown to the point where it’s probably not all that useful for someone starting out. To that end here are 7 8 key resources that I would recommend for learning PowerShell: Listen to the PowerScripting Podcast The Show Notes for the PowerScripting Podcast are freaking treasure trove of info so subscribe to that blog and go exploring what was mentioned in past shows. Subscribe to Jonathan Medd’s PowerShell 2.0: One Cmdlet at a Time blog series. Jonathan Medd also co-hosts a podcast on PowerShell. Subscribe to both of these, load them on the mp3 player and listen to them on your way to work. You’ll learn without realizing it. Windows PowerShell In Action (Second Edition): An excellent book that even includes some of the “hows” and “whys” they made the tough decisions in this new language. Get yourself on the PowerShell Tip of the Day email (or RSS Feed) Windows PowerShell™ 2.0 Best Practices: This book is really thick but it is written in a way that is very easy to read even for people that are sill learning. Everyone should feel comfortable picking up this book. Of course: If you run into a problem just tweet the ScriptingGuys. Also be sure to subscribe to their daily blog (including weekends & holidays) where they lay out how to solve all kinds of questions people ask of them. And if you problem is longer than a tweet. Scripter@Microsoft.com and of course I can’t finish without saying: If you need some help getting started from scratch using PowerShell with SQL Server check out my video on MSDN’s geekSpeak and blog series from SQL University. I use quite a few more learning resources but this is where I started and where I would recommend for people to get started. I hope this helps!
Controlled Failure is the Key to Learning More
Recently Andy Leonard ( blog | twitter ) tweeted: “I was asked recently about secrets to success. My reply? “Never fear failure.” :{>” I really agree with this in a lot of ways. Surprised? Don’t be, there’s a big difference between ‘not fearing failure’ and ‘liking failure’. I don’t get up in the morning because I like to fail, I just know that it’s going to happen. A lot. I approach a new programming feature by reading through it’s capabilities one command at a time. After I’ve read the definition of a command then I like to play with the examples. After that I’ve done some of the things it says it can do, then I like to try and make it do things that weren’t actually listed. I like to test the boundaries of a feature. This is where some “controlled failure” comes in. Boundary testing is useful for a number of reasons. A best practice for using the feature might be established, but without testing the boundary you won’t understand why it is the best practice. When I’m done testing boundaries for myself I look at what others have done with the feature. I find out what problems they’ve experienced and what innovations they discovered. Because I’ve tested the boundaries myself I can better understand examples online and discuss these discoveries with other data nerds. By doing this I learn from my failures and other peoples failures too. This appetite for failure spills over into my work–and I’d bet it spills over into your work too. At the end of the day though no matter how big or awesome a solution we create chances are a ton of failure that went into it. On a good day I probably fail at trying more things by noon than most people do all day, heck maybe even all week. Embrace failure as part of the learning process. It makes you a better employee and even a better mentor at work, because let’s face it, if you can fail and then persistently succeed yourself then you’re better positioned to help a struggling coworker find that persistent success too.
TechEd is Coming to Atlanta!
TechEd is coming to Atlanta in May 2011! That’s right in just 10 months over 10,000 IT Professionals from around the world are going to descend on Atlanta for a week. I was really surprised to hear this since they were not that far away in New Orleans this year but who cares this is awesome news! Why is Microsoft bringing TechEd to Atlanta? Well they sure didn’t check with me but my first guess would be that it has something to do with the fact that: The Georgia World Congress Center is accessible to 80 percent of the American population in two hours or less (via car, train or the World’s Busiest Airport). Or maybe that it’s easier to fly direct to Atlanta than any other place on earth. Although instead of focusing on being open and accessible to as many people as possible Microsoft could have just been looking out for peoples wallets. The over 12,000 hotel rooms located in close proximity to the Georgia World Congress Center are probably the cheapest of any of the 10 largest cities in America. (I think only Dallas can come close.) So how on earth can over 10,000 IT Pros fit into a single convention center here in Atlanta and it not be cramped? Pretty easily actually because: The Congress Center’s Building B exhibit halls are more than twice as long as Atlanta’s highest skyscraper is high (which happens to be the tallest building in the Western Hemisphere outside of New York and Chicago). From one end of these halls to the other, the earth curves 3/4 inch. As many as 125,000 people have attended a single event at the GWCC. For relevance sake: that’s approx. 50x larger than the PASS Summit Or… Larger than every PASS Summit and every SQL Saturday ever held, COMBINED. The lobby of Building C alone is large enough to hold the Titanic. Building C: entrance lobby is over 1,000 feet long, 80 feet wide and over 90 feet high Titanic: 882 feet long, 92 feet 6 inches wide, and 60 feet 6 inches from the waterline to the main deck. Heck there’s over 90 acres or 3.9 million square feet throughout the GWCC The local users groups here in Atlanta are busy working on ideas to capitalize on this great opportunity and you can look forward to me blabbing all about what we’re up to sometime in the near future. * Facts obtained from http://www.gwcc.com/about/Fun_Facts.aspx, http://www.atlanta-airport.com/Airport/ATL/ATL_FactSheet.aspx, http://en.wikipedia.org/wiki/Bank_of_America_Plaza_%28Atlanta%29 del.icio.us Tags: Microsoft,TechEd,Conference,Atlanta,TechEd 2011