Windows PowerShell Tutorial 1 - Introduction to PowerShell

A series of tutorials on how to use Windows PowerShell, programming tips, and so forth.



  1. Regedit32
    I've had a few requests to provide some tutorials on how to use Windows PowerShell, including how to program scripts.

    As this is potentially a rather vast topic I thought I'd post a series of mini tutorials on the subject to help those already familiar with programming in other languages, and also those who've never written code or scripts.

    Any suggestions for a specific topic to share more detailed information is welcome, and if you have any questions feel free to ask. I, and others in our Forum will be happy to help where we can or point you to information resources that will hopefully help you.

    In this first tutorial I thought I'd briefly explain how to access Windows PowerShell.

    How to access Windows PowerShell

    In the past, one had to download Windows PowerShell manually as it was not included with the Windows OS be default. However, in Windows 10, Windows PowerShell comes bundled with the OS.

    For those of you currently using Windows 10 Version 1703 (Creator) you probably noticed that the power menu (Winkey + X, or right-clicking Start) replaced the Command Prompt and Command Prompt (Admin) options with Windows PowerShell and Windows PowerShell (Admin) instead.

    Windows 10 Versions 1607, 15xx and 14xx also have Windows PowerShell, but it will not appear on the power menu by default.

    Thus there are two ways to open Windows PowerShell.

    1. Right-click on Start or press Winkey + X then select either Windows PowerShell or Windows PowerShell (Admin), or
    2. Right-click on Start and select Search or press Winkey + S then in the search field type PowerShell and now in the search results select either Windows PowerShell or right-click on Windows PowerShell select Run as administrator
    Note: If you choose to run the Administrator: Windows PowerShell you may be prompted by the User Account Control to confirm you wish to run it. Click yes, if this occurs.

    Also if using the search field to get to PowerShell, you may have noticed in the search results Windows PowerShell ISE. This is a tool Microsoft provides the User to code Scripts, PowerShell profiles, etcetera and can also be run in Administrator mode. I'll go into more details on that in another tutorial.​

    Assuming all has gone well you will now be able to see your Windows PowerShell console, such as in the example image below.

    PS1.png

    If you've ever used the Command Prompt this console will look quite similar, however unlike the Command Prompt this console allows you to send command line and also script instructions directly via Microsoft .NET Common Language Runtime (CLR) and .NET Framework, and in so doing you can do so much more with your computer than the older Command-line only interfaces like Command Prompt. Again, I'll go into more details on this in later tutorials.

    In the next tutorial I'll be taking a look at cmdlet's; what they are, and how to make use of them. Before we go though, as you have your PowerShell console open, type or copy & paste the following then press Enter key and see what happens:

    Code (PowerShell):
    Write-Host "`n$env:ComputerName `n"
    Note: If you chose to type this: the ` before the n's is a grave symbol which is the key to left of 1, with the tilde ~ and grave accent `


    Regards,

    Regedit32
    Ian and Trouble like this.