Powershell
The ultimate beginners guide to Powershell, making you a master at Windows Powershell command line fast!
Table of Contents
T hank you for taking the time to pick up this book about PowerShell!
This book covers the topic of Windows PowerShell and will teach you all about how to use it and all of its possibilities. Basically, the PowerShell is a command line interface that operates within the Windows system, with the purpose of task automation and configuration management. It is a fairly intuitive system, and as you will soon realize, doesnt take too long to get the hang of.
In the following chapters, you will learn how the PowerShell operates, how the associated scripting language works, the different commands you will need to know, and what kind of things are possible when using the PowerShell.
Even if youre totally new to programming and have never used a scripting environment, at the completion of this book you should have a solid understanding of Windows PowerShell, and be ready to get started!
Once again, thanks for choosing this book, I hope you find it to be helpful!
Chapter 1: Learning About the PowerShell Language
W hen it comes to the world of coding, there are a lot of different languages that you are able to use. To those who have never done any coding, the idea of these languages can seem confusing, but it is similar to learning Greek, Italian, Spanish, or German when your native language is English. You will need to learn some of the basic words, what they mean to your own language, and how to form sentences (or commands) in order to get them to work the way that you would like. This can take some time to learn, and just like vocal languages, some coding languages are easier, and others will take a bit more time to understand.
There are many different types of coding languages that you can choose from, each with their own uses and capabilities. Some people like to work with Python because it has a decent amount of power while still being easy enough for a beginner to learn. For those who would like to learn how to create websites and add-ons for websites, Java and JavaScript are the best languages to go with. C and C++ are good ones to learn when you want a lot of power behind your coding language. All of these have their uses depending on what you are trying to achieve.
In this guidebook, we are going to spend some time talking about PowerShell from Microsoft. This is basically a new Command Line Interface that is used for the Windows system. If you like how Windows works and are pretty familiar with the system, this can be a good choice for enhancing your Windows experience. It is a good one to use because it uses the simple Microsoft interface but it also has a lot of power. Lets take a look at how the PowerShell language works and why you should consider using it for your coding needs.
What is the PowerShell?
PowerShell is a shell that has been developed by Microsoft to help with configuration management and task automation. This is a powerful shell that is based on the .NET framework. It comes with a command line shell and its own scripting language for you to employ.
In addition to the command line shell that comes with this, you are also going to find the Windows PowerShell ISE. This stands for Integrated Scripting Environment, and is essentially a user interface that is graphical and allows you to create a lot of different scripts without having to type all of your commands into the command line each time.
So basically, the PowerShell is a command line interface that you are able to use with the Windows system. It comes ready with everything you need to begin, including:
- Access to the Dynamic Linked Libraries with Windows
- Access to the Windows COM
- Access to Windows Management Instrumentation
- Access to the .Net Framework API
- PowerShell Functions
- PowerShell Commands
- Existing Windows Command Line Tools
As you can see, there are a lot of features that come with PowerShell, and you will also be able to get access to many other APIs and technologies that are already available on the Windows system. This is one of the things that makes the PowerShell so popular.
Another added benefit is that the PowerShell is already included with your Windows System. If you have Windows 2008 or Windows 7, you are going to have the PowerShell v2 version, while the PowerShell v3 is going to be found on Windows 2012 and Windows 8. If you dont have these systems in place, you can also download the PowerShell here: http://support.microsoft.com/kb/968929.
What can I do with PowerShell?
At this point, you are probably wondering what exactly you can achieve with this great scripting language.
The PowerShell was originally designed as a tool to help the user automate and solve a lot of the tedious admin tasks that exist on your computer. For example, you can use this coding language in order to display all of the USB devices that are installed on either one or more of the computers that are on your network. You can use this coding language to identify and also kill processes that are not responding properly, and even to filter out some specific information about a computer that is on your network.
The Powershell helps to simplify as well as automate some of the repetitive, and sometimes tedious, tasks that you need to do as the admin. It can create scripts for these tasks and will also combine a few different commands together to make things easier.
Many network administrators find that the PowerShell is helpful to them when it comes to working in the Active Directory. Due to the fact that the PowerShell contains hundreds of commands that you can customize (these commands are called cmdlets), the degree of help that the PowerShell will provide you in becoming more productive and efficient in your network is pretty high.
Essentially, the PowerShell is going to make it easier to run your network as the admin without having to waste time and energy working on tedious tasks. It is a simple and clear system that has the ability to take over a lot of boring processes, allowing you to keep everything on the Windows system organized in an efficient way.
Chapter 2: Working with the Commands in PowerShell
Next page