PowerShell: How I Got Started.
October 20, 2024•1,372 words
Being The New Guy
My first day working as a System Administrator resulted in two things. The first was being asked by some senior admins if they could refer to me by a nickname. I agreed, and had no idea how much that nickname would stick. It has gotten to the point where even higher level management and program managers refer to me by it. So my first day as an admin was also the first day the moniker, Stache, came into existence.
The second thing that occurred that day was a realization that I had no idea what I was doing. Now, at least where I work, this is actually pretty common. My team does not benefit the same way that teams on larger enterprise scale teams do. We basically have to manage everything. Whether it is active directory, linux, exchange, group policy, software configuration, remediating vulnerabilities, user management, imaging, back ups, etc. If an admin is the one to configure it or manage it, then it is guaranteed that at some point we will put our hands on it.
This is great for someone new. You get the opportunity to get hands on and build skills on so many aspects of administration. The downside is, you never really get to work with something long enough to feel like you truly understand it.
So couple that with the fact that I had no experience, at least to the degree of traditional work experience, and I felt like I was in for a rude awakening. Lucky enough for me, and at risk at sounding borderline arrogant, I have developed the ability to hit the ground running and work my ass off to build skills and knowledge.
Discovering PowerShell
I was about about three months in and I was reading and practicing anything I could. I was trying to figure out what I could do that would help me learn things at a deeper level, make my day to day easier so I could focus on learning more, and help me stick out as someone who you wanted to go to if you have a problem. I wanted to do as little "work" as possible and eventually become the Subject Matter Expert (SME).
That is when I came across The PowerShell Podcast. All I knew about PowerShell up to that point was that it was command line and it had a blue background that I hated. Anything involving a command line was foreign to me. Sure I could CD or DIR but I had no real understanding of what I was doing and even less an idea of what I could do.
As I listened to the episodes I began to realize this was something worth learning and decided to by the defacto book for starting to learn PowerShell: Learn Windows PowerShell in a Month of Lunches. I quite vividly remember sitting in my office, stuffing my face in between pages and running commands when some senior admins walked by. They asked, "Stache, you really think you're going to read that book and know what you're doing in a month?" My response was simply, "We'll find out"
To be honest, I never finished the book. I couldn't even tell you the last chapter I actually read. Looking back there are plenty of headaches I could have avoided had I just finished working through the book. Regardless, what ended up happening before the year came to end was me writing my first PowerShell script. It was about 800 lines dealing with Windows Server Update Services (WSUS). I was the guy pulling updates and verifying things worked. This was a manual process that took a couple of days to get done and I was over it. My first script did 90% of the work for me and it was at that moment I realized what new opportunities existed.
Why I Use PowerShell
I was talking to a coworker recently who never really used PowerShell. I was pushing him to start learning the basics. He asked me what I felt was the real benefit from learning PowerShell. I explained that, to me, there are three aspects that I think are huge benefits:
1. Working in PowerShell, or any cli environment, helps me engage in Deep Learning.
1. I make mistakes. I could do the same thing 10 times but I might mess up a couple of them. PowerShell = Consistency.
2. I want to eliminate the monotony of my day so I can focus on what is important.
Deep Learning
Using my first script as an example. I had been spending months learning WSUS. What does it do? How does it work? How do I diagnose and remediate issues? I would write my commands and some would work perfectly. Others wouldn't and I had to figure out why. This constant back and forth forced me to truly understand WSUS so that I could build a script that worked the way I wanted it to.
PowerShell = Consistency
Consistency is key. When I am using PowerShell and, more specifically, building scripts. I know that it is going to do the same thing every time. If it fails to accomplish what I want it to, it is more than likely because I told it to do the wrong thing. Garbage In Garbage Out. But when its working, I am freeing up my time because I don't have to go back and diagnose why one machine is different from the other, only to realize its because I forgot to click a checkbox on the machine that is different. Consistency reduces the amount of time I waste during a workday.
Reducing/Eliminating Monotony
Unlocking user accounts has to be my least favorite task. I don't hold it against the users. Ridiculous password requirements and rotations means that the people who are actually following the requirements are going to forget their passwords and lock their accounts. When a user needs their account unlocked my coworker will; login to his admin account if not already logged in, open up Active Directory Users and Computers (ADUC), find the user, access the properties of that user, and check the unlock account box. Maybe this takes 5 minutes and in the grand scheme of things, 5 minutes isn't that long. Now what if you're working a problem that is more serious? Let's say you've been troubleshooting this problem for an hour and a user comes to ask for an unlock. You step away from your problem for 5 minutes. When you come back to your problem you naturally go back see what you were doing, where you left off, and get your train of thought back on track. Now imagine that 10 minutes later another user comes in asking for an account unlock. Its easy to see how through the course of a day your time can be eaten up by this simple monotonous task and you will probably make little head way on the real problem.
I explained to my worker how using Unlock-ADAccount would get the same job done in a fraction of the time. All you need is the username. When we can free ourselves from the mundane tasks that eat away at our time we can focus on the big picture items and creating an environment where we aren't manually toiling with small problems that, when aggregated, eat away at our time and productivity.
So What Now?
My goal with this blog isn't to just discuss PowerShell. However, PowerShell has played a major part in my early success and I am forever a student. I hope to write more posts about PowerShell and show others what I have learned and accomplished so that maybe they can use it to help themselves. Anything PowerShell focused will be titled PowerShell: .
A tip: When searching for help with PowerShell I actually highly recommend referencing the Microsoft Docs. I think that they provide a solid foundation to build off of when learning commands, syntax, and use. If you add "docs" to the end of your search, more than likely you will see Microsoft links show high in the results.
Click Here To Explore Microsoft's Official PowerShell Documentation