📜 ⬆️ ⬇️

Meet PowerShell

The fact that Microsoft in the recent past was released a fresh shell called PowerShell, I learned more than a year ago. But to try, what kind of animal is this, did not reach the hands. But the other day, on a freshly installed Window Server 2008, I discovered this piece as part of the preinstalled components, and curiosity still got the upper hand. Opened, tried to fill a couple of commands like "help", "?" etc. - As a result, a list of all commands was obtained (in PowerShella jargon, cmdlets - cmdlets), which turned out to be quite voluminous. Moreover, the list included names like ForEach, Where, which could not but arouse interest in how these constructions can be touched. I got used to the documentation and was pleasantly surprised by the found translations of textbooks on sabzh (I read Windows PowerShell RU) - the links can be found on the blog of one of the active members of the community:

blogs.technet.com/abeshkov/archive/2008/12/24/3172943.aspx


')
So, after several hours of working with PowerShell, the following was postponed in my head:
- PowerShell is no worse than usual cmd.exe
- I really liked the concept of object-oriented processing of data received from commands (cmdlets). Glad that you can go to the registry branch, for example, HKLM, as on a regular disk, with the cd HKLM: command and browse through it with the same ls and cd, reading the attributes of registry objects in a manner similar to that used to read the attributes of files and directories .
- I didn’t like the process of entering long commands and editing them (in case they are multiline). Probably in this case it was necessary to act by loading the script files, editing them separately from the shell.
- I didn’t like the syntax of PowerShella from the point of view of personal inconvenience - I don’t like the fact that you need to prefix the name of any variable with $ or $ _ when referring to the transferred object. But, I consider that it is quite simple to get used to these inconveniences, but in the code variables are immediately visible + the number of gestures is minimized.
- I was impressed with the ability to import / export objects in CSV, XML formats (as I understood it, this happens using the .NET serialization mechanism), and even more so the ability to interact with COM objects (the book describes an example in which the code in a dozen lines forms the colored table and stores it in XSLX format).
- A description of the integration capabilities of CLS-compatible .NET code with PowerShell left a vague impression of a really great achievement in the field of creating extensible administration mechanisms. (I haven’t figured it out yet, I’m very interested in how much the claimed power corresponds to reality. However, the fact that you can fasten the .NET code is happy anyway).

In general, the impression is positive and it would be interesting for me to get feedback from those people who work closely with this tool.

Source: https://habr.com/ru/post/57648/


All Articles