Of Computers and Mice

Announcing ConnectWiser

I’ve been using ConnectWise Control for years and its great. But the lack of any published API or Plug-and-play PowerShell module for it has really put a damper on my experience. Its time to change that with ConnectWiser. The Past ConnectWise Control (CWControl, Control, or just CWC) is awesome. It’s cheap. It’s lean. Its vulnerabilities get resolved in a timely manner. Oh, and did I mention that it’s freaking powerful? Seriously, I love CWC.

PowerShell Journeyman - PSObject

Introduction In traditional trades, the Journeyman (often called Jman) is someone who has experience and can get stuff done effectively. They will forsee problems and adequately protect assets (especially coworkers) to keep things running smoothly. My expectation is that before you can be a “PowerShell Journeyman”, you should have experience with many aspects that can help your projects get done quickly and effectively. This entry deals with taking advantage of the PSObject intrinsic property.

Building Better Flagged Enums in PowerShell

Building Better Flagged Enums in PowerShell Look, this isn’t a common thing. But sometimes you need it, and this post is to help you understand what’s going on. Time to dive in! Enums and Flags Do you already know what an enum in powershell is? Its like of like a cross between a class and a hashtable/keyed dict. Enums are great for STATIC conversion of strings to values for things like configuration options.

Export Ditto Clipboard Manager to Files

Background I wanted to export data from my Ditto clipboard manager database. Process I found that I could use the PowerShell module ReallySimpleDatabase to iterate through the rows in the table. But the images were not a valid file format when I saved the byte stream to disk. Turns out, BMP files on disk have an additional couple bytes that BMP files in memory don’t have. Check it out: http://nickbriz.com/databending101/bmp.html

Constrained Language Mode and Powershell Core

Background At work, we use Software Restriction Policies to prevent stupid malware or users from running stuff that really shouldn’t be run. Recently, a coworker was trying to use PowerShell Core for the first time and couldn’t figure out why he was unable to install modules or run things like [math]::Round(2.1). I had to do a little digging to figure out the exact cause and fix it for him. History of Language Modes in PowerShell PowerShell v3+ has had language modes to help reduce your organizational attack surface.

Generating a Timesheet with PowerShell

Background A user recently asked how they can make a timesheet with PowerShell. They wanted to be able to specify the hours each day and the days that are included. I figured that PowerShell is a PERFECT solution for that request. Quick and Dirty Proof of Concept Looking at the basic code that they were tinkering with, I created this very barebones PoC: $date =Get-Date $date = $date.Date $monday = $date.

Auditing Expressions Part 2

Background In this post, I shared a cool proof of concept that would allow you to view the code used to create results, along with the basic components broken down that were used. But it turns out that only very simple expressions could be operated against. If I had any sub-expressions like this: ($one + 2) * 3, things would break because of the parenthesis. E.g. if it splits by operators for math (+-*/), then it would try to execute the expression ($one and 2) and 3.

Deep Object Comparisons

Background I was recently asked (at least, that’s what I chose to respond about) how you could do a deep comparison of objects (especially in 2 arrays) in PowerShell. The problem is that most built in ways (Linq, Compare-Object) will only work for objects that are only 2 layers deep. Further layers of depth will just .ToString() and not be counted in the comparison. I encountered a similar situation when I was making a DSC-esque way to manage Discord application commands (which can have MANY layers of objects via options and embeds).

Auditing Expressions

Background Working for a bank, there is one rule about how things should be done: Auditing, Auditing, Auditing. They like to know what happened. They like to know when it happened. They like to be able to look this data up after the fact, sometimes much later. We run a certain process on Azure Functions that takes input data from our servicing providers and adds calculations depending on various things: rates, history, etc.

Building a Discord Bot in PowerShell and Azure Functions

Background I like using Discord to accomplish stuff. But I’m no programmer. That leaves me with little space to operate in; making a Discord bot is hard™. I’ve made some scripts for my own usage that integrate with Discord bots, but they’ve always been for my own use only. However, my April Fools Day guild is chasing through a pre-gameday challenge and needed a Discord bot that would lookup/return tinyurl links.