1

An analytical mind

Last week I was reading this article in which a Professor argues that students should be allowed to take smartphones and laptops into exams: –

Professor Mazur urged academics to take the next leap allowing students to use their laptops and phones in exams. He himself encourages students to bring their mobile devices into exams to “look up whatever you want, whenever you want” arguing that in the era of the Google search, students “don’t need to memorize anything.”

Now I don’t completely agree with saying that students don’t need to memorise anything but I do agree with the following statement: –

…he prefers students to be creative and use critical thinking and other analytical skills.

Analytical skills are absolutely critical to any IT professional. The ability to figure out what the problem is, research, and then deploy a solution (with a rollback in mind) is pretty much a cornerstone of what we do.

Ok, I fully admit that “googling” an issue doesn’t appear to be much of a skill but if you think about it, yes it is. Googling follows the same exact analytical procedure I identified above; figuring out the problem, searching for a solution and then identifying the correct one from the results.

However, a certain amount of base knowledge is required for this process. You need knowledge of the systems that you work with in order to identify the solution. Blindly googling and deploying the first solution displayed is a recipe for disaster.

Have a good week!

0

Monday Coffee: Should I learn powershell?

This month’s T-SQL Tuesday’s topic was set by Rob Sewell (b|t) and entitled Let’s all get PoSH

It had a massive response with loads of people writing about how they use powershell to automate tasks in their day to day work.

(Shameless self promotion – I wrote a post about how to create VMs with powershell, you can check it out here)

It was really cool to see how everyone uses powershell and for me answers the question “Should DBAs be learning powershell?”

Yes, yes you should.

I’d actually go further and say that you need to be learning powershell if you want to get anywhere in your career as a DBA. It’s a tool that in my opinion, every DBA needs. Yes you can get by without it but then you’re limiting your skills.

Here’s some of the posts that should give you an idea of how powershell can help you out: –

Daily database copy using Powershell
Disabling the named pipes protocol for SQL Server using Powershell
Using Invoke-SQLCmd to run SQL Jobs Remotely
Automation Through PowerShell Checking the Status of AGs
Turn on/off Azure VMs with Powershell

That’s a wide ranging area that powershell can help in, right? Pretty much anything you do as a DBA can be run in powershell. If you type something more than once? Hey, guess what!?

So if you’re not working with powershell, I highly recommend that you start looking into it. You’ll find a whole load of cool stuff that you can get into, from basic functions to modules like dbatools

One piece of advice for when you start writing…if it works, it works. Oh, and get your scripts reviewed by someone. It helps in ways you won’t even think of.

Remember that we’re all learning this stuff.

For example, I’d consider myself fairly decent at writing powershell scripts and recently asked a friend of mine to review a script I wrote. Here’s his response: –

Andrew, powershell is a beautiful language and you, are butchering it…

Ouch! 🙂

Thankfully he followed that up with a whole bunch of good tips on how I could improve my code.

But the point is, we’re all learning and there’s a whole bunch of people out there ready to help. So, give it a go and see what you can script.

Have a good week!

0

Friday Reading 2017-09-15

Excited for next week as I’m heading down to Cork to speak at the User Group there. Over 3 years in Ireland and I haven’t been yet, it’s about time.

This week I’ve been reading…

What does this little check box do?
Monica Rathbun (t) explains what checking the query governor to prevent long running queries tick box does

Your PASS Summit 2017 Speaker Idol Contestants Are…
Denny Cherry (t) details the line-up for this year’s Speaker Idol competition at Pass Summit

Sneak peek #3: Windows Server, version 1709 for developers
Official MS blog post explaining that the new insider version of Windows Server allows linux containers to run, very cool!

Running Ubuntu Containers with Hyper-V Isolation on Windows
And here’s a step-by-step guide on how to set that up!

Have a good weekend!

1

Creating Hyper-V VMs with Powershell

This month’s T-SQL Tuesday is hosted by Rob Sewell (b|t) and surprise, surprise, it focuses on Powershell 🙂 so I thought I’d write a quick post on how I’ve streamlined a pretty much weekly task that I perform, creating VMs.

I’m constantly spinning up VMs and then blowing them away. Ok, using the Hyper-V GUI isn’t too bad but when I’m creating multiple machines it can be a bit of a pain.

So here’s the details on the script I’ve written, hopefully it could be of some use to you too.

First check that your machine has the Hyper-V powershell module installed: –

Get-Module

If it’s not installed, you can either enable through the GUI: –

Or via script: –

Install-WindowsFeature -Name Hyper-V-PowerShell

N.B. – You won’t need to do this if, like me, you’re working with Hyper-V Server 2012 R2

Then you’re good to go creating VMs! All you need is the ISO for the OS that you want the machine to run.

Here’s the code: –

$BootDevice     = Read-Host -Prompt "Set VM boot device"
$ServerName     = Read-Host -Prompt "Enter VM Name"
$VMGeneration   = Read-Host -Prompt "Enter VM Generation"
[int]$VMMemoryGB= Read-Host -Prompt "Set VM Memory (GB)"
$VMCPU          = Read-Host -Prompt "Set Number of CPUs"
$NetworkAdapter = Read-Host -Prompt "Set Network Adapter"
$VHDPath        = Read-Host -Prompt "Set VHD Path"
[int]$VHDSizeGB = Read-Host -Prompt "Set VHD Size (GB)" 
$SecureBoot     = Read-Host -Prompt "Secure Boot On/Off"
$ISOPath        = Read-Host -Prompt "Set ISO Path"


$VMMemory  = ((($VMMemoryGB*1024)*1024)*1024)
$VHDSize   = ((($VHDSizeGB*1024)*1024)*1024)


New-VM -BootDevice $BootDevice -Name $ServerName -Generation $VMGeneration -MemoryStartupBytes $VMMemory -SwitchName $NetworkAdapter -NewVHDPath $VHDPath -NewVHDSizeBytes $VHDSize

Set-VMProcessor $ServerName -Count $VMCPU

Set-VMFirmware -VMName $ServerName -EnableSecureBoot $SecureBoot

Set-VMDvdDrive -VMName $ServerName -Path $ISOPath

Either copy the script here or download it from my GitHub.

Now, I’ve got this saved on my Hyper-V host as CreateNewVM.ps1 and I execute it through a remote powershell session. Here it is in action: –

Thanks for reading!

0

Friday Reading 2017-09-08

It’s going to be a fun weekend as it’s SQLSaturday Cambridge tomorrow! Haven’t been to this event before, it looks like it’s kinda big. I’ve got the slot just after lunch so hopefully everyone will manage to stay awake during my presentation 🙂

This week I’ve been reading…

Please Don’t Do This!
Monica Rathbun (t) asks us all not to leave the default fill factor setting at zero

Containers are not VMs
Old post on the Docker blog detailing the differences between containers and VMs

Why I joined Heptio
Dave Cheney (t) talks about virtualisation, containers and orchestration

DBA Fundamentals September 2017
Shane O’Neill (t) details what sessions the DBA Fundamentals VG has in September

GroupBy – September Sessions
The second round of GroupBy webinars in September is today. I can’t make it as I’ll be travelling but bookmarked and will come back to them.

Have a good weekend!