Hi, I’m Matt and This is How I Work

Where are you located?

Bristol in the UK

What are your current gigs?

I am a contractor and my current title is something like ‘Infrastructure Consultant’. Basically, I do on-prem and cloud(Azure) sys-admin and automation stuff. And, of course, I am a TechSnips Contributor 😉

What’s one word to describe your work?

Multi-Threaded

What apps, software, or tools can’t you live without?-

  • VSCode – I spend a lot of time writing PowerShell code. I started out on ISE but I’ve become addicted to VSCode in the last few years.
  • OneNote and Google Keep – I tend to dump notes into both of these as much as I can. It looks very disorganized, but I use it as a notepad so there are a lot of random words and IP addresses etc in there, and I know what they mean most of the time. I am using hashtags more and more as a simple way to organize my random notes.
  • PocketCasts – I listen to a lot of PodCast on my commute, and this is the app that I have settled on. It’s not perfect, but it does the job and supports speed ramping which helps me consume stuff quickly.
  • Pocket (on Android) – I LOVE Pocket! If you don’t know already it’s a pretty simple app that saves text web pages (ie blog posts etc) with all the formatting stripped out leaving just the text to read. It’s a great way to save blog posts so that you can read them when waiting for a train etc. The killer feature is the “Listen” button that will read the saved pages out to you. This is the first thing I do when I get in the car, ie just hit the button and it will read everything to me while I drive to work. Google Assistant – I am spending more and more time talking to my phone and house!

What does your workspace look like?

At home, I have a simple desk against a wall in a spare bedroom, which has become my office. I have a single ultra-wide monitor (it’s like having two monitors) with the laptop alongside to give another screen. It’s all connected to a USB DisplayLink docking station. It’s a pretty simple setup which works for me and having it against the wall means I can’t see anything that will distract me.

For recording TechSnips stuff, I have lined our airing cupboard (that’s no longer used) with sound insulating foam. I got a bit obsessed with this when I first started recording and probably went a bit far, but at least there is no echo in my recordings now 🙂

What’s a typical workweek look like?

My current job means I have to be in the office Monday to Friday. The office is all hot desks, so the situation isn’t that different from my home desk, just with a lot more distractions. I do a mix of support and project work so each day is different, which I like. Basically, I fix/create/design whatever my customer throws at me.

What do you like the best about your role?

Nothing is the same from day to day, and I work with some really smart people. Ok, there’s always something that doesn’t change, but generally, IT is always changing and I love that. With the advent of ‘cloud’, the pace of change just seems to be increasing. It can be a bit much to keep up with, but I love discovering new shiny ways to solve problems.

What’s something about you that no one knows about?

I used to keep bees until I got stung on the eyelid and had a big reaction that could have killed me. I don’t keep Bees any more!

What do you listen to while you work?

This is something I’ve spent a great deal of time experimenting with (honestly I could write a whole blog post on this). I get distracted by background voices and my mind wonders easily. I’ve found that music really helps to block things out and keep me on target, so I try to listen to music that has no lyrics and isn’t too lively (unless I need some screaming music to wake me up).

