1 - Windows Power Shell what is it?
PowerShell is a scripting language developed by Microsoft that is based on object-oriented programming. The PowerShell software, which has the powershell.exe executable file, is the shell interpreter for the command line interface of a larger set called Windows PowerShell.
PowerShell commands consist of a verb or prefix and a name separated by a hyphen. They can be followed by parameters. They are called commandlets or command applets. In the command line interface they are abbreviated to cmdlets.
The Windows PowerShell software suite, not only offers a series of administrative commands, and system management, as could be certain shell including its ancestor command.com with its batch files, but also a powerful language interpreter object-oriented script.
The use of structured instructions like sentences makes it possible to memorize more simply a large number of commands. This facility is limited, however, because it applies only to people who have a minimum of verbs and words in English.
Windows PowerShell, formerly Microsoft Command Shell (MSH), codename Monad, is a software suite developed by Microsoft that includes a command line interface, the PowerShell scripting language, and a development kit. It is included in Windows 7 and Windows 10 (including consumer versions) and relies on the Microsoft .NET Framework.
Originally, it was expected that Windows PowerShell would be included in Windows Vista, but in the end the two programs were disjointed. Microsoft released a beta release on September 11, 2005, a release candidate 1 on April 25, 2006, and a release candidate 2 on September 26, 2006. The final release was released on November 14, 2006. Windows PowerShell is also included in Microsoft Exchange Server 2007 , released in the fourth quarter of 2006, as well as most Microsoft products released since.
Windows PowerShell is compatible with all versions of Windows that support .NET version 2.0.
As of March 24, 2009, Windows PowerShell 1.0 for Windows XP and Vista is distributed as an optional software update by the Microsoft Windows Update Service. It is integrated natively in Windows 7 in version 2.01. This release provides an integrated scripting console called Windows PowerShell ISE (Integrated Scripting Environment) that provides an alternative solution to the PowerGUI Script Editor developed by Quest Software. Like its Windows PowerShell ISE counterpart, it features a graphical environment that allows scripting with syntax highlighting, line number display, integrated debugger, and online help.
Since Windows 8, PowerShell has a more pronounced place within the operating system with a shortcut in all windows in File Explorer, in the File menu.
2 - Requirements
It requires the previous installation of the .NET framework version 2.0 for its operation. It was presented together with the Windows Vista Operating System and is also included in Windows 7, Windows 8 and Windows 10. However, it is not installed by default in these systems. Windows 2008 Server R1 contains Powershell installed.
Powershell not only allows you to interact with the operating system, but also with Microsoft programs such as SQL Server, Exchange or IIS. The main utility of Powershell is to allow to automate administrative tasks to the user.
The console language includes declaration of variables, special predefined variables, mathematical operators, including equalities and numerical inequalities, vector management, comparison among these, allocation operators, hashtables, boolean values, cycles and breaking them , expansion operators for simplifying complex executions (creation of vectors by means of procedure calls, dynamic creation of vectors, etc.); comments, binary comparison operators, escape characters, execution order, "foreach" type cycles, creation of procedures and functions, creation of filters, complex conditional structures (if / then / else / elseif / switch), invocation operator dynamics of the content of variables ($ p = "MyProcess" -> & $ p executes MyProcess), called methods of type "$ p.ToUpper ()", access to properties of object instances, redirection of normal console output to archives, return of values, handling of character strings by means of operators, handling of exceptions and explicit conversion of types.
One of the main functions of Powershell is to try to match the famous UNIX Perl language. Which is considered versatile, powerful and easily to interact with the operating system. Exchange server 2007 uses Powershell internally. The tendency is that all applications have their visual section and an option to see the code generated in Powershell.
The distinctive feature of PowerShell is that it is an object-oriented command interpreter. The input and output at each stage of the process (cmdlet, "comándulo") is a set of object instances, unlike what happens with traditional command interpreters, which only return and receive text.
Alias of commands
In Powershell you can create aliases to the Unix style, that is, rename or name the commands in different ways.
For example to show directories dir, ls, gci is used. The programmer can nick the command as desired. This makes it easier to work with the programming environment.
Using a single statement, Powershell can easily perform the following actions:
- Monitor counters
- Shut down or stop services
- Modify system records
4 - Implication of the prefix in the sentence
The prefix of the command is called verb4 although it is not always one. It is called this because it determines the action to be performed on the entities designated in the sentence.
List of verbs
- Add allows you to add data or information about the name that follows it;
- Get provides data or information about the name that follows it;
- Clear resets a display or variable;
- Import and Export allows you to import / export batch files or aliases;
- New allows you to create new objects or variable;
- Set allows you to define data or information about the name that follows it;
- Write allows you to write data or information about the name that follows it and can act as the report of an order.