Tommymaynard.com
709 FOLLOWERS
Tommy Maynard is a Windows PowerShell enthusiast with over 15 years of Information Technology experience. In the last few years, it finally feels like Tommy has found his calling within the industry. His goal is to help educate and inspire people that work in his industry to embrace PowerShell, and in general, scripting and automation. He's not a developer or programmer; he's just a..
Tommymaynard.com
6M ago
The below PowerShell can be used to extract LAPS Passwords and BitLocker Keys from Active Directory. This was written on Friday, July 19, 2024, due to the CrowdStrike Outage: https://www.nytimes.com/2024/07/19/business/microsoft-outage-cause-azure-crowdstrike.html. If you choose to test this PowerShell, ensure that you update the argument for the SearchBase parameter to reflect your Active Directory domain.
function Get-LapsAndBitLocker {
# Version 1.0.1
Get-ADObject -Filter {objectclass -eq 'msFVE-RecoveryInformation'} -SearchBase 'DC=domain,DC=com' -Properties msFVE-RecoveryPasswor ..read more
Tommymaynard.com
2y ago
The best part of this entire process—the writing about PowerShell for coming up on nine years—has been the realization of my own mistakes while using PowerShell, and then sharing those. I have an upcoming post on this, but in between preparing and publishing that, I, yes me, made another mistake.
Let’s start with what I wrote first, which is included below. It’s a simple Get-ADComputer command. By now, we’ve all likely written plenty of these. Looks great right? Does it though?
Get-ADComputer -Filter * -Properties OperatingSystem,Description |
Where-Object -Property OperatingSystem -like ..read more
Tommymaynard.com
2y ago
Sometimes I write something—as in some PowerShell—and I feel like, while I don’t need it right now and here today, I should put it somewhere. I just found a screenshot where I did that. Maybe it’ll help someone, and posting it here on my site will likely allow me to find it when I’ll need it, versus looking around on random computers for random screenshots. I would’ve never found this image were I actually looking for it.
I must’ve wondered, can I embed both a hash table and an array in a hashtable? I can. First, however, let’s start with a single, simple array, and a single simple hashtable ..read more
Tommymaynard.com
2y ago
I started writing a PowerShell function to replicate the work of an old executable called ICSWEEP. ICSWEEP “is a command-line utility to clear the Temporary Internet Files Cache and/or the TEMP files folder of ALL user profiles that are NOT in use when this command is executed.” ICSWEEP Information. I may or may not walk through the process of writing this function here; it’s to be determined. What I do want to discuss for sure, however, is the last switch in the above image. It’s /?.
We cannot add ? parameter to a function. Below is an image of the message when we attempt to do tha ..read more
Tommymaynard.com
2y ago
I determined something on Friday that I’m not sure I’ve needed before. I need to know which date in an array of dates, is the most recent—think the maximum value of the values in the array. Before we get to dates, let’s work with some simple-to-understand numeric values first.
In the below example, we’ll create a variable $Numbers and assign it five, out-of-order numerical values. Without much work, it’s easy to visually parse and determine the lowest value (the minimum value), and the highest value (the maximum value). One is the lowest and five is the highest.
$Numbers = 1,3,5,2,4
($Numbers ..read more
Tommymaynard.com
2y ago
It was just Saturday—it’s been a few weeks now, actually—that I wrote a post proclaiming to be back. Back to writing about PowerShell, that is. Why not take the first script I wrote in my new position and share it? It’s possible it has some concepts that might be helpful for readers.
The first thing I want to mention is that I hate writing scripts. Huh!? What I mean by that, is that I prefer to write functions. That didn’t happen my first time out in this position, as you’ll see, and I’m going to be okay with it. A one-off script may have a purpose. I stayed away from a function (and therefore ..read more
Tommymaynard.com
2y ago
After 20+ years, and 5+ positions in education (K-12 and higher ed), I’ve taken a new position. It’s still Information Technology at the end of the day, but now I’ll be working in the healthcare industry. There’s plenty of reasons to be excited. One is that I’ll be better positioned to use my PowerShell and automation skills again. Two, I’m moving from an employer that’s AWS-focused to one that’s Azure focused. What an amazing opportunity! I ventured into Security Engineering, but now it’s back to Systems Engineering for me. It was a great experience and opportunity, but like any new position ..read more
Tommymaynard.com
2y ago
I’ve done this eight years to the month. I’ve taken my passion for PowerShell and written about it. I desired to play a role between PowerShell and its concepts and you, the reader. I’ve written for myself in some ways, to better remember concepts and to create a collection of code I might come back to again. But I’ve done more than just that.
I’ve fallen in love with writing. Again maybe. While this isn’t my normal every week post, I’m going to take advantage of this little platform that I’ve created for myself, and share, not about PowerShell, but about my desire to write. Maybe you know so ..read more
Tommymaynard.com
2y ago
Posts in this Series
It Begins – Azure with PowerShell I
Accounts – Azure with PowerShell II
Accounts Continued – Azure with PowerShell III
In the last post, we took a look at the Connect-AzAccount command, stored its output in a variable using the Outvariable parameter and explored it. I think we ought to go through a few of the other commands in the Az.Accounts module and see why we didn’t need to dig in such as we did. As I said previously, it was a good exercise, but it’s almost like the cmdlet developers wanted to provide us with an easier way to gather Azure account-related informatio ..read more
Tommymaynard.com
2y ago
I read a recent post on the technical writing subreddit, “How proficient in coding do you have to be to write API Documentation?” I jumped in and posted, as technology is my jam, and writing is my passion. Maybe it’ll be my jam too, someday.
The author wanted to know if they need to know how to program to make use of an API—an Application Programming Interface. I don’t think so. I have well over 10 years of learning and working with PowerShell, and I don’t think anyone needs that to use an API. Maybe there will be a few things to learn, but not all of it. Why would you even want to focus on o ..read more