Video: Learning PowerShell for the IT Administrator – Increase efficiency and automation

Home > Blogs > PowerShell > Video: Learning PowerShell for the IT Administrator – Increase efficiency and automation

Video: Learning PowerShell for the IT Administrator – Increase efficiency and automation

Like This Blog 1 Jason Helmick
Added by April 11, 2012

For IT administrators who are hesitant to learn PowerShell, this post will help take the fear out of getting started.

PowerShell is not a scripting language. Yes, it does have a scripting language, but that’s for automation and to make tools, which we’ll discuss later.

PowerShell’s primary focus is to be a real-time interactive command tool that allows the user to be much more efficient in managing all system resources – whether it be users, servers, applications, deployments and more.
Many UNIX or Linux admins are already using PowerShell with ease, but if you haven’t tried PowerShell yet, let’s start off with a few basics.

At first glance, many newcomers to PowerShell get lost when they see the command line.

PowerShell for Admins Start PowerShell

If you’ve worked with the older, or native, command prompt, you know that some commands are pretty familiar, and you’ve probably used them for a long time. Well, PowerShell has its own custom commands known as cmdlets, and they’re in what’s called a verb/noun pair.

Take a look at my current directory listing.

PowerShell for Admins Current Directory Listing

 

 

If you’re at that native command prompt, and want to change back to the root of C, you’d probably type “CD\”. PowerShell has a cmdlet for that called Set Location.

PowerShell for Admin Set Location C:

 

 

The result is changed to the root C:\.

PowerShell set Location

 

 

If you wanted a directory listing you might type “dir”. PowerShell has a cmdlet for that called Get ChildItem.

PowerShell Get ChildItem

If you wanted to clear the screen you could type “CLS” but PowerShell has its own cmdlet for that called Clear Host.

PowerShell clear host

 

These special cmdlets may cause newcomers to fear PowerShell. It looks like there’s this whole new command structure to learn. Well, the creators of PowerShell made the command lines friendly for everyone.

If you want to change from your current directory back to the root, typing “cd\” works as well.

PowerShell CD backslash \" title=

 

If you want to get a directory listing, type “dir”.

PowerShell dir

If you want to clear the screen, type “CLS”.

PowerShell UNIX ls
Interestingly, how do you get a directory listing in UNIX? Type “ls”.

PowerShell UNIX ls

You might remember from the old DOS days that if you wanted help, you could type “help”.

PowerShell Help

That gets you help for PowerShell as well. For those who work with UNIX or Linux, typing “man” provides help, too.

PowerShell provides flexibility for Windows administrators who are familiar with the native command line and for UNIX administrators who are familiar with their shell.

They can begin working right away, and so can you.

The best way to get started with PowerShell isn’t by opening up the command prompt. It’s by opening up the PowerShell prompt and doing what you would normally attempt to do.

Let’s see a couple other examples. At a command prompt you might need to check your IP addresses so you type “IP config”.

PowerShell ipconfig

PowerShell will let you run Windows native commands as well. You can even run “ping”.

PowerShell ping

Let’s launch notepad.

PowerShell notepad

Your regular Windows native commands will work just fine. How about MS Paint?

PowerShell MS Paint

 

 

 

MS Paint launches as well.

PowerShell launch MS Paint

You can now start using PowerShell right away for what you usually would do at the command line.

PowerShell enables you to run your native Windows commands as you begin to learn PowerShell cmdlets and start to write your own scripts to become a better administrator.

For an in-depth demonstration of using PowerShell in Active Directory see What is PowerShell and how can it make your IT staff more efficient?

Using the PowerShell Editor for customizing scripts:

The PowerShell editor is simply one liner commands that you would have typed at the console. The difference is there’s more structure around it, and the editor allows you to create your own cmdlets.

PowerShell PS Editor

You can create custom cmdlets and put them in a module to use whenever you want. For example, I’ve created a couple cmdlets and put them in “JasonMod.psm1”.

PowerShell import module

These cmdlets are “Get-CompInfo”, which retrieves basic computer information, and “Set VolLabel”, which changes the labels.

PowerShell Get Command Module

We’ll run the cmdlet Get-CompInfo.

By default, this simple cmdlet returns basic computer information about our local host. As you can see, it gives us the computer name, local host, etc. Notice there’s no drive label on the hard drive, “drive C”, and that’s actually what we’ll fix next.

This cmdlet was written in a few minutes to collect some information, but the benefit of PowerShell is that when you make a cmdlet, you get many usable features. As simple as this cmdlet appears, it can also get information from any remote server. So let’s get information from server 1 and server 2.

PowerShell get compinfo server

Notice they don’t have “drive” labels either? Let’s fix this.

PowerShell get compinfo server drive label

 

 

 

 

 

 

 

 

 

 

 

Now we’ll run the Set-VolLabel cmdlet. Starting with the Get-CompInfo cmdlet, using the parameters server 1 and server 2, we’ll now change it with the cmdlet that I made called Set-VolLabel and give it a new label of “drive C”.

PowerShell Get CompInfo server drive label vollabel

With PowerShell, no news is good news, meaning we didn’t experience any errors. We can check the results to be sure by moving back and removing the portion of the pipeline and striking enter.

PowerShell Get CompInfo server drive label check

As you can see, the drive labels on the remote computers are now set.

You can start to see the power in PowerShell. It empowers you to use cmdlets to solve problems and to do IT administration tasks much more efficiently – and it also empowers you to easily create automation.

There is a learning curve to working with cmdlets, but once you get comfortable with them, you’ll start using PowerShell with all Microsoft products deployed in your organization. When Windows 8 releases, you’ll be able to use PowerShell to manage your environment efficiently and effectively.

As an IT admin, there’s no need to be afraid of PowerShell. You can start experimenting with PowerShell today, and I don’t think you’ll regret it.

Enjoy!
Knowledge is PowerShell,
Jason Helmick
Director of PowerShell Technologies
Interface Technical Training

Videos You May Like

A Simple Introduction to Cisco CML2

0 3896 0

Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2

Creating Dynamic DNS in Network Environments

0 642 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader teaches how to create Dynamic DNS zones in Network Environments. Video Transcription: Now that we’ve installed DNS, we’ve created our DNS zones, the next step is now, how do we produce those … Continue reading Creating Dynamic DNS in Network Environments

Cable Testers and How to Use them in Network Environments

0 727 1

This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments

Write a Comment

See what people are saying...

    Share your thoughts...

    Please fill out the comment form below to post a reply.