Time is flying by and it’s getting really close to SQLSaturday Chicago (#sqlsat119). If you are anywhere remotely close on May 19 you do not want to miss this one! Go here and register. I got much love for this particular SQLSaturday. This one really solidified my love for these events. It was the second SQLSaturday that I had presented at ever after my first one in Nashville. I had such a great time and met so many great folks. I ate up every minute of it…all of them till 4:00AM in fact. Everyone continued to encourage me and welcome me into this lovely, wonderful sqlfamily…I was just blown away! So go…go now and sign up! There’s even a session from Eddie Wuerch (blog|twitter) titled “Join Us! Getting Started as a Technical Speaker”. Go and catch the bug like I did then make sure to come speak at my hometown SQLSaturday in July in Indianapolis (#sqlsat126). Shameless…I know 🙂
Well it was for me anyway. I attended some great sessions and a really interesting discussion on women in technology. My presentation on spatial data went pretty well. Even though it was advertised as “special data” or “spacial data” a few folks showed up. Definitely wasn’t a packed house but got some good feedback. The speaker dinner afterward was really great! I ate up every minute of discussions with Jimmy May, Brad McGehee, Kevin Kline, Rob Bogue and John Magnabosco. They were all very gracious and encouraging of this young newbie. So I am trying to take their advice and up my game a bit. Here I am blogging away and just submitted some sessions to Nashville SQL Saturday (http://www.sqlsaturday.com/51/eventhome.aspx). Here are my slides for the presentation.
No I have not been abducted by aliens, just really really terrible blogger and haven’t updated it in forever. I have now been motivated to get back into the swing of things and begin posting again. This past Saturday I had the pleasure of presenting at the SharePoint Saturday event. I think things went pretty well in my session and I got to see a couple really good sessions from other presenters. I met some really nice folks there as well. I wanted to go ahead and post the slides from our session (joint session with Jim Grabinski). Click here to get the slides.
Hopefully karma will repay me for this post. I always visit so many blogs for general perusal but mostly for fixing issues I’m running into at the time. Maybe I can save some poor soul out there some time and energy looking through Googled-Results-Land. First of all…I’m really digging Powershell. Since reading details of what was to come in SQL Server 2008 I was intrigued. Then when I started wading through it and creating scripts, I dig it even more. As with everything though I ran into some bumps in the road.
I was setting up some Powershell scripts to run through the SQL Server Agent for the first time ever. I tested them, and tweaked them, and tested some more. Hooray I’m done, let’s really quickly schedule this bad boy to run through the Agent….what tha? I first tried to use the Powershell subsystem since it was the cool new toy in SQL Server 2008. Well I get the error: This host does not support transcription. Ok…appears to be a bug as far as I can tell so I move on and try issuing the command to run the script via cmdexe. I got to thinking that would be better anyway so it would pull in changes to the script and I only have to update the script file and not remember to update the syntax in the job step (I’ve been bitten by that one before). Ok so moving on, still can’t get it to work right that way either. Ok so what next, hmm, what is this tee-object thing? That’ll work and even better so as it will pull in files to be deleted without the whatif…fantastic! Doing my testing and it’s working great after I figure out the syntax of the tee-object -variable does not use the $ like you’d think it would. Ok fabulous, lets add multiple instances into the mix…wait…oh no don’t tell me. It seems tee-object at this time does not have -append ability. Dangit! Ok after going to vote to add this into next version of Powershell (I’m using 1.0 by the way) I have to think again. How am I going to do the logging for this script looping through multiple instances through the Agent *banging head on desk*? Ok out-file does have ability to append. Then the skies part, the sun shines through, and the angels sing 🙂 Below is what I had to do to get logging to work with a script that is scheduled with the SQL Server agent:
$now = Get-Date
$logfile = “c:\logdirectory\LogName-” + $now.ToString(“MMddyyy”) + “.log”
Stuff doing | tee-object -var temp | other stuff doing (ie. remove-item)
$temp | out-file -filepath $logfile
Then on the next iteration and any subsequent ones you’ll have to add the -append to your out-file operation. I also included my way to add a timestamp to the log as well as that took me some digging into as well. Double karma brownie points perhaps?
I have finally caved and created a blog. I figured before I dive in and start posting helpful things such as crazy issues I’ve encountered in SQL Server, Powershell, and etc I should first introduce myself. My name is Hope Foley and I am a SQL Server DBA. I work for a company called Perpetual Technologies in Indianapolis, IN (http://www.perptech.com) as a consultant. I have been in IT for 9 years, the latter half of that in the DBA role. I hold MCITP certification in SQL Server 2005 and 2008.