10.07.2020

What is PowerShell? Purpose of Windows Power Shell Component What is powershell in windows 8


With cryptic letters and persistently blinking cursor? This is the command line. The utility is present in all versions of Windows. With its help, it is convenient to manage the system, call programs, find files. But for professional work, cmd is not functional enough. Therefore, Microsoft decided to fix all the cons of the console and released a product called Windows PowerShell. Read on for what it is and how to use development.

What is Windows PowerShell

PowerShell is an interactive, object-oriented command environment with scripting language features. PowerShell 1.0 was officially released from Microsoft on November 14, 2006. The developers have combined the interface of the usual command line CLI with a framework for managing local and remote networks .NET Framework.

Note that Windows PowerShell is not a simple operating shell. Microsoft has created a powerful, extensible, yet flexible management automation tool that can function as a dedicated scripting language.

On August 18, 2016, Microsoft announced that Windows PowerShell is now an open source product available to every developer. The company also added support for Unix-based operating systems, including Linux distributions and OS X.

How to manage PowerShell

To perform tasks, cmdlets, or cmdlets, are used. These are small commands written as executable files. In version 2.0 of PowerShell for Windows XP and Server 2008 R2, the creators added modules that allow you to manage a large number of resources, including Active Directory and Exchange Server.

There are now over 130 modules and commands built into the PowerShell Automation tool. They provide access to files, networks, registry, administration and other system capabilities:

  • setting the time and date;
  • work with folders and individual files;
  • getting help and additional information;
  • import and storage of data;
  • scripting methods;
  • separate scripts and applications;
  • system security check and work with descriptors;
  • system administration;
  • check disk space.

Considering that Windows PowerShell is an extensible environment, users can create their own commands, write "authoring" modules using the .Net language.

Getting Started with PowerShell

The latest beta version 6.0 of PowerShell was released in 2016. In Windows 7, 8, and 10, the utility is built-in. If you are using a different operating system, you will have to download the application. To do this, go to the official website microfoft.com and enter Installing Windows PowerShell in the search box. The system will automatically take you to the page with the latest product releases. Select your OS from the list and click Download.

When the file is fully downloaded, double-click it to open it. By default, the environment will install to ProgramFiles \ PowerShell \ and create a shortcut in the Start menu. If you are happy Windows user, click on the system icon in the lower left corner and enter PowerShell in Find Programs and Files. Run the application, enter your first cmdlet, and get started.

List of required commands and instructions for PowerShell

The name of each cmdlet is in the form verb-noun or action-object. We offer a list of the most important PowerShell cmdlets for Windows 10 and previous versions starting with XP. They will be useful even for novice users who only yesterday learned how to save text documents.

  1. Get-Help. A shell built-in cmdlet. It is intended to call up help and provides useful information about syntax, programs, their purpose, other cmdlets. If you wrote ipconfig /? In a regular command interpreter, then in PowerShell you need to type Get-Help Get-Process.
  2. Get-Content. Simplifies the procedure for reading files for novices and system administrators. If earlier it was necessary to open the handle and read all the lines of the document one by one, now it is enough to pass the file to the cmdlet. To do this, write in the console C: \> Get-Content C: \ ... \ "file name". "Extension".
  3. Get-Service. Access to information about the services installed on the computer.
  4. Get-Member. Gives information about the object returned by the cmdlet and lets you see its properties and methods.
  5. Get-Command. Searches for cmdlets, returns all information about them, including information about functions, scripts, applications, and other items. In version 5.0 of PowerShell for Windows 10, the Version column was added to Get-Command, and now CommandDet displays multiple versions of the same module at once.
  6. Stop- \ Start-Service. An irreplaceable assistant for administrators. The cmdlet starts and stops services on remote and local computers.

Special characters for scripts

