By installing a new version of the Windows operating system, novice users encounter new program names, which they previously could not have heard and whose purpose they do not understand. One such PowerShell application. If it is preinstalled in the OS, then for some reason it serves. What is Winodws PowerShell, users often ask this question. Let's take a closer look at it.
This application is a useful tool for system administrators and developers, but for other users, especially for beginners, it is of little use. Windows PowerShell is a modern, improved command line that can provide more flexible work with the settings and control of the computer in the Windows operating system. In other words, the same command line with additional features.
The content of the article:
Features and Purpose of PowerShell
It can be seen that this program Winodws PowerShell is an interface for the scripting language, and is also a platform for executing these scripts. PowerShell was released in 2006, which was part of the second service pack and since then the program has become part of all Microsoft operating systems. The scripts of this program have the extension PS1 and are able to run like BAT and CMD files.
This scripting language was developed primarily for Microsoft business clients who need powerful tools to automate various tasks in managing computers and servers running Windows. The basis for the language is taken from the .NET platform from Microsoft.
Windows PowerShell allows you to automate many different tasks and processes. It allows you to establish control over services, accounts, settings, processes, etc. A scripting language accepts all commands from the OS command line, which in turn has a rich native language, which consists of certain commands, they are called cmdlets. These cmdlets work on the Verb + Noun principle. For example, “Get-Help”, which in English means “Get Help”. This cmdlet calls for help. To get information about a cmdlet, type "Get-Help Get-Process". In this case, the program will provide information about the Get-Process kaméletlet.
Running and running in Windows PowerShell
There are several different ways to run a Windows PowerShell program in the OS. For ease of searching programs in the operating system, there is a search box. You can find it by opening the “My Computer” label at the top of the screen on the right side. Enter the query "PowerShell" and in the search results open the program. In Windows 10, the program can be launched from any working folder, for this you need to click on the "File" button in the upper left part.
In order to demonstrate how this Windows PowerShell program works, let's try out some of its features, for example, let's clean the basket. There is a special cmdlet for this function - “Clear-RecycleBin”. It is useful for writing a script when servicing computers. When entering such a command, you need to specify the local disk on which the application is located, with which you need to perform this action: "Clear-RecycleBin C:". Next, a line appears with a request for confirmation, here you must press the "Y" and "Enter".
If the “-Force” part is added to the Clear-RecycleBin C: cmdlet, the recycle bin is cleared without confirmation.
- Let's unpack the archive using PowerShell.
- For this, there are specified commands "Expand-Archive" and "Compress-Archive".
- To archive the “C: \ file \” folder in “C: \ archive \ file2.zip”, follow the indicated command: “Compress-Archive –LiteralPath C: \ file \ -DestinationPath C: \ archive \ file2.zip .
- As a result of the execution of this command, an archive with the name “file2.zip” will appear in the above directory, in which the contents of the folder “C: \ file \” will be archived.
Basic PowerShell Cmdlets
This program has a lot of different commands applied to the various components of Windows and describe them all in this article will not work. Here are some basic Windows PowerShell commands:
- “Update-Help” - updates the help for a specific component.
- "Get-Help" - getting help.
- "Get-Command" - search from the list of cmdlets.
- "Format-Table" - an overview of the result of a particular command in the table.
- "New-Variable" is a new variable.
- "Remove-Variable" - deleting the variable value.
- “Set-Variable” - specify the value for the variable.
- "Format-Wide" is an overview of the result of the executed command in the form of a table, in which there is only one property for one object.