Last week, Adam Bertram sent out a tweet looking for any PowerShell code to notify the user when a new Active Directory user account had been created. I dug out some very, very old code that used a WMI event subscription to watch Active Directory for such an event. The code I shared was something…
Category: Scripting
Solving the PowerShell Conversion Challenge
Today let’s look at how I approached the first Iron Scripter PowerShell challenge of the year. The goal of the challenge was to convert or translate an object into a PowerShell class definition. If you are new to these challenges, the journey to how you achieve the goal is more valuable than the end result….
Get Group Policy Links with PowerShell
I was chatting with my friend Gladys Kravitz about Group Policy reporting stuff recently,. and the discussion led me to dust off some old code I had for getting Group Policy links using PowerShell. The GroupPolicy module has a Set-GPLink command, but nothing that easily shows you what GPOs are linked to your site, domain…
Answering the CIM Directory Challenge
The last Iron Scripter challenge of 2020 was a big one. If you didn’t get a chance to work on it, see what you can come up with then come back to see my approach. As with many of the challenges, the goal isn’t to produce a production-ready PowerShell tool, but rather to push the…
Deploy OpenSSH to Windows Server
Yesterday I shared some PowerShell ideas for remotely setting up the server component of ssh on a remote Windows 10 system. This would allow you to establish an ssh session to the desktop or even use PowerShell remoting over ssh. Next, we need to look at doing the same thing for Windows Servers. Windows Server…
Convert to Local Time with PowerShell
As some of you know, I host a monthly online Twitter chat on the first Friday of every month using the #PSTweetChat tag (although the January 2021 chat will be on 8 January.) We get together and chat about all things PowerShell at 1:00PM Eastern Time. The challenge for the rest of the world is…
Creating PowerShell Property Names
The last week or so I’ve been playing with a new PowerShell project from Dave Carroll for using Twitter from a PowerShell prompt. The module is called BluebirdPS and you can install it from the PowerShell Gallery. The module is very much still in its early stages but is functional and intriguing. The reason you…
Answering the PowerShell Registered User Challenge
A few weeks ago, an Iron Scripter PowerShell challenge was issued. This was a beginner to intermediate level challenge to get and set the registered user and/or organization values. These challenges, and solutions such as mine, aren’t intended to production-ready tools. Instead, you should use them as learning vehicles to advance your PowerShell scripting skills….
Better Performance Counters with PowerShell
I wanted to tell you about another addition to the latest release of the PSScriptTools module. This is something I’ve written about before but I decided to add the function to the module. I hope you find it a much easier way to work with performance counters. And it works in Windows PowerShell and PowerShell…
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…
Parsing ssh Known Hosts with PowerShell and Regular Expressions
Lately, I’ve been spending time learning more about ssh. Sadly, I’ve rarely had a need to learn and use ssh. But of course, with PowerShell 7 and ssh-based remoting, it is time to up my game. I’ve started deploying the ssh server component to my Windows test servers (I’ll write about that another day) and…
Finding Zombie Files with PowerShell
Since this is Halloween weekend in the United States, I thought I’d offer up a PowerShell solution to a scary task – finding zombie files. Ok, maybe these aren’t really living dead files, but rather files with a 0-byte length. It is certainly possible that you may intentionally want a 0 length file. But perhaps…
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…
Open Up Wide with PowerShell
A few weeks ago, an Iron Scripter PowerShell scripting challenge was posted. The challenge involved wide directory listings. Which always makes me think “open wide”, which leads me to “Open Up Wide” by Chase. (I used to play trumpet and Chase was THE band back in the day). Anyway, solving the challenge most likely involves…
Easy PowerShell Custom Formatting
One of the features I truly enjoy about PowerShell, is the ability to have it present information that I need in a form that I want. Here’s a good example. Running Get-Process is simple enough and the output is pretty complete. But one thing that would make it better for me, is that sometimes I…