<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=578826073428599&amp;ev=PageView&amp;noscript=1">
Remotely Blog

The benefits of using Powershell

Introduction

As an administrator who supports Microsoft Windows systems, the use of Powershell has simplified my job without taking away control or visibility from a management perspective. My need to incorporate Powershell into my work initially stemmed from feeling as though I was wasting too much time creating Active Directory users via the GUI. I was working for an organization where 10 new employees could be hired in a given day and the amount of time creating the user account, moving the account into the correct OU, assigning the accounts to the proper security groups, felt like too much. I needed a new method in order to streamline this process and regain some time back into my day. This is when I first began exploring Powershell as a tool to complete time-consuming, repetitive tasks. I enjoy using Powershell because of its integration with so many components of a Microsoft environment; I am able to fully manage most objects in my domain just by using Powershell alone. With its intuitive cmdlets (Command-lets) and familiar object-oriented structure, I was able to make quick and efficient use of this tool in my everyday work.

What is Powershell?

Powershell is built for scripting and making repetitive tasks easier. For repetitive tasks that I find myself doing, I can almost always look to Powershell for an automated solution for those things. For example, the creation of new Active Directory users during peak hiring times of the year can be time-consuming and repetitive. With the use of Powershell, I was able to develop a script that pulled necessary new hire information from a CSV file created by HR to automate the creation of new user accounts. Not only did this save my IT department time, the script created consistency in the onboarding process by ensuring that user accounts were always created the same exact way. The potential for human error of forgetting to populate a necessary LDAP field that another program or department might use for its database is cut out of the equation.

Powershell can provide a ton of useful information about your environment with just simple commands as well. Do not think you need to take on scripting in order to effectively use this tool. For example, if I don’t feel like jumping into a GUI MMC, a quick command can tell me a heap of specific information right from the Powershell console. From simple commands such as Get-ADDomainController, useful if I need to check which Domain Controller (DC) a device is connected to so I can ensure necessary changes in Active Directory are made on the correct server and reflected to the end-user or workstation in a timely manner without the wait times of replication across DCs, to more complex commands such as creating a new user account in Active Directory, New-Aduser, which offers a large number of parameters used to uniquely identify a user in your domain.

I do not need to be sitting locally at a machine in order to make use of Powershell’s ever-useful features. Another great advantage of using Windows Powershell is that it offers us IT administrators the ability to perform remote work in a similar manner as they would if they were managing a device they are sitting in front of. This is extremely useful in cases where I might need to run a script on a server or computer that is halfway across campus. Windows Powershell Remoting, PSRemoting, allows for running single commands to a remote machine, Invoke-Command, or if I wanted to establish a continuous, interactive Powershell console on the remote target machine, Enter-PsSession. Powershell commands in a Powershell console are not confined to the local machine in which I am sitting at. This is another reason why this tool is so effective and useful. Of course, to manage devices with Powershell that are not in your network, the use of an SSH tunnel or VPN Gateway is necessary.

Just when we thought Powershell could not get any better, Microsoft has recently released a new version of Powershell, v. 7.2 now available to the general public. One of the biggest and most important features in my opinion as listed in Microsoft's Blog post is the integration with Microsoft Update to ensure that critical bug and security fixes are rolled out automatically for the latest version of Powershell should you opt in for automatic updating during the installation of Powershell 7.2. You can also choose to update Powershell yourself rather than making use of automatic updates.

Another neat feature of Powershell 7.2 that I believe to be useful is what is called Predictive IntelliSense. This feature takes tab-completion and enhances it by making predictions and suggestions to complete your command based on your command history and specific plugins that you can install. I see this being useful in two major ways: for admins who are repeatedly typing the same commands or pieces of the same command, as well as being useful for casual Powershell users who may not yet be fully comfortable in the language. This new feature allows Powershell users of all kinds to be more productive while working in the latest version.

I do not see Powershell going away anytime soon, and I don’t see myself not using it in the future for as long as I am involved in a Microsoft Windows environment. It has helped me in troubleshooting, automating, and managing resources in my domain for years. For anyone looking to learn more on the language I highly recommend Powershell in a Month of Lunches by Don Jones and Jeffrey Hicks as well as the Microsoft Learn Modules offered by Microsoft. I am confident that all members of the IT field can benefit from having just a few Powershell commands in their ‘tool-kit’.

Built on Azure. Built for Azure. 

Schedule a time to chat with a Remotely team member about the industry's only Azure native RMM.