In addition to cmdlets, the PowerShell utility on Windows 7 and above includes Special symbols such as $ _ or (). The most bewildering icons are for beginners who have not dealt with Linux-like systems or programming.

  1. The vertical bar "|". This symbol is used for pipelined programs. In the console, it is turned on when you want to tell the command to the right of the vertical bar to accept the output from the command to the left. PowerShell uses the vertical bar for much the same purpose by combining multiple commands at once. For example, create a new username, add it to a group, and reset the default password.
  2. Function sign "()". Allows you to effectively control the process of script execution. As in C-like programming languages, a function in PowerShell is formed by enclosing multiple cmdlets in curly braces and is ready to run as many times as needed.
  3. The special character $ _. Used to write script blocks, filters, and procedural expressions. $ _ takes the value of the current object and passes it on to the next one. You can use the dollar sign without the underscore to mark or enter a variable: $ var = "Hello".

What is PowerShell ISE

The PowerShell utility comes with a graphical Windows application PowerShell ISE. It is a shell, or framework, for writing scripts. ISE provides developers with a huge range of options. With its help, you can create, debug and edit scripts, open text and XML files. Colored syntax highlighting makes testing and finding errors in the code much easier.

ISE is much more convenient than the PowerShell console and can completely replace it. Using the environment, you can copy and paste large fragments of code, run not the entire script, but individual parts of it. Unlike PowerShell, the window in ISE can be easily resized with the mouse pointer, just like when working with a regular program.

To try ISE, from the Start menu, type PowerShell ISE. If you are using not Windows, but another OS, download and install the distribution kit from the official website. After launching the application, a three-part window will open. Scripts are written at the top, PowerShell commands at the bottom, and the result is visible in the middle.

Get started with ISE and enter Get-Process in the lower window. Press Tab several times. The cmdlet's options appear next to the cmdlet and change after each keystroke. This will be your first session with the Microsoft scripting environment.

Many of the instructions on this site suggest starting PowerShell as one of the first steps, usually as an administrator. Sometimes in the comments there is a question from novice users about how to do this.

If your computer is running Windows 10, then perhaps even more quick way open PowerShell - right-click on the "Start" button and select the desired menu item (there are two items at once - for a simple launch and as an administrator). The same menu can be invoked by pressing the Win + X keys on the keyboard.

Note: if in this menu instead of Windows PowerShell you have a command line, then you can replace it with PowerShell, if you wish, in Settings - Personalization - Taskbar, enabling the item "Replace command line with Windows Powershell" (in the latest versions of Windows 10 option is enabled by default).

Starting PowerShell Using the Run Dialog Box

Another easy way to start PowerShell is to use the Run window:

  1. Press Win + R keys on your keyboard.
  2. Enter powershell and press Enter or Ok.

In this case, in Windows 7, you can set the mark to run as administrator, and in the last Windows versions 10, if you hold down the Ctrl + Shift keys when you press Enter or Ok, then the utility will also run as administrator.

Video instruction

Other ways to open PowerShell

Not all of the ways to open Windows PowerShell are listed above, but I'm sure they will be quite enough. If not, then:

Also, it happens, they ask, what are PowerShell ISE and PowerShell x86, which are found, for example, when using the first method. My answer is PowerShell ISE - PowerShell Integrated Scripting Environment. In fact, with its help, you can execute all the same commands, but, in addition, it contains additional features that make it easier to work with PowerShell scripts (help, debugging tools, color markup, additional hotkeys, etc.). In turn, x86 versions are needed if you work with 32-bit objects or with a remote x86 system.

After switching to the Windows 10 operating system, many users noticed the "Launch PowerShell" button in the Explorer interface. In this regard, many questions appeared on the network, users were interested in what kind of Windows PowerShell program it was and what it was for. If you are also interested in this question, then this material should help you.

Windows PowerShell is a scripting language and command-line program for executing these scripts. This language was released in 2006 as part of the second service pack for Windows XP and since then PowerShell is part of all operating systems from Microsoft. In 2008, the second version of this language appeared, and since Windows 7 it is this language that has been used. Files from Windows scripts PowerShell has the PS1 extension and can run like the familiar BAT and CMD files.

Windows PowerShell is a scripting language that was developed primarily for Microsoft business customers who need powerful tools to automate the tasks of managing servers and computers on Windows based... The .NET platform, developed by Microsoft since 2002, was used as a basis for this language.

