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 =...

Author: timdunn 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...

Author: timdunn 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....

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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,...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn Date: 08/07/2014

Subshells (by the Seashore?)

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

Author: timdunn Date: 08/06/2014

Send-Keys

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

Author: timdunn Date: 08/05/2014

Decrypting SecureStrings (Once More!)

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

Author: timdunn Date: 08/04/2014

One-Liner: PowerShell Tools for Visual Studio 2013

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

Author: timdunn Date: 07/30/2014

Starting Elevated PowerShell Windows

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

Author: timdunn 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...

Author: timdunn 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:...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn Date: 07/11/2014

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

Author: timdunn 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,...

Author: timdunn 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...

Author: timdunn Date: 07/07/2014

MSSQL Server Error Logs

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

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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/...

Author: timdunn 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,...

Author: timdunn Date: 05/26/2014

#StupidProfileTrick - FunctionList

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

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn 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...

Author: timdunn Date: 05/08/2014

VM Host

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

Author: timdunn 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...

Author: timdunn Date: 04/07/2014

Next>