Use PowerShell to Send All Regex Matches to a New File

Yesterday I had to look at a list of stuff on a third-party website and match it up to a list of stuff we control. It took quite a bit of time and some Excel shenanigans to complete the task and as I know it’s going to crop up again, I decided to employ PowerShellContinue reading “Use PowerShell to Send All Regex Matches to a New File”

Turn an Old Phone into a Programmable Keyboard

It seems like everyone has a high-quality, expensive, programmable deck on their desk these days. Elgato’s Stream Deck, with it’s glowing LCD buttons, comes in flavours that cost between £100 and £200 (depending on how many buttons you want). It’s beautiful bit of kit that glows its way into the hearts of tech geeks everywhere.Continue reading “Turn an Old Phone into a Programmable Keyboard”

Run Multiple PowerShell Scripts from a Master PowerShell Script

Having put together some individual scripts that ripped data out of an Excel spreadsheet, I decided to co-ordinate them with a master PowerShell script that would contain my variables and call out to neat little scripts to do work. PowerShell gets tricky to read when it gets big, so I prefer to have a coupleContinue reading “Run Multiple PowerShell Scripts from a Master PowerShell Script”

Extract an Excel Column to a Text File with PowerShell

Having opened up the same Excel spreadsheet to copy out a list of domain names into a text file for my test automation tools to consume for the third time, I wrote a PowerShell script to do it for me. Yes, it’s the same spreadsheet I mentioned before, it is full of interesting data andContinue reading “Extract an Excel Column to a Text File with PowerShell”

Copy Excel to CSV with PowerShell

Having opened up the same Excel spreadsheet to save the data as a CSV for the third time, I wrote a PowerShell script to do it for me. Simply set the source and destination files and the script takes care of the rest. & { $sourceFile = “C:\Temp\data.xlsx” $outFile = “C:\Temp\data.csv” $excelApplication = New-Object -ComObjectContinue reading “Copy Excel to CSV with PowerShell”

Use PowerShell to Count the Number of Elements in XML Files

I needed to know how many pictures were being sent in a collection of XML documents, so I wrote a PowerShell script to count the number of picture elements. The element I’m looking for is in the $element_xpath variable. The example below is any picture element, anywhere in the document. You could limit this byContinue reading “Use PowerShell to Count the Number of Elements in XML Files”

Update Work Items with Build Number During vNext Builds

In the days of XAML Builds in TFS, the build would rather handily update the work item with the appropriate “Integration Build” value… so you knew which release would include your fix. Happy days. Along came vNext builds in TFS / Visual Studio Online / Visual Studio Team Services, which solved all of the painContinue reading “Update Work Items with Build Number During vNext Builds”

Run a Console Application With PowerShell

I have a DbUp console application that needed to be executed with PowerShell (in my case via Octopus Deploy – but this works in any case), but I wanted to be able to get the result when executing it. By default, running the “Database.exe” from PowerShell will open a new console window for the applicationContinue reading “Run a Console Application With PowerShell”

Script SQL Server Backup with Batch Files and PowerShell

This is not our preferred method of deployment, but we have some batch-file based deployments still in active use (most of our deployments are executed via Octopus Deploy, but some of the concepts below are re-usable there too). One of the tasks we perform during a deployment is a database backup prior to schema changes.Continue reading “Script SQL Server Backup with Batch Files and PowerShell”