5 Reasons to Ditch the GUI
Microsoft introduced PowerShell with Windows Server 2008, but many administrators still gravitate toward the old command line and GUI tools due to familiarity.
The old Windows command line has been around since the 1990s. In later versions of Windows (think Windows 2000 to the most recent Windows 2012), the DOS command line was replaced with many useful GUI tools that performed many of the same tasks that you could do using the command line.
PowerShell is a mix between the old command line tools and some .NET coding called cmdlets. These cmdlets can be used to automate many of the administrative tasks you do every day.
Some administrators avoid it because they don't want to get into coding, but here are five reasons it's time to ditch the old GUI tools and start using PowerShell.
PowerShell Has a Full Editor IDE
Just like other scripting languages, PowerShell has an editor that lets you create scripts, run them, and test them. The PowerShell ISE has a split IDE where you can type your commands and run them in the bottom screen where you can identify if you have any bugs. This is a step up from old Windows .bat files where you had to save the file, run it, and then identify the line that caused the Kills. The PowerShell ISE provides more feedback and helps you better identify bugs as you create your scripts.
Cmdlets for Almost Any Task
You know that the standard command line has its limitations. It has only a few commands, but PowerShell has dozens of cmdlets. Even better, you can make your own cmdlets or download them from a third party. The advantage is that you don't need long .bat files. Instead, you can call a cmdlet that can do so much more than a standard command line tool.
For instance, you can get a list of services with its attributing member type (method, property, alias). You can use the Get-Process cmdlet with the Get-Member cmdlet. The result is the following:
This level of detail comes in handy when you're auditing the services running on your server.
PowerShell Filters
Let's say you have hundreds of processes running on your server, and you're searching for just one. You want to know if it's running on the server but sifting through all of these processes takes time. You can use the "Where-Object" cmdlet to filter the result list and display only certain processes.
For instance, in the previous section, the returned list contained about 50-75 processes. To go through every one of them and identify if an application is running would be tedious. We can just use Where-Object to find a specific one.
Let's say we want to know if Explorer is running. We can run the following command.
Get-Process | Where-Object {$_.Name “eq "iexplore"}
The "-eq" parameter translates to "equals." We can also use the -gt (greater than) and -lt (less than) comparison operators for numeric values. This command displays any Internet Explorer processes. \
On our test machine, "iexplore" is not running, so nothing is returned.
Cmdlets That Plug Into Your Microsoft Software
Automation is more common in server administration as you add more machines to the network. PowerShell can automate so much functionality that you can spend your time doing other tasks. It might take some time to create the scripts, but then you can set it and forget it once the bugs are ironed out.
Let's say you add a SharePoint server to the environment, and every night you want to automatically upload a folder to a specific SharePoint site. You can manually upload these files to the server, or you can do this with the dozens of SharePoint cmdlets included with the software.
See all of the CBT Nuggets Microsoft SharePoint training here.
You Can Migrate Slowly
If you're a hardcore command line user, you might hesitate to jump into an environment that you aren't familiar with. After all, you can't play with production servers and make a mistake. You need to be precise.
The good news is that PowerShell works with standard command line commands. You can run batch files, use command line statements, and slowly migrate your automation to PowerShell as you learn the language. PowerShell is a hybrid of standard command line statements and .NET code, so you can mix and match what you want to use in your scripts. Once you fully migrate to PowerShell, you'll find that you have far more options than standard bat files.
See all of the CBT Nuggets Microsoft Server training here.
Microsoft pushes its PowerShell language as the future, so administrators will find more and more scripts in PowerShell, rather than older command line statements. Administrators who want to stay ahead should get started now and learn what you can do with cmdlets.
Want to learn more about PowerShell? Start training today!
Not a subscriber? Start your free week.
delivered to your inbox.
By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.