Lessons Learned

My drop-site for interesting snippets and tips. If it's useful to you as well, great!

Active Directory - Creating Install From Media dump

function Backup-ActiveDirectoryIFM { param ( [string]$IFMPath, [switch]$NoDefrag ) $errorAction =...

Date: 12/01/2015

Converting Whitespace-Indented Output to XML

Example of taking output delimited by indents and trying to beat it into XML. 1 2 3 4 5 6 7 8 9 10...

Date: 11/20/2015

Moving Computer AD Objects

I'm just going to toss code up here from now own. Too busy to write nicely-formatted posts....

Date: 11/19/2015

IE, ADFS, and Overkill

I do some testing that requires I not use Active Directory Federation Services (ADFS), which is an...

Date: 07/20/2015

Backing Up BitLocker Keys to OneDrive as a Scheduled Task

While I can’t say I love Bitlocker, I do understand it as a requirement for any machine with...

Date: 05/18/2015

Configuring the ISE

I tend to flatten my laptop about once a season. Among the other things I lose is my PowerShell_ISE...

Date: 02/17/2015

Left-Padding a String

I’ll be honest; .NET has more methods and classes and properties than I can shake an idiom at. In my...

Date: 02/16/2015

One-Liner: Left-Padding a String with Zeroes

Yesterday’s post had a little bit of sleight-of-hand involved.  For the IPv4 address to UInt64...

Date: 02/12/2015

IPv4 Addresses and CIDR Fun

Classless Inter-Domain Routing is the current way to define a subnet.  An example entry would...

Date: 02/11/2015

PowerShell ISE Environment Keyboard Shortcuts, Part 2

A coworker asked how many of these shortcuts I knew. Given that I had to go looking for a shortcut...

Date: 02/10/2015

PowerShell ISE Environment Keyboard Shortcuts

It started with a simple question: is there a shortcut to go to the Console Pane in the ISE?  A...

Date: 02/09/2015

$PSModuleAutoLoadingPreference and You

This is a very simple onelner.  The problem statement is a more complicated. PSH 3 and 4 treat...

Date: 09/02/2014

Filtering Show-NetIPSec Rules based on IP Address

Get-NetIPSecRule seems a little half-baked.  A coworker asked me to come up with a way to only...

Date: 09/01/2014

Importing Azure RDC Files into RDCMan.exe’s RDG

This is really over-engineering.  Azure’s “connect” link sends you a .rdc file to download or...

Date: 08/19/2014

Namespaces, Why Does It Always Have To Be Namespaces?

I’ll be honest, I LOATHE namespaces in XML.  I haven’t seen a case where I needed to use them...

Date: 08/18/2014

Backing Up BitLocker Recover Key (Strikes Again!)

Here’s a one-liner for backing up the BitLocker Recovery Key for every drive attached to the...

Date: 08/15/2014

SkyDrive, OneDrive, Let’s Call the Whole Thing Off

(Apologies to Istanbul (Not Constantinople) by Jimmy Kennedy and Nat Simon.) We all know about...

Date: 08/13/2014

$PSBoundParameters and CommonParameters (-WhatIf, -Debug, etc.)

For the longest time, I was unable to get $PSBoundParameters to work to detect –Debug, -Verbose,...

Date: 08/12/2014

I Hate Write-Host So Much…

Write-Host is evil. It’s just plain evil. In fact, it’s so evil that I learned to make a proxy...

Date: 08/11/2014

YOMER Yet One More Error Reporting (Method)

I wrote about creating an Out-Error function before to avoid outputting the stack dump that a normal...

Date: 08/07/2014

Subshells (by the Seashore?)

Yesterday’s post detailed some frustration I encountered running PowerShell in a subshell.  Why...

Date: 08/06/2014

Send-Keys

Firstly, I am standing on the shoulders of giants.  As the comments below state, the essential...

Date: 08/05/2014

Decrypting SecureStrings (Once More!)

[PSCredentials] have some interesting methods. Chief among them, at least for today, is...

Date: 08/04/2014

One-Liner: PowerShell Tools for Visual Studio 2013

Unsure if I posted this already, and sorry if I did....

Date: 07/30/2014

Starting Elevated PowerShell Windows

There are a few commands I have to run from Elevated PowerShell windows (such as suspending...

Date: 07/28/2014

Creating Local Users

I’m helping some of our test teams more and more.  In one case, we need to create local users...

Date: 07/24/2014

Querying WMI with a Timeout

This is thanks to my coworker Keith Munson, who is at least as passionate and adept at PSH as I am:...

Date: 07/23/2014

Storing SecureStrings Machine-Independently

As part of a brown bag, I extracted out the logic CredLocker uses to store credentials.  Here’s...

Date: 07/21/2014

Comparing Performance Counters

A common TSG step is to look at some perf counter, wait n minutes, then look at it again. When we’re...

Date: 07/11/2014

Windows 7 and above support symbolic links, but the OS needs to be updated to recognize them: fsutil...

Date: 07/10/2014

Getting SRV Records with PowerShell

PowerShell leverages .NET, and .NET exposes the System.Net.Dns class, so all should be happy,...

Date: 07/08/2014

One-Liner: Valid PSH Verbs

I try to use proper PowerShell verbs, but I’m not always sure what they are (or what they do, which...

Date: 07/07/2014

MSSQL Server Error Logs

MSSQL Server error logs exist in the same folder that contains the installed server bits. ...

Date: 07/03/2014

One-Liner: Padding a Number with Leading Zeroes

I’m putting this here only because I’m tired of searching for it.  How to pad an integer with...

Date: 07/02/2014

Reinventing the Wheel: Get-WmiChildNamespace and Get-WmiChildPropertyData

I love and hate WMI.  I love how it offers the ability to access so many parts of the OS that...

Date: 06/23/2014

Copy-History – Copy a Previous Command to the Clipboard

It’s great that I can see my history with Get-History, but what if I want to edit it?  I can...

Date: 06/20/2014

Suspend-Computer (a.k.a. Sleep)

Shutdown.exe hibernates a computer, but there's no easy way to put a computer to sleep. One possible...

Date: 06/18/2014

Windows Experience Index on 8.1

Firstly, thanks to https://www.intowindows.com/get-windows-experience-index-wei-score-in-windows-8-1/...

Date: 06/17/2014

HP Power Supplies

HP servers have redundant power supplies.  SCOM will tell me which one is broken if it’s down,...

Date: 05/26/2014

#StupidProfileTrick - FunctionList

As I previously posted, my $Profile is stupidly complicated, and it adds a ton of functions. ...

Date: 05/23/2014

Something I Should Have Done a While Ago: $continue

$ErrorActionPreference is your friend.  However, ‘SilentlyContine’ isn’t, especially when it’s...

Date: 05/13/2014

8.3, the Undead Path

8.3 is a common reference to the DOS name limit of 8 characters for the filename and 3 characters...

Date: 05/12/2014

Write-Error, $Error, and Users

Write-Error is useful, but the output is intimidating for new users.  You want them to see a...

Date: 05/08/2014

VM Host

Here’s the one-liner: reg query "HKLM\Software\Microsoft\Virtual Machine\Guest\Parameters" /v...

Date: 05/07/2014

Setting Cross-Forest Passwords

In my test labs, some of the more specialized testing labs (perf, specifically) have one-way trust...

Date: 04/07/2014

Next>