Microsoft introduced PowerShell in Windows Server 2008, but administrators still prefer the old command line or GUI tools because they are familiar.
Since the 1990s, the Windows command line has been available. The DOS command line was replaced by many useful GUI tools in later Windows versions (Windows 2000 through Windows 2012). These GUI tools perform many of the same tasks as the command line.
PowerShell is a combination of the old command line tools with some.NET coding called cmdlets. These cmdlets can automate many administrative tasks that you do every day.
Administrators avoid it because they don’t want to code. But here are five reasons to abandon the old GUI tools and get started with PowerShell.
Learn how to become a security expert with SPOTO’s Cybersecurity Training
Start trainingPowerShell has a full editor IDE
PowerShell, like other scripting languages has an editor that allows you to create, run, and then test your scripts. The PowerShellISE has a split IDE that allows you to type your commands and then run them in the bottom screen. This allows you to identify any bugs and fix them. This is a significant improvement on old Windows.bat files, where you had to save the file and then run it. Then, you had to identify the line that caused the Kills. PowerShell ISE gives you more feedback and helps to identify bugs when you create scripts.
Cmdlets for Almost Any Task
The standard command line is not perfect. PowerShell offers many cmdlets, while the standard command line only supports a handful of commands. You can also make your own cmdlets, or download them from third parties. You don’t need to download large.bat files. Instead, you can call cmdlets that can do more than standard command line tools.
You can obtain a list with the attributing member type (method or property, alias) to get an example. You can use the Get -Process cmdlet in conjunction with the Get -Member cmdlet. The result is:
This detail is very useful when auditing the services on your server.
Let’s suppose you have hundreds of processes on your server and you want to find one. It’s time-consuming to search through all the processes on your server to find out if it is. To filter the results and display only certain processes, you can use the cmdlet “Where-Object”.
In the previous section, for example, the returned list contained approximately 50-75 processes. It would take too much time to go through each one and determine if an application is in use. To find a specific one, we can use Where-Object.
Let’s suppose we want to find out if Explorer is currently running. The following command can be used.
Get-Process | Where-Object $_.Name -eq “iexplore”
The “-eq” parameter stands for “equals.” You can also use the gt (greater than), lt (less than), comparison operators to get numeric values. This command displays all Internet Explorer processes. \
Our test machine does not have “iexplore” running so nothing is returned.
Cmdlets that Plug into Your Microsoft Software
As you add more servers to your network, automation becomes more common. PowerShell allows you to automate so many functions that you can use your time for other tasks. Although it may take some time to create the scripts you can then set it and forget about it once all the bugs have been fixed.
Let’s say that you add a SharePoint server into your environment and want to upload a folder every night to a specific SharePoint site. These files can be manually uploaded to the server or you can use the many SharePoint cmdlets that come with the software.
You can find all SPOTO Microsoft SharePoint trainings here.
You Can Migrate Slowly
If you are a command line user who is very experienced, you might be hesitant to jump into an unfamiliar environment. You can’t play with production server an