PowerShell: Logging in JSON format
· ☕ 4 min read · ✍️ Brett Johnson
When writing scripts for clients, it';s important to generate good logs. It';s a common position where a script works perfectly in test. But in production something is askew. Being able to look back at the process and step through after the fact is essential. Usually my logs are written in CSV format. CSV is great for parsing. But, it';s awful to run in a text file. Due to this, I decided to modify my log function.

Discover and Clear Admin Count Attribute with PowerShell
· ☕ 3 min read · ✍️ Brett Johnson
What is Admin Count? Before we discuss Admin Count, a little background is needed. AD contains an object called AdminSDHolder. Its purpose is to protect objects. Specifically, objects which are members of administrative groups. AD objects have an attribute called “Admin Count”. The default value is for most objects. Changing the value to “1”, flags the account as protected by AdminSDHolder. By adding a user to an administrative AD group. You change the value to “1”.

PowerShell Script for Data Migration
· ☕ 4 min read · ✍️ Brett Johnson
I recently needed to create a script for the purpose of migrating data. Due to complexity, a number of scripts were used. This post covers the script I created to remove illegal characters from directory names. Also adjusting for new directory paths. Migration Overview The migration had some quirks. Due to this, a simple A to B move wasn';t an option. There was some restructuring and many folders were not to coming across.

Default to PowerShell in Windows Core
· ☕ 1 min read · ✍️ Brett Johnson
One of the big pushes in Server 2012 is the use a Server Core installation instead of the full GUI install. Microsoft have put a lot of effort into encouraging administrators to use PowerShell as a core tool for day to day administration of servers, which is why is seems a bit strange that a Server Core installation boots to a traditional command prompt instead of a PowerShell prompt. To change your Server Core installation to launch PowerShell instead of the normal Command Prompt is a simple registry change.