Windows PowerShell allows you to automate a wide variety of tasks. It can be used to manage files, services, processes, accounts and settings. PowerShell understands many commands from the usual Command Windows strings(CMD), but it also has its own language, consisting of its own commands, which are referred to here as cmdlets.

Cmdlets (in English cmdlets) are formed according to the Verb-Noun rule, for example, Get-Help. You can learn the basics of Windows PowerShell by using the Help ("Get-Help" cmdlet). To receive general information just enter the command "Get-Help", for help about a specific cmdlet, enter "Get-Help CmdletName". For example, if we enter the command "Get-Help Get-Process", then we get help about the Get-Process cmdlet.

How to start the Windows PowerShell program

Windows PowerShell can be run different ways... The easiest option is to simply use the search in the Start menu. To do this, open the "Start" menu, enter the search term "Windows PowerShell", and then open the found program.

Alternatively, you can use the Windows-R key combination and enter the "powershell" command.

On Windows 10, PowerShell can be run from any folder. To do this, you need to click on the "File" button in the upper left corner of Explorer and select "Start Windows PowerShell".

How to use Windows PowerShell

As we said, using PowerShell, you can automate many routine tasks in the operating room. Windows system... As an example, we will demonstrate some of the capabilities that this tool has in order to make it clear how to use it.

Emptying the recycle bin. There is a special cmdlet for emptying the recycle bin called "Clear-RecycleBin". This cmdlet is useful when writing scripts for servicing computers. When you run the cmdlet, you need to specify the drive on which you want to empty the trash can. Example:

Clear-RecycleBin c:

The screenshot below shows how this cmdlet is executed. After entering the "Clear-RecycleBin c:" command, a confirmation prompt appears. In order to continue running the cmdlet, you need to enter the letter "Y" and press Enter.

If you add “-Force” to the “Clear-RecycleBin c:” cmdlet, the recycle bin will be emptied without asking for confirmation. See screenshot below.

Archiving files... The "Compress-Archive" and "Expand-Archive" cmdlets are provided for archiving and unpacking files. For example, in order to archive the "C: \ test \" folder into the "C: \ archive \ test2.zip" archive, you need to run the following cmdlet:

Compress-Archive -LiteralPath C: \ test \ -DestinationPath C: \ archive \ test2.zip

As a result of executing the above command, the file “test2.zip” will appear in the folder “C: \ archive \”, in which the contents of the folder “C: \ test \” will be archived.

List of Windows PowerShell cmdlets

There are a huge number of different cmdlets for Windows PowerShell, and it will not be possible to describe all of them in one article. Therefore, we suggest that you familiarize yourself with the most popular of them:

  • Get-Help - getting help;
  • Update-Help - help update;
  • Get-Command - Search for cmdlets
  • Get-Alias ​​- Find aliases for cmdlets;
  • Get-PSDrive - View connected drives;
  • Get-Member - viewing the properties and methods that the object has;
  • Get-WindowsFeature - View information about available server roles and features.
  • Install-WindowsFeature (analogous to Add-WindowsFeature) - installs roles or components on the required server;
  • Uninstall-WindowsFeature (analogous to Remove-WindowsFeature) - removes roles or server components;
  • Get-History - view the history of commands that were entered in this session;
  • Get-Variable - viewing a list of variables and their values;
  • New-Variable - create a new variable;
  • Set-Variable - setting the value of a variable;
  • Clear-Variable - deleting the value of a variable;
  • Remove-Variable - deleting a variable and its value;
  • Format-List - viewing the command result in the form of a list of properties, where each line has a separate property;
  • Format-Table - view the command result in table format;
  • Format-Wide - view the command result as a wide table, which shows only one property for each object;
  • Format-Custom - view the command result using a custom view;
  • Export-Csv - export data to CSV format;
  • Import-Csv - import data from a CSV file;
  • Export-Clixml - export data to XML format;

You can get a complete list of Windows PowerShell cmdlets by running the "Get-Command -CommandType cmdlet" cmdlet.

Users in the process of learning home screen Windows 8.1 or Windows 7 often run completely unfamiliar applications. One of these is Power Shell, a product from Microsoft.

What is Power Shell

