Category: Blog

  • Powershell in a Month Day 14 – WMI

    This is part of my Powershell Challenge, to learn more about PowerShell (PoSh) using the Learn Windows Powershell 3 in a Month of Lunches book by Don Jones.

    Day 14 introduces us to Windows Management Instrumentation (WMI). Since many people might not be familiar with WMI, the chapter spends a little time trying to help you understand what WMI is.

    I know what it is, I hate it, and I agree, it’s a PIA. It’s a mess, it’s inconsistent, and I’m not surprised the Powershell barely integrates with it. As with the cmdlets, this shows that there are the WMI cmdlets and the newer CIM cmdlets. The old ones like

    Get-WMIObject

    are somewhat deprecated. They work, but no development is being done. Instead, we need to use

    Get-CIMInstance

    That makes sense to me and I understand it. With no legacy work, I don’t think I have any issue with using Get-CIMInstance, though I do hate the idea of querying the WMI spaces. They’re a mess and nothing is intuitive.

    gwmi -class win32_bios -computer localhost,JollyGreenGiant | format-table @(l=’Host’;e={$_.__SERVER}

    There’s more to the table, but that’s all I typed in to test. I did a few more queries, with this and Get-CIMInstance to practice, but most of this chapter is really just understanding how WMI is organized to look for things and then formatting the results. Easy enough to do, a little boring, but good practice with expressions.

    The lab was annoying, mostly because it’s asking you to figure out which WMI classes to query. I googled around for some, and found them, but mostly this is annoying. I can certainly see where it’s handy to understand how WMI queries work, but like most people, I prefer to avoid them.

    Short chapter, easy, and good practice formatting things.

  • Starting to Use Powershell

    I have to admit that before the Powershell Challenge, I wasn’t really looking forward to using Powershell for much of anything. It looked cumbersome, I didn’t always understand how sample scripts worked, and it was just easier to use the various other Windows tools to accomplish tasks.

    However as I’ve been working through the Challenge, I’ve started to gain some comfort with the language, conventions, help, etc. This came into play recently as I was beginning to set up a new domain for some testing and demos.

    I installed Server Core and went to configure a domain, which means static IP addresses and more. Once I had Core installed, with no domain and no other tools, I was slightly stuck. However I googled and when I found things like

    Get-NetAdapter

    and

    Set-NetIPAddress

    I wasn’t at all deterred. I could easily read and understand the way these commands work, how parameters are applied, how precedence matters with parens and piping works. Even a restart was quick with

    Restart-computer

    or

    stop-computer

    When I needed to verify which machine I was actually working on

    $env:computername

    was a quick way that worked well.

    The whole world of Powershell starts to look easier as I go along. The slow movement through the book has made me more likely to run a quick search and type a command than use the GUI for a number of server-level tasks that I’ve needed to do.

    It’s a neat new world for me.

  • Branding, Encryption, and Yoga in Cleveland

    It’s just under two weeks to SQL Saturday #241 in Cleveland. This will be my second trip of 2014 and I’m doing some planning for the trip.

    First, Yoga.

    I practice yoga every week and find it to be a good workout as well as a relaxing one. It helps with my flexibility, and since I’m having surgery in a few months, I’m trying to make sure I continue to work muscles. Erin Stellato and I started planning on a class on Friday morning, Feb 7, 2014. It’s the day before SQL Saturday, but since I’ll be in town, it’s a good choice. Erin uses the Inner Bliss Yoga studios, and if you’re interested and want some #sqlyoga, come join us. I’m not sure which class we’ll do, but we’re leaning towards the 9:15 at the River studio. Watch for me to post details on Twitter.

    After yoga (and a shower), it’s time for SQL in the City 2014. We have our first event in the US taking place on Friday, February 7, 2014 at the Holiday Inn in Westlake. It’s free to attend, but we’d like you to register so we can plan for attendees. We have a limit, so please don’t register if you don’t plan on attending. We’ll be talking about database deployment, version control, and continuous integration. It’s an interesting topic, and one that lots of people find interesting and inspiring.

    Saturday is SQL Saturday #241. The schedule has me talking Encryption first at 8:45 and Branding at 11:45am. Please feel free to come to my sessions, or check out Grant’s Statistics or Query Optimization talk. Please also feel free to say “hi” or shake our hands at anytime. My apologies in advance that I won’t make the after-party Saturday night. I need to get home to Denver, so I’ll be leaving a bit before the end of the day to catch a plane.

    If you’re in the Cleveland area, join us Friday for SQL in the City and come on Saturday for SQL Saturday #241. There are also pre-cons taking place on Friday if you don’t want to see us talk deployment and would rather hear Argenis Fernandez talk about disaster recovery or Allen White talk Powershell. They’re both great presenters and $99 is a bargain for their pre-con events.

    Hope to see you there.

  • Just use Version Control

    There are free systems out there. If you have no budget, and want to get started, download one of these:

    There are good ones to pay for as well, and some of them have other features and integration you may like:

    There are plenty more. Please, please, please, start using Version Control. There are compelling reasons from many successful developers, including those that want your database code under control.

    There are ways to do this, but please pick one. Version control is a must for professional software developers. That means if you write code, and get paid for it, use version control. If you write code, and don’t get paid for it, value your time and use VCS anyway.