PowerShell and Visio – Part 4 (Interlude)

Why mess with Visio from PowerShell? I’ve got a couple of posts with some really basic code to access things in PowerShell and it occurred to me…I probably haven’t made it clear why you might want to do this (other than that you can). So, instead of moving on to connections (which will be next, …

Continue reading ‘PowerShell and Visio – Part 4 (Interlude)’ »

PowerShell and Visio Part 3 – Drawing Shapes

This is part 3…if you haven’t read part 1 or part 2 you probably want to go back and read those. Now that we’re all up to speed, I promised I’d talk about drawing shapes in Visio. We’ll start with an easy one. Drawing Circles and Rectangles Remember that you have to open Visio with …

Continue reading ‘PowerShell and Visio Part 3 – Drawing Shapes’ »

PowerShell and Visio Part 2 – First Steps

Last time I talked about Visio and PowerShell and told you (in broad strokes) what I wanted to get done.  Now we’ll actually get started! Starting Visio from PowerShell To open the Visio application from PowerShell in order to start manipulating it, you need to use the appropriate COM class.  The code looks like this: …

Continue reading ‘PowerShell and Visio Part 2 – First Steps’ »

PowerShell and Visio Part 1 – Introduction

I’ve been playing around with Visio and PowerShell for quite a while now and the experience is something of a mixed bag.  My first thought was to use PowerShell to build integration diagrams, reading server names, domains, VLANs, and datacenter locations from a database, and adding color-coded connections to show the network connection requirements (e.g. …

Continue reading ‘PowerShell and Visio Part 1 – Introduction’ »

7 Ingredients of Professional PowerShell Code

If you’ve been using PowerShell for any amount of time you’ve probably written a lot of code. Here are some guidelines I’ve come up with for what I consider “Professional” code. I should note that I’m assuming some basic things like correct verb-noun naming, commented code, reasonable variable names, etc. Also, the code should work! …

Continue reading ‘7 Ingredients of Professional PowerShell Code’ »

PowerShell Code Smell: Invoke-Expression (and some suggestions)

Code Smells I’ve mentioned code smells in this blog before, but to recap, a code smell is a warning sign that you might be looking at bad code (for some value of bad).  Code smells are more like red flags than errors.  Some classic example of code smells are very long functions, lots of global variables, …

Continue reading ‘PowerShell Code Smell: Invoke-Expression (and some suggestions)’ »