If someone has worked hard on writing the product code, it means that someone needs it, for someone it is intended. Most likely, regular user will be able to derive minimal benefit from the presence of this software, but for system administrator this program- a great helper.

The Power Shell is a modern, standardized command line shell that gives you more flexible control over your Windows-based computer. In fact - the same command line, but the possibilities are much wider.

Administration tool functionality

The functionality of the software is impressive. It can be used to manage services, accounts, file storage, processes, and even servers. The shell provides access to working with COM, NET, XML objects, running external commands, creating and executing your own scripts, and performing other operations.

The Power Shell has its own set of commands, just like the CMD console, called cmdlets. The syntax of the language, the definitions of cmdlets and their parameters in this program is different from the usual, although the utility is able to recognize many CMD commands.

Well-understood Power Shell commands like cd, dir, copy and the like in this shell are aliases, or, as they say, aliases, just for convenience. Example: dir command entered by the user for the purpose of viewing file system, corresponds to the Get-ChildItem cmdlet.

How to understand the program

For a person unfamiliar with the basics of the command line, it will be difficult to comprehend the intricacies of working with the utility. Unfortunately, there are not many simple and understandable reference books on this topic.

When deciding to start learning the Power Shell scripting language, it is advisable to read the manual created by Frank Koch, or refer to the help system of the program itself. The latter is quite powerful, with a lot of concrete examples... The basic information is displayed here after you enter the Get-Help cmdlet.


We all know what the command line is, what opportunities it provides, but not everyone knows about a similar interface called. In fact, it is almost the same command line, only with much more extensive capabilities. This article will discuss what PowerShell is and what this tool has to offer us.

Definition of PowerShell

Let's start with what a shell is. A shell is an interface that allows you to take advantage of any of the functions of the operating system. Thus, PowerShell is a shell developed by Microsoft for more automated task execution. This tool is built on top of .NET and a command line shell and scripting language.

Also, there is such a thing as, which acts as an integrated scripting environment, in other words, it is a graphical interface with which we can create some scripts, and we do not need to enter all the commands on the command line for this.

The first version of the PowerShell tool appeared back in 2006 for Windows XP, Server 2003 and Vista. Presently latest version tool 4.0. Released in 2013 along with Windows 8.1.

What does PowerShell do?

As I said above, Microsoft created this utility so that any tasks with the operating system can be performed much faster. Let's say you want to see which ones are connected to the computer, and so, this can be done using PowerShell. You can also create one that will run in the background while you go about your business. If you notice unnecessary background processes that load the systems, you can disable them using PowerShell. Also, you can create a document that will store information about computer networks or something else.

Thus, using this utility, you can easily and quickly perform time-consuming tasks, as well as create any scripts or combine several commands.

In the event that you are a network administrator, then PowerShell can help you work, for example, with Active Directory. Also, it is worth noting that the utility contains over 100 commands. This suggests that it will help you solve most of the problems.

Running PowerShell on Windows 7

To run PowerShell on a given operating system it is necessary in the search, where Start, enter "".

In another way, the tool can be opened by going to the Start menu, all programs, standard and the folder Windows PowerShell.

Running PowerShell on Windows 8.1

To open PowerShell in Windows 8.1, you must enter in the search keyword"" To open the search, click Win + Q.

Another way to open is through the window " Execute". Push Win + R, the window you type in opens.

Daily use

This tool is used by many IT specialists and administrators, and for good reason, as it provides great opportunities and reduces the time for performing any tasks.

If a user has a large network in his use, which consists of several hundred servers, then it will be necessary to implement a security system that will work when using a certain service. The problem is that you need to check if this service is installed on all servers. Of course, you can manually connect to each server, but the management will not like it very much, since it will take a very long time to complete such a task.

To reduce the work time to several minutes, you can use PowerShell, with the help of which, with the help of one script, we will collect all necessary information and save it to a separate document.

Also, quite a few books have been written about this tool, nevertheless, this tool provides ample opportunities that are unlikely to be fully described in this article. Thus, if you are interested in this topic, you can start studying it in more detail.


2021
maccase.ru - Android. Brands. Iron. news