PowerShell: A Simple Batch Processing System, Part 2

This is the next part detailing how the script here works.  The first part detailed the rough design of the script and the main function that creates the transaction objects that are passed through the script.

This part adds some sample Task functions and the main body of the script to kick it all off. Continue reading “PowerShell: A Simple Batch Processing System, Part 2”

PowerShell: A Simple Batch Processing System, Part 1

batchHi.  I’ve written a few scripts that have gotten to be quite large.  In all cases they’ve needed to make a series of changes to a set of objects and log the results.  It’s normally important that some of the later changes only get made if the earlier ones are successful;  for example only changing the default SMTP address on a mailbox if another SMTP address was added earlier.

This series of posts will go into a decent system I’ve found for accomplishing this with some skeleton examples that are (hopefully!) easy to adapt. Continue reading “PowerShell: A Simple Batch Processing System, Part 1”

PowerShell: A Simple Batch Processing System

This is the skeleton of a Batch Processing System (Importing from a CSV file, performing consecutive tasks that are dependant on the previous task completing and then outputting the result).

I detailed how it works in Part 1 here and in Part 2 here. Continue reading “PowerShell: A Simple Batch Processing System”

PowerShell: Converting PDF Bank Statements to PDF

I wrote some very quick and dirty code to import American Express PDF statements to CSV here.  I could export the PDF to TXT and then process the text file with PowerShell.I had to revisit it the other day as I had a raft of PDF statements to convert and import into YNAB (and not just from AMEX).

Of course, all the bank and credit card vendors use a standard PDF format for statements so it was easy.

Right?

No, actually pretty much everyone just does their own thing.  And by ‘own thing’ I mean PDFs that are not even consistent within themselves.

So:  the joy of regular expressions. Continue reading “PowerShell: Converting PDF Bank Statements to PDF”

PowerShell: Fixing “Windows could not connect to the Group Policy Client service”

My wife got this error the other day on her Windows 10 machine when trying to login.  After a bit of digging, it seems it’s not unheard of but there’s no clear answer about why it happens (It’s a corrupted / missing set of registry entries.  The cause could be a bad shut-down, crash, interrupted update or pre-cursor to Martian attack.  Who knows.)

I found a good site that provides a solution. To fix the issue you need to create a registry sub-key and value (confusingly, both of the same name) and a pair of values under the sub-key you just created. That cures the problem but there’s no more information about to how to prevent it happening again.

In lieu of a proper preventative solution I wrote a script to perform the changes (with a bit of safety code too) so if it re-occurs I’m good to go.

Script and walk-through after the line. Continue reading “PowerShell: Fixing “Windows could not connect to the Group Policy Client service””