Pinterest Stumbleupon Whatsapp
Ads by Google

PowerShell is what you get when you give steroids to the Windows Command Prompt 15 CMD Commands Every Windows User Should Know 15 CMD Commands Every Windows User Should Know The command prompt is an antiquated tool from an era of text-based input. But some commands remain useful and Windows 8 even added new features. Find out which ones. Read More . It’s loaded with more power and flexibility and it grants you control of nearly every aspect of the Windows system, but it comes with one downside: a learning curve. Fortunately, PowerShell isn’t that hard to grasp Boost Your Productivity With Windows PowerShell Scripts Boost Your Productivity With Windows PowerShell Scripts What if you could bring the productivity of Linux over to Windows? Most Linux distros come packaged with the powerful Bash shell. PowerShell is an equally powerful terminal for Windows. Read More .

Do you yet have to discover the benefits of PowerShell? No problem. We’ll take you through some of the most basic commands and how they can improve your Windows experience.

Even if you don’t end up using these commands from day to day, becoming familiar with them is still good since it looks like Microsoft is now more invested in PowerShell than ever before. For example, knowing PowerShell will allow you to take advantage of the awesome OneGet package manger Windows Gets A Package Manager - Download Software Centrally Via OneGet Windows Gets A Package Manager - Download Software Centrally Via OneGet Microsoft is adding yet another Linux feature to Windows. Package management can seriously boost productivity, increase security, and ultimately save you a lot of headache. We show you how it will work. Read More .

Get-Help

Microsoft is aware of PowerShell’s learning curve. That’s why it comes with the aptly-named cmdlet Get-Help, which provides you with all of the information you’d need to properly run the commands available to you. Get used to relying on this whenever you get stuck or confused.

Get Help

Ads by Google

Typing Get-Help into PowerShell gives a brief description of what it does and how to use it. Here are some tips to get you started.

Get-Help <command> gives a rundown of that particular command, which includes a description, related commands, and syntax rules when using the command. When viewing syntax rules, elements in square brackets [] are optional.

Get-Help <command> -Full gives a detailed rundown of that particular command.

Get-Help <command> -Example shows several examples of how the command can be used and what sort of output you can expect.

Get-Help * lists every possible help topic that’s available to you. It might overwhelm you at first so it’s not recommended if you’re brand new to PowerShell (this would be similar to reading through a dictionary cover to cover). Use it as a reference when you’re more comfortable.

Get-Command

Get-Command lists out all of the commands that are currently available to you right now. Put another way, it does not list out every single command available in PowerShell. Even so, this list can get to be pretty long, so it’s best that you filter it according to what you’re looking for.

Get-Command -Name <name> shows commands with the given name. If you don’t know the exact name, you can use it in conjunction with a wildcard (*) like so: Get-Command -Name *register*, which would return all commands that have “register” somewhere in the name.

Get-Command -CommandType <type> only shows commands of a particular type: Alias, Cmdlet, Function, or Script. Understanding the difference between these types is beyond the scope of this article.

Get-Item

The Get-Item cmdlet returns the item specified by the parameters you give. This item could be a file, folder, script, or whatever. Do note that it doesn’t return the contents of the item, so if you used Get-Item on a .TXT file, it wouldn’t show you the actual text within.

Using Get-Item on a directory will return the actual directory, not the items within that directory. If you want to do the latter, you must use the Get-ChildItem cmdlet instead.

The opposite of Get-Item is the Remove-Item cmdlet, which deletes the specified item.

Get-Content

This cmdlet is like Get-Item above, except it actually returns the contents of the specified item. If you used Get-Content on a .TXT file, it would return all of the text inside. If you used it on a .PNG file, you’d get a bunch of nonsensical and unreadable binary data.

On its own, this cmdlet isn’t too useful. However, you can combine it with more advanced cmdlets (which we won’t cover here due to it being beyond our scope) to neat effect.

An example: using Get-Content on a .TXT file full of different web addresses and feeding that info to a Foreach-Object cmdlet to perform a command using each web address as a parameter.

Get-Service

As its name states, the Get-Service cmdlet allows you to retrieve information on the services that are installed on your computer. Running it without any parameters will show a list of all services along with their statuses (e.g. Running or Stopped).

