What is Windows PowerShell?.md - Juan-bit94/Ops401D10 GitHub Wiki

Windows PowerShell

What it is

  • If you look at Wikipedia, you will see that it describes it as a task automation and configuration management framework.
  • That statement might not mean much if you just got started in IT or administrators. You might think that PowerShell (PS) is just the command processor (cmd.exe) with the blue screen and a little PS in front of the prompt.
  • In PowerShell, you can use commands like type, mkdir, dir, cls, and network commands like ipconfig and ping. PS looks and behaves a lot like cmd.
  • This wiki will explain how the PS console is a different application from cmd or cmd.exr.

Things to know about PS

  • Both PS and cmd are hosted by the same parent process namely conhost.exe. So they share a common lineage and they are separate environments.
  • Now for task automation, a task from a Windows system's administrator standpoint is any activity that administrators are going to need to do multiple times. These tasks could be something like:
  1. Creating an Active Directory user account for a new hire.
  2. Installing a particular server role on a server.
  3. It can be setting TCP/IP configuration settings.
  • The list goes on, just think of anything you can do as a Windows system's administrator, and in particular, think of things that you do regularly.
  • A good practice is to try to automate those tasks by using Windows PowerShell. You can put the task into a script file and then whenever you need to execute a task such as create a user account, you would run the script and its done.

Configuration management

  • Configuration management means that we can use Windows PowerShell to standardize those tasks.
  • For example, let's say you're an IT manager and you've hired two or three assistants. You want to make sure that when each of those assistants does certain configuration tasks in the domain, that they do them the same. Since this might be difficult to follow, so if you've standardized the configuration management using Windows PowerShell. Then you can rest assured that as long as those assistants know how to run a PowerShell script and provide valid parameters for their script then the configuration management will be consistent.

.NET Framework

  • Windows PowerShell is essentially an administrators friendly entry point to the .NET Framework. This day and age, you could work in an environment that has you administer a Windows system and do some Windows application development. Try to be okay with this fact since DEVOPS is a thing due to products such as the Microsoft System Center suit, SharePoint Server, and the .NET Framework.
  • The idea of PowerShell is that you can carry the same type of power as a C# or Visual Basics. With PS, you can access down to the lowest level of the OS, down into the hardware abstraction layer; down into the device drivers.
  • Think of the networking and computing, the CPU, the memory, and the disk subsystem without having to know all of the specific application programming interface stuff that programmers know. That's what the .NET Framework is, its a mass configuration layer. We can tap into that just using the PS commands. It's true that you can do programming in Windows PS since it is robust enough to where it does have error handling and debugging. Along with the ability to do looping constructs and conditional logic like "if" statements and "else".
  • Once an administrator gets down to the .NET Framework level, you really have full access to the system, the underlying hardware, the OS, and applications.
  • We can consider the .NET Framework to be the circulatory system of a Windows computer. Now we can say that the .NET Framework and PS are intimately associated, which means that each version of Windows PS was written to work with a particular version of the framework.
  • This means that you do have to worry about which version of PS you are running on the system.