These are some of the things I have found:

  • There are some great Lo-Fi Hip Hop channels on YouTube (Example: ChilledCow ‘https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow’). These are a great continuous flow of music that doesn’t distract too much.
  • I use an App called Coffitivity (https://coffitivity.com/) which plays background sounds like you are in a Cafe. It’s a bit difficult to describe but it’s just like sitting in a Starbucks with all the background burble but you can’t really hear anything of what people are saying. It’s a bit odd but it really seems to work for me. There are loads of other apps that do this and lots of playlist on YouTube as well.
  • Music with no Lyrics works well. ‘Explosions in the Sky’ is one I keep going back to, but sometimes it can be a bit too noisy for full-on concentration.

What do you wish you could change about your work?

I never have enough time to try all the things I want to try out. There is always a burning issue or a deadline to hit when you have found a new method that you want to try out, or a new service in Azure (there seems to be a new one every week). I’d love to just play with the new/shiny all the time but sometimes you’ve got to actually do some work.

Using PowerShell’s Test-Connection and Test-NetConnection Cmdlets

ThePowerShell Test-Connection and Test-NetConnection cmdlet are the new way of pinging remote computers but we’ve still got good ol’ ping.exe.

Pinging a device is a basic skill of any ‘IT Pro’, and we all know the Ping.exe command but have you heard of the ? It’s PowerShell’s way of reinventing the old-school ping.exe command.

Pinging a computer is really easy to do in PowerShell but there are a set of options that really make it useful, and take it way beyond what ping can do.

We could just use Invoke-Expression to call the ping.exe but this is just putting lipstick on a pig.

ping.exe

Yeah, this works, and we’ll get the normal ping results back of course, but it’s a bit clunky and all we get is the text output from the ping command, so let’s use the native PowerShell cmdletTest-Connection instead.

PowerShell Test-Connection

That’s a much more native way of doing it in PowerShell, and it returns an object rather than just the text output of ping.exe.  So, if we pipe the object coming from the PowerShell Test-Connection cmdlet into Select * we get a mass of useful information.

PowerShell Test-NetConnection

Like any good PowerShell cmdlet we have switches so we can set things like Count for the number of attempts, BufferSize for the size of the packet and Delay to define the delay between each attempt.

There are a lot of other switches of course, and I’m not going to go through them all but there are some that are really useful like Source.  This makes it possible to use the PowerShell Test-Connection cmdlet to connect to other machines on your network and initiate connection attempts from there.

Using Source Test-NetConnection

The output shows all the results from the hosts in the source list, in one nice neat table (object).  This is especially useful if you have a complicated network with lots of firewalls between you and the target.  As long as you can get to those source machines then you can test any of the connections from there.

The Quiet switch goes the other way and gives a really simple true/false result.  This is super useful when using it in If statements.

PowerShell Test-Connection Quiet

If you have a lot of targets to test then the AsJob parameter might be useful for putting the list to a background job and getting the results using Get-Job | Receive-Job.

PowerShell Test-Connection AsJob

Test-NetConnection

Another cmdlet to look at is Test-NetConnection.  The Test-NetConnection cmdlet can test the connection to a device much like the PowerShell Test-Connection cmdlet but it’s a little more networking focused.  In the simplest sense, it gives much the same results.

Again this cmdlet has a load of really useful parameters like Port to test whether a remote port is open or not.

With the TraceRoute parameter we can do the same as we would with Tracert.exe, but the output is a PowerShell object with each of the hops on the route to the target.

Again, if we want to use PowerShell cmdletTest-NetConnection in an If statement to test if a device has port 80 open we can use the -InformationLevel Quiet parameter and value to give us a simple true/false result from the test.

Whether you choose to use the PowerShell Test-Connection cmdlet or Test-NetConnection cmdlet, we’ve got you covered!

How to Copy Files Using BITS and PowerShell

BITS PowerShel

Using BITS with PowerShell is a great way to copy files because you get the best of both worlds. BITS doesn’t care if the network connection drops or if the machine restarts, it will just wait patiently until it can connect again and start from where it left off. So you can leave the job to do it’s thing and know that the file will get there in the end. This is especially useful if you have to regularly upload logs from a client/laptop because the job will just keep going until the file is transferred.

By leveraging BITS with PowerShell, you’re able to seamlessly integrate BITS transfers within your PowerShell scripts which makes for a pretty powerful combination!

Creating a BITS job with PowerShell

To create a BITS job with PowerShell you just need to use the Start-BITSTransfer cmdlet and give it the source and destination. This will create the job and start copying the file right away.

The -Asynchronous switch makes it run in the background so you don’t need to watch the progress bar. You can leave this off if you want to watch it run, but it’s perfect for when you are scheduling a copy job etc.

If you are copying lots of files it’s worth thinking about the -DisplayName switch so that you can spot the job in the list.

Finding BITS jobs with PowerShell

To find BITS jobs, just use the Get-BitsTransfer PowerShell cmdlet. Notice the DisplayName of the job is there because we specified it with the switch.

And if we pipe this into Select * it gives you all the attributes for the job.

Notice this shows the status of the BITS job and the BytesTotal/BytesTransferred. In this case, the BITS job has finished, but the job still exists in the list. This means that we can still see all the details of the jobs and we can even add more files to it and it will start transferring those as well. We do this by piping the job into the Add-BitsFile PowerShell cmdlet, and specifying the files we want to add.

Pausing and restarting a BITS job with PowerShell

If we need to pause the job halfway through and start it up later we can use the Suspend-BitsTransfer and Resume-BitsTransfer cmdlets.

Removing BITS jobs with PowerShell

If we want to close down the jobs once they are done with, we can use the Complete-BitsTransfer cmdlet and they will disappear from the list once they are complete. Either pipe the job to it or the list of jobs.

If you are often uploading large log files or client logs, using PowerShell and BITS can be a great way to do this!