If you know exactly what you’re looking for, using Get-Service can be a lot faster than navigating through Windows Control Panel and dealing with services through the GUI.

Other useful service-based cmdlets include Start-Service, Stop-Service, Suspend-Service, Resume-Service, and Restart-Service.

Get-Process

Get-Process is similar to Get-Service except it returns information on processes. On its own, the command will list all of the currently running processes on your system. Processes can be filtered according to names and IDs among other identifiers.

Other useful cmdlets include Start-Process, Stop-Process, and Wait-Process. Once you get comfortable with these, you’ll have an easier time debugging process-related hiccups on your system than if you were to use the Windows Task Manager 5 Powerful Alternatives to the Windows Task Manager 5 Powerful Alternatives to the Windows Task Manager The native Windows Task Manager may as well be called a task killer since we only bring it up to kill unresponsive processes. Alternative Task Managers allow you to actually manage your processes. Read More .

Final Thoughts

Again, it might seem like some of these commands aren’t very useful, but that’s because their value doesn’t shine through until you introduce some other elements that really show the power of PowerShell. For example, Get-Item is one that might seem unnecessary at first glance, but consider this:

$(Get-Item C:\SampleDirectory).lastaccesstime

The above essentially returns the last time someone accessed that particular directory. This kind of scripting comes in handy when you’re writing your own Cmdlets or Scripts, which is just one way to take full advantage of PowerShell’s functionality.

What do you think of PowerShell? Are you willing to learn what it offers? Share your thoughts with us in the comments below!

  1. dlevans0622
    July 9, 2016 at 9:52 pm

    I can not find PowerShell. I windows R and it was already in the box. when I click it I get the blue screen and do not know what to do from there. can anyone help me?

  2. Pierre
    January 29, 2016 at 11:08 am

    1. you state "powershell isn't a script " then you start typing scripts.. lol
    2. No confirmation message ? this is not reassuring at all.

  3. Charlie Spencer
    January 11, 2016 at 10:04 pm

    I have one of those annual workplace, HR-mandated 'Self-Improvement Tasks' to learn PS. My problem is that I can't figure out what I'm going to do with it when I do.

    It seems like every reference and tutorial I find discusses uses I either don't need or don't do often enough to make learning them worthwhile to me. Maybe I'm a poor admin / tech support guy, but I rarely need a list of processes or services, something most tutorial seem obsessed with.

    I don't think I'd have any problem learning PS, but if I can't figure out how to use on a regular basis then I'm not going to retain that knowledge.

    • john b mcdonald
      March 15, 2016 at 11:01 pm

      It seems like you are going through the opposite experience I had when Windows first came out and all I knew and thought was important was DOS and I couldn't figure out why in the world anyone would want to point and click at something to get around in the file system and make things happen when typing it in right there on the keyboard was so much more normal. If you want to develop a sense of how PS could be useful/helpful you might try getting some exposure to some operating systems that don't use a graphical interface. Might be a good opportunity turn that old computer in the back of your closet into a linux box? Create a minecraft server or something?

      • Charlie Spencer
        March 16, 2016 at 11:21 am

        Thanks, but I'm already comfortable at a command prompt. I started out with DCL on VMS systems for years and, like you, DOS. It's not comfort or exposure as much as I haven't found anything I do on even a semi-regular basis that I can't already do from the GUI. Unlike you, I didn't have trouble with the CLI-to-GUI conversion. Why type when I can click? (And I'm a touch typist!)

        I also started as a COBOL programmer. Since my original post, I've discovered part of my learning curve with PS is my complete ignorance of object oriented programming. I notice most PS tutorials assume I'm familiar with objects. I'm not, and haven't found a good explanation of them. I notice most tutorials also assume I'm already familiar with older scripting tools, another area of ignorance for me. This is likely because I never had enough reasons to script anything in the past to make it worth getting beyond .BAT files. I have a few working .BAT files I use maybe quarterly, but what's the value in converting them? I've found one thing I do every couple of years that's been worth writing a small PS script for (export members of a global group to e-mail address), but that's about it.

        I already build physical and virtual file, print, and SQL Windows servers on a occasional basis, maybe every 18 months or so. (I suspect I'd spend more time trying to figure out Minecraft than Powershell; I don't play online games.) What's the value in gaining knowledge I'll only use that often, especially when I'm already familiar with the existing GUI method?

        I appreciate your reply, but I'm still looking for something I do daily or even monthly that I'd gain from doing in PS rather than the GUI, especially on a single-command, non-script basis. I realize there's a lot of power there, but I can't figure out what to use it for.

        • Dan
          July 6, 2016 at 5:44 pm

          Is your environment pretty small?

          You can do a lot with powershell.

          I manage over 100 print servers for a client and I wrote a PS script to remote into each server and write which printers were showing any status besides Ready.

          I also wrote a script that lets alerts me if a series of directories have not been updated in at least 20 minutes. This lets me know if an xml feed from sql is down.

          I just started with PS about a month ago but the possibilities seem endless. it just takes some thought.

  4. Khalid
    May 14, 2015 at 5:51 am

    Please if anyone can help. I would like to join all computers on my intra network to domain. If anyone can help....Thanks.

    • Dimpy
      May 14, 2015 at 5:57 pm

      Deploy a DC and keep all your host in same VLAN, and keep gateway as DC.

  5. James Moore
    April 30, 2015 at 5:56 pm

    Set-ExecutionPolicy Is this for scripting only and after executing a script can I set policy back to restricted?

    What would be nice and helpful is to have a list of options to click on after pulling up a basic command like Set- ExecutionPolicy then options Restricted, All, Unrestricted, Owner. Even though you can change the Ownership of PowerShell would this do the same thing? Like bending the security Policy.
    I have ran across some functions where it would be nice to have a help menu or options with hover explanations.

    Still Amazed with program and need a book.

  6. DonGateley
    December 12, 2014 at 10:51 pm

    A fundamental difference between PoweShell (or it's open source clone, Pash) and other common shells is that what Get- gets and what are passed through pipes are objects with structure that are self defining and can be interpreted or acted on in content dependent ways by other commands that know their structure. In all other common shells, it's just text and while text can be structured there are as many structure syntax's as their are programs that interpret data. Much of that is made implicit with PowerShell objects where a common internal data description syntax is employed. Sorta like Json on steroids but built into the interpreter in a way that obviates the need for parsing.

    This shift in perspective is, I think, brilliant, novel and extremely powerful but not what people coming from most any other shell will expect.

    • Joel Lee
      December 21, 2014 at 12:24 am

      Excellent point! That's one of the first things that really intrigued me about PowerShell. I still have a lot to learn when it comes to advanced PowerShell magic but the piping of objects is something I haven't seen elsewhere and has a lot of cool implications.

  7. Overlord
    December 12, 2014 at 1:25 pm

    can't we just rename this " keep calm and learn BASH " ?

    • Joel Lee
      December 21, 2014 at 12:23 am

      If Bash existed on Windows, maybe! (Cygwin doesn't count.)

  8. Shafiq Khan
    December 12, 2014 at 9:16 am

    The only place I use powershell is managing an office 365 account to made changes to user accounts which arent possible through the gui (such as password expire times)

    • Joel Lee
      December 21, 2014 at 12:22 am

      That makes sense. Admittedly PowerShell won't be too useful for mundane stuff, but yeah, things like that are where PowerShell's usefulness start to show.

  9. likefunbutnot
    December 11, 2014 at 8:16 pm

    If you're a Windows admin working on modern server installations, you'll either figure out the cmdlets you need or you'll very quickly discover all the little goofy places where Microsoft hasn't yet bothered to implement a GUI interface.

    I can't actually think of anyplace where an end user would be better off working in Powershell, but then end users aren't typically managing Hyper-V, Exchange or Storage Spaces on a daily basis.

    • Joel Lee
      December 21, 2014 at 12:21 am

      You have a point. PowerShell is relatively young (it hasn't even been around for a decade yet) so there's still some hope and potential that Microsoft gets around to making it easier to learn and more useful for newbies. With the company's recent shift in direction, it may actually be possible.

Leave a Reply

Your email address will not be published. Required fields are marked *