Creating Helper Functions in PowerShell

Whenever you’re working in PowerShell running commands to do these things, you probably don’t think about how those commands actually work. All of the default cmdlets have a single “interface” which is the command name. To get the contents of a file, you’ll run Get-Content. To ping a computer, you’d just run Test-Connection and so on. However, when you start creating your functions and modules, you’ll soon realize that these commands are doing a lot of work under the covers for you. Lots of commands in PowerShell need a little help to work efficiently. There are times when commmands don’t just do one thing. For example, Get-Content doesn’t just “get content”. Instead, it has to find the file on the disk, open the file handle, iterate over each line of the file, close the file handle and then return the output to you. Get-Content is performing lots of actions all […]

Read more

How to Find All Processes Running Under Administrative Privileges

When it comes to security, one of the scariest situations is when you’ve got a rampant piece of malware doing it’s bidding across the network. Multiply that situation by 10 when you find out that malware is running with local administrative privileges across all of your computers. But how do you know? This malware has sneaked past your perimeter defense and your workstation antivirus. It’s clear that the security tools you’ve implemented aren’t going to stop it. It’s time to roll up your sleeves and get this done yourself with some PowerShell! First, define what you need to do. Malware is on lots of computers and you know it’s causing a lot of grief because the process it’s running under has somehow managed to run under a user account that has administrative control over the computer. We first need get a list of potential computers. In Active Directory, we can […]

Read more

How to Quickly Find Unlinked GPOs in Active Directory

Over time, Active Directory (AD) can get messy. With multiple people making changes and with such an extensive database of objects, lots of unnecessary objects are bound to be created and left behind especially over many years. One type object in AD that’s infamous for becoming out of control is the GPO. Over time, GPOs can be applied over other GPOs, be linked to organizational units (OUs) with nothing in them and other unwanted configuration that apply settings to machines no one knows where they came from. It’s time for some cleanup! Before we can clean up unwanted GPOs, we first have to define what we’d like to clean up and how to find them. For this article, we’re going to focus on unlinked GPOs. Whenever a GPO is created, it’s linked to an AD OU. That GPO’s settings are then applied to whatever objects are in that OU. When […]

Read more

Learning How to Format PowerShell Output With Format-Table

PowerShell holds a scripter’s hand quite a bit, but it can’t read your mind. It can’t inherently know what kind of output you’re looking for. It will provide its best guess, but it’s up to you to ultimately decide how you’d like output returned. PowerShell has a formatting system that has default output and the ability to change how output is formatted on an object type basis. If you’d rather not learn about XML and how to always format output in a specific way, you’ve also got cmdlets like Format-Table, Format-List and Format-Wide at your disposable. A PS1XML file on the file system or using any of the format cmdlets will display output in some different ways. Without using any special formatting, PowerShell, by default, uses its format. Whenever a specific object is returned, you’ll probably only see a limited portion of what that actual object’s contents are. For example, […]

Read more

Too Many Squirrels: Which one do I Chase?

How do I deal with being interested in so many things at once? That’s a question I ask myself all the time. I love software development; I’m interested in code. I enjoy cloud automation stuff. I like productivity tools and on and on. I’m the type with the ADHD personality where I see a squirrel and go following it. I go after every single piece of new technology that I know and discover. I had a person recently ask me, “Where do I go from my career?” He didn’t say so directly, but from the context of his email, it seemed like he was at the beginning or the middle of his career. He wanted to know where to go. I have touched this on a previous post called What Makes a Great IT Professional. I also wanted to tell him and to tell you here is that if you […]

Read more

How do I Get a Remote Job?

Remote work is a topic that’s near and dear to my heart you can immediately tell if you follow me on Twitter. Many companies still refuse to allow remote work or simply don’t understand it doesn’t mean these kinds of jobs aren’t possible! Web Resources for Remote Work I have been working 100% remotely for about three years now and mostly remote for nearly five years before that. To get in a position like this, there are a few ways that I can recommend – the first are websites. You can go to sites like flexjobs.com, weworkremotely.com or upwork.com. These sites have remote jobs, but a lot of those aren’t full-time jobs – most are contract work. It’s much easier to find remote jobs through contract work compared to full-time jobs. If you’re looking for remote contract work, your luck is going to be a lot better. But there are […]

Read more

Prepare for Greatness in 2018 with the Adam the Automator!

The Adam the Automator blog has been around for a few years now and has always been my home base but never a huge priority for me. I’ve always tried to share knowledge freely as often as possible but haven’t spent the kind of time I wanted on it. The priority simply wasn’t there because this blog didn’t make a dime. As such, I was always focusing my attention elsewhere and, in my opinion, neglecting the blog and you. That’s changing in 2018. As part of this new initiative to refocus my attention on this blog and my YouTube channel, I have already started a few new things. Blog Sponsors The first is, as you’ve probably already noticed, the banners on the right side of the blog. These are trusted sponsors that want to get in front of you guys! They will always be non-obtrusive reminders to click through and check […]

Read more

Learn to Build Tools not Code

Have you ever heard the term “code abstraction”?  The word means creating an interface of sorts around another piece of code that compartmentalizes that code. Think of it as an action or task that bundles a bunch of code up into a package which could then be used later. The concept is like a function. In PowerShell, we have the Get-Content command. When you run the Get-Content, it doesn’t just inherently know how to read a file. There’s code inside of Get-Content that finds the file on the disk, reads the file, open an object, close an object, runs a method, and so on.  But for you and I, we can just run Get-Content by providing a file path, and it just works. That’s one of the great things about PowerShell. PowerShell abstracts away a lot of the things that you don’t need. That same concept can be thought of […]

Read more

Get-ChildItem: Listing Files, Registry, Certificates and More as One

Remember the good ol’ days of the DOS dir command? How about the Linux ls command? If so, the Get-ChildItem is essentially that but taken up a notch. In fact, we even have dir and ls in PowerShell in the form of an alias. The Get-ChildItem PowerShell cmdlet can not only list files and folders on a file system via the PowerShell console or PowerShell script but can also enumerate registry keys and values, certificates in various certificates stores and even Active Directory, to name a few. To understand Get-ChildItem, first, think of it regarding dir and ls but instead of just files it treats many objects as a child item and enumerates them. You can use the alias or the full comamnd name to use it. Since this command has been available since PowerShell v1, you can be sure that it will work with your PowerShell version. Get-ChildItem Traverses […]

Read more

Falling on the Grenade for Your Team and Your Career

In your work environment, there’s typically always that legacy thing that no one wants to touch. It’s old, fragile and bound to break at any moment. Volunteer for Misery A problem crops up with this product and a junior staff member, who does not know about the history, comes around and says, “I can take this on; no problem!”. While the senior employees think he’s nuts, he goes in and amazingly fixes the problem with this legacy product with no downtime. What that junior guy didn’t know was that he’s now the proud owner. He can’t let it go even when he wants to. This junior staff might have impressed management, but now he’s at the level with the senior team. He’s bored with it and doesn’t want to own it anymore. One way or another, he fixed it last time, so he automatically knows everything there is to know […]

Read more
1 2 3 24