Last week I was seeing what else I could add to my Windows Terminal setup. If you can launch a console from the command line, you can probably create a Windows Terminal profile for it. Recently, I’ve added Ruby and Python to my desktop, both of which have interactive consoles. I thought, “Why not add…
Tag: Scripting
Tracing PowerShell with WPF
Back in my VBScript days, I had a script that would use Internet Explorer as a trace window. My script could run and messages would be written to an IE window. This was a handy way of separating debug or trace messages from the command output. When PowerShell came along I revised it. But IE…
Distinguished Parsing with PowerShell and Regex
The other day I’m chatting with my friend Gladys Kravitz about Active Directory and she makes an off-hand remark about parsing out organizational unit names from a distinguished name. On one hand, this is a pretty simple task, assuming a proper distinguished name from the Active Directory cmdlets. All you really need to do is…
Active Directory Objects and the PowerShell Pipeline
This article is something I’ve been meaning to write for sometime. As often as I tell people PowerShell is easy to use once you understand its core concepts, that isn’t always the case. This is a problem my friend Gladys Kravitz brought to my attention some time ago. Like her, you probably have written a…
Updated PowerShell Tools
I’ve released a new version of my popular PSScriptTools module, which you can install from the PowerShell Gallery. The module is collection of commands and tools that I use in my scripting and day-to-day work at a PowerShell console. Many of the commands run in Windows PowerShell and PowerShell 7, even on non-Windows systems. I…
Friday Fun – A PowerShell Nonsense Challenge
Today I thought I’d share my PowerShell solution to a recent Iron Scripter challenge. The challenge was to create PowerShell code that would create nonsense documents, with a goal of creating 10 sample files filled with gibberish. Yes, other than maybe wanting some test files to work with, on its face the challenge appears pointless. …
Formatting PowerShell TimeSpans
I often will figure out how to do something and later struggle to remember how to do it a months later. Rather than trying to remember what piece of code I wrote, why not write about. Assuming I can remember! Anyway, here’s today’s “PSRemembery”. I often use code like this, and I expect many of…
Solving the PowerShell Object Age Challenge – Part 2
The other day I shared part of my solution to an Iron Scripter challenge to write a generic function to report on the age of an object. The idea being that you could pipe any type of object to the function and get a result. And because I can’t help myself, I went a bit…
Solving the PowerShell Object Age Challenge – Part 1
A few weeks ago, the Iron Scripter site posted an interesting challenge about writing a generic function to get the age of objects. Many things that we deal with in PowerShell have an “age” such as files, processes or even AD groups and users. I think this is an especially useful exercise because it forces…
Show ANSI Samples
Earlier this week I did a live session for the PSPowerHour. I talked about ways to dress up your PowerShell work and console sessions. One of things I talked about was using ANSI escape sequences to add some color. What I realized was that I was constantly referring to my reference source at https://en.wikipedia.org/wiki/ANSI_escape_code. That’s…
Solving the PowerShell Counting Challenge
A few weeks ago, an Iron Scripter PowerShell scripting challenge was posted. As with all of these challenges, the process is more important than the end result. How you figure out a solution is how you develop as a PowerShell professional. A few people have already shared their work. Today, I thought I’d share mine….
PowerShell Word Play
A few weeks ago an Iron Scripter PowerShell challenge was issued that involved playing with words and characters. Remember, the Iron Scripter challenges aren’t intended to create meaningful, production worthy code. They are designed to help you learn PowerShell fundamentals and scripting techniques. This particular challenge was aimed at beginner and intermediate experience levels. I…
Friday Fun with PowerShell and ANSI
Ever since PowerShell 7 came along, I’ve been having a lot of fun exploring what I can do with ANSI color escape sequences. And actually, even in Windows PowerShell you can use them. Although you need to use a different escape character. Run Get-PSReadlineOption to see what I’m talking about. Today I have 2 quick…
A PowerShell Network Monitor
I hope you’ve been trying your hand at the scripting challenges being posted on the Iron Scripter website. The challenges are designed for individuals to do on their own to build up their PowerShell scripting skills. A few weeks ago, a challenge was posted to create a network monitoring tool using PowerShell and the Write-Progress…
A PowerShell Remote Function Framework
The other day I shared a PowerShell function to query the registry on remote computers to find installed versions of PowerShell. The function leveraged PowerShell remoting with the flexibility of using a computer name with an optional credential or existing PSSessions. The more I thought about it, the more I realized that the structure could…