Get DistinguishedName from CanonicalName

There was a topic came up in the Powershell Slack earlier this evening to see if there was a way to convert the CanonicalName from Active Directory to a DistinguishedName

I had a quick google figuring that something like that must have been done already but a quick google didn’t find anything that seemed to do the job.

There was a TechNet Script to go from DistinguishedName to CanonicalName but since that was removing content it was slightly simpler to do with string splitting and regex.

Crack Open The Regex ❤

I decided about 12 - 18 months ago that I was going to double down and force myself to learn Regex. This is a prime example of something you can play with so that was my first port of call.

Read More …

Microsoft Teams PowerShell Module is now Generally Available

I have been playing with the Microsoft Teams module for quite some time and undeniably, even though it wasn’t GA, it was disappointing and often required lots of wrapper functions for what I would have expected to be native functionality.

Now that it’s General Availability let’s see what changes have been made

Read More …

PowerShell Core & Docker Test Environment

So I recently had a requirement to run some scripts in an isolated environment where I didn’t want to test on my machine but throwing up an entire pipeline was overkill and frankly not needed for the basic testing that I wanted to do.

I had used docker before but not for a long time and I didn’t really grasp it properly the last time I tried and reality did not meet expectations. Now that I predominently live in the console in one way or another I figured why not!

Read More …

Setting up VsCode For Productivity

WARNING! - LONG POST ALERT

Visual Studio code has quickly become the tool of choice amongst developers and system admins due to it’s flexibility of dealing with most scripting/programming languages you can throw at it. The fact that it is cross platform and is now being actively developed in preference to Powershell ISE means that it’s hard to ignore such a brilliant editor.

I have posted a few things on Twitter in the past showing some tips or techniques and they always seem to be very well received so I thought I would outline some of the more detailed things I use which benefit me when writing Powershell.

Read More …

Building a Test Lab with Lability

Any system administrator that has dabbled with PowerShell will have likely started by running commands against a production Active Directory domain. This is generally because the production AD domain is all that is available to them. I have worked places where a replica test AD forest was configured but it was laborious to maintain and in most cases was more peace of mind than actually replicating production.

So you tell yourself:

You’re fine just running Get commands as you can’t break anything

Read More …

Split a SubFolder into a New Repository

So I recently encountered an issue where I needed to extract a number of subfolders out of a Git repository so I could move them into their own repository/project.

I am no git expert and easily and quite frequently end up in a git mess so I took to the Powershell Slack to ask the more knowledgable folk there to see if anyone had already done it. I figured it was possible as most things are possible with git but easily achievable is another thing

Read More …

GitOps - Git For Ops People

I want to show you that even as someone who works solely in Ops or Support, embracing Git as a tool will save you time, effort and it doesn’t have to be as complicated as it first seems.

If you answer Yes to any of the following then this blog post is for you:

Git seems daunting, why do I need to learn new software when what I currently do works?

I’m not a developer so why do I need developer tools?

I’m the only one that uses these scripts, so is there any point?

My scripts are only 20 lines long, why do I need source/version control?

Read More …

PSDay 2018

I’m sat on the train back from London after PSDay 2018 reflecting on what was a really good conference, the sessions, the speakers, learning about topics that you wouldn’t necessarily have exposure to but most of all the conversations, sharing of ideas and spending time with attendees who are enthused about PowerShell and technology.

Read More …

Converting Images to Video & GIF with FFMPEG

At my previous place of work I was asked to look into the feasability of adding a timelapse options to our service catalogue so that we could consolidate 3rd party usage and save money.

Different Suppliers = Differing Costs and Varied Results

So as a company we were using different companies who all provided different equipment, different support models and services which then yielded different results on the output. So I started looking at how we could procure the equipment and provide a better service as standard utilising some existing infrastructure and some automation.

Read More …

Inheriting Preference Variables into Scriptblocks

So I recently created a module to using Powershell sessions to invoke commands on remote machines.

Preference Variables not inherting from Parent Scope

I hit an issue during testing and was trying to diagnose the issue so I added some Write-Verbose commands to assist with this except the verbose preference was not inheriting from the parent scope.

Read More …