0% found this document useful (0 votes)
16 views9 pages

Slide 1

Research about power shell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
16 views9 pages

Slide 1

Research about power shell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
es aera was done.by: Mervat Eid Mohamed Saleh;What is a power Shell ? -PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on August 18, 2016, with the introduction of PowerShell Core. The former is built on the .NET Framework, the latter on .NET (previously .NET Core). -Since Windows 10 build 14971, PowerShell replaced Command Prompt and became the default command shell for File Explorer. -In PowerShell, administrative tasks are generally performed via cmdlets (pronounced command-lets), which are specialized NET classes implementing a particular operation. These work by accessing data in different data stores, like the file system or Windows Registry, which are made available to PowerShell via providers. Third-party developers can add cmdlets and providers to PowerShell. Cmdlets may be used by scripts, which may in turn be packaged into modules. Cmdlets work in tandem with the .NET API. -PowerShell's support for .NET Remoting, WS-Management, CIM, and SSH enables administrators to perform administrative tasks on both local and remote Windows systems. PowerShell also provides a hosting AP! with which the PowerShell runtime can be embedded inside other applications. These applications can then use PowerShell functionality to implement certain operations, including those exposed via the graphical interface. This capability has been used by Microsoft Exchange Server 2007 to expose its management functionality as PowerShell cmdlets and providers and implement the graphical management tools as PowerShell hosts which invoke the necessary cmdlets. Other Microsoft applications including Microsoft SQL Server 2008 also expose their management interface via PowerShell cmdlets. -PowerShell includes its own extensive, console-based help (similar to man pages in Unix shells) accessible via the Get-Help cmdlet. Updated local help contents can be retrieved from the Internet via the Update-Help cmdlet. Alternatively, help from the web can be acquired on a case-by-case basis via the -online switch to Get-Help. How Does PowerShell Work? Generally, PowerShell functions more like a programming language than a command-line program because it was built on the .NET framework. Power shell works with objects; in fact, everything in PowerShell is an object. These objects represent attributes (properties) or instructions (methods). They can even be made continuous to workthrough the program as an input or output. PowerShell manipulates objects with four different types of commands which are: 1. Cmdlets Cmdlets, pronounced as command-lets, are the basic single-function commands of PowerShell. If PowerShell is a paragraph, cmdlets are letters of every word in the section. One can use them singly to carry out a function and combined to carry out more significant functions. Note that each cmdlet still works as an individual function to contribute to the cmdlet output in the combined function. However, cmdlets are not written in PowerShell. They are written in another language, compiled, and made available in PowerShell. Cmdlets is a critical command in PowerShell as their function limit depends on the developer's creativity. Developers and DevOps engineers may use “pipes” to pass a cmdlet output into another cmdlet’s input as an object. 2. PowerShell functions Functions are one of the many commands used to execute codes in PowerShell. Unlike cmdlets, functions are written in PowerShell language. They are a sequence of instructions that are formed and are to be achieved simply by invoking them. its input is parameters, but the output can either appear on the user’s screen or be piped to another function or cmdlet input. There are two functions in the power shell: basic and advanced. The basic function is the simplest form of the function used in PowerShell. With basic functions, there are no built-in features of inherited features. There’s only a set of curly brackets containing the function’s body. Advanced functions are functions that have properties of a basic function as its core, but have additional features. These functions carry built-in features which give it more functionality. 3. PowerShell scripts PowerShell scripts are written with cmdlets. These scripts are used to create automation for different tasks. There are three types of commands in a PowerShell script. The “get” command is the first one used to retrieve data from a file system. The “set” command is used to edit the windows component information. This includes assigning properties to different components. The “remove” command is used to delete operations completely. PowerShell scripts reduce code complexity while writing codes and other use cases of automation. 4. Executable commands Executable commands are commands used in running executable files. Executable files have an extension of .exe and are software components of Microsoft Windows. There are three commands used in running .exe files. The first is with the “Invoke- expression” command. This is arguably the most popular method of running these files.The second command is the “start-process” cmdlet. This command starts more than one process on your device but gives the same result as the first command. The third option is typing “.\” before the file’s name. This is the easiest method, but all alternatives run the .exe file. Why Is PowerShell Used? errr As mentioned, PowerShell is a double-function attribute. o® @®@ @o @ However, the two main functions of PowerShell embed more = modalities, And These modalities (or use cases) are the reasons for PowerShell’s rising popularity. 1, Enabling task automation The first of these reasons is task automation in DevOps . As a scripting language, PowerShell is mainly used to create automation. Automation spans every use case of PowerShell. Automations are made on other scripting languages but mostly on PowerShell because of the unique format system. PowerShell is also a better option because the program is extensible with functions, classes, cmdlets, and modules. 2. Driving data accessibility Another reason for PowerShell’s popularity is data accessibility. A significant part of PowerShell use cases is administrative activities. In large computer networks, many services work independently and are controlled by a central IT admin. PowerShell offers the IT admin easy access to different data stores of network services such as file systems or registries. 3. Managing “infrastructure as code” Asa third reason, PowerShell employs a management framework that enables users to manage their company’s infrastructure with configuration as a code. This framework is called Desired State Configuration (DSC). Managers or IT admins obtain PowerShell skills to know how to push or pull configuration models in PowerShell for smooth composability as the need may be. They also need these skills to enforce configuration settings, obtain repeatable deployments and create declarative configurations. 4, Facilitating remote commands Finally, PowerShell has such a wide acceptance rate and use case because of its ability to facilitate remote command. Remote use is the new gold rush and software or tools that allow remote work to gain widespread popularity. With PowerShell, administrators can perform remote operations on multiple systems. This is possible through Windows Management instrumentation and WS-management protocol.Top 12 Advantages of PowerShell There are other shells and many scripting languages, but PowerShell as a single component has advantages that make it “pro-choice. ” These are the top advantages of Power shell for users: coe 1. Extensible format system Using PowerShell, it is straightforward for a user to format his input and get an output however he wants. PowerShell offers three formatting methods. One can easily manipulate each method for any setting the user needs. The first format method is “format-wide” In this method, a user can display only one property of an object. One can use this to fill columns in a table or make lists. Another method is “format-list.” This method allows users to display properties of objects as a list, with each property on a new line. On the third side of the dice is the “format table”. This method makes it easy for users to present output as a table. There are parameters like “Autosize,” “wrap,” and “groupby” to use in organizing the columns of the table. 2. Built-in data formats Data formats support PowerShell, that one can use to store and transfer data and make data human-readable and machine-readable. These data formats are comma-separated value (CSV), JavaScript Object Notation (JSON), and Extensible Markup Language (XML). CSV format is an inbuilt data format that stores table data as plain text. In this format, each file is separated from another with a comma. The JSON format is used for immediate communication between a browser and a client. It is an open standard format and also a human-readable format. If information is given from the browser, the information can be converted into PowerShell data using “Invoke-WebRequest” or “Invoke-RestMethod” commands. The XML format is also machine and human-readable. It is used to obtain data from a webpage, edit it and post it back. It is also used for configuring application performance in PowerShell. 3. Extended type system There is an extended type system (ETS) in PowerShell that script and cmdlet developers can use to manipulate .NET objects. This system is done using the PSObject object. One can use the PSObject object to extend object types in two ways. In the first method, the PSObject object shows different views of specific object types. This is called an adapted view. In the second method, the PSObject object provides means of adding members to an existing object. These new members extend the base object (the initial object that is worked on) by giving it additional information that can be useful in scripting. 4. Secure scripting engine PowerShell places the security in the hands of the user with the configuration management feature. This feature allows users to decide which scripts to run through visually review. Given that malicious scripts are hardly noticed visually, there are automated security policies to help users.PowerShell uses an execution policy as one of its security strategies. This execution policy determines the conditions under which PowerShell will execute specific configuration files and scripts. This policy is used on the Windows platform but can be set across various computers and devices with the group policy setting. However, this policy is only active when the user decides. When made active, PowerShell runs only scripts authorized by an identifiable name. This is a fair choice against running malicious scripts on your computer that may allow cyber threats to enter. 5. Self-service development PowerShell enables each team in an Exchange to build their cmdlets by themselves. This is a significant advantage over other options. This “self-service” model is crucial as it enables developers to build the management of their features even as they write their features. This results in better management and, in turn, quality products. This is because products are most beneficial when component teams are “in charge” of their features. This ensures the users of a well-structured feature. It also makes the building faster as one can test the feature with real codes early. This eliminates bottlenecks in the building of features and scripts. 6. Consistent API APIs like Windows Management Instrumentation (WMI) and Component Object Model (COM) used on Windows is known to be inconsistent or incomplete. This makes them inefficient in carrying requests to and from the browser. However, PowerShell is a 100% comprehensive and consistent API that 3rd parties use. This is the REST API from the power shell. It is activated using the “Invoked-RestMethod” cmdlet. This activation is simply a request through HTTPS or HTTP. The API would be sent to get data through a URL. 7. Easy automation PowerShell uses the simple, single-function command-lets tool to implement tasks. As a single- function tool, cmdlets can be used separately or combined to solve complex tasks. The PowerShell comes with more than ninety basic cmdlets. More cmdlets can be created by the developer as needed. One can also share these self-developed cmdlets with other users as PowerShell is an open-source feature. This makes it easy for developers to create automation to solve repetitive tasks. Knowledge of building these cmdlets gives a developer an upper hand over others. This advantage of PowerShell sets makes its users “pro-choice” in different settings. 8. Cross-product composability PowerShell has a great cross-product composability model, which makes it suitable for several services and products. This implies that PowerShell can be used for different services and still be controlled by one IT admin. This makes PowerShell functional in networks where various services are dependent or independent of each other, like a corporate network. 9. Easy access to information Although all command lines can access the computer's file system, PowerShell can provide access to hard-to-access data. This is because PowerShell is built onthe Microsoft.NET framework. This unique feature gives IT professionals access to automate and remotely control every Windows PC in a corporate network. With a single line of command-line code, IT admins can have deep visibility and control across every file system in their network. 10. Corporate network management Despite Office 365 Administration web portal being the central management station for corporate Microsoft Office 365, PowerShell has many useful administration commands that are absent in the latter. An example of a command is the default option for password setting. The options in the admin web portal are either for all users to change passwords regularly or for no user to change their password. Using PowerShell, an IT admin can build a2-factor authentication (2FA) system to prevent users from changing passwords regularly. 11. Discoverability One highly advantageous feature of PowerShell is the Get-command cmdlets. With this command, end-users and programmers can discover a whole set of commands and features available on PowerShell. Get-command creates a list of all the cmdlets and functions that one can find in that computer at the time of the request. These cmdlets can also be nicknamed or given short forms that can be found easily using PowerShell aliases. This helps users in the daily use of the program irrespective of experience or knowledge base. 12. Insight into Microsoft certification exams While most may not consider this an advantage, it remains a huge factor for some. Microsoft has recently been adding questions specific to PowerShell to their certification exams. While they may not require you to know the full syntax of each command, you should be able to see the use of different commands in different instances. So for those planning to take a Microsoft Azure DevOps certification exam, using PowerShell over other programs can be a better choice. Getting Started with PowerShell There are several ways to get started with PowerShell, and the process is much easier if one already uses the Windows operating system. Windows 11 has the PowerShell, application built into the OS, which can be accessed by simply typing into the search bar. IT administrators can also explore the PowerShell Integrated Scripting Environment (ISE) platform, which you can install separately. By PowerShell ISE is a GUI application that makes it easier to check, debug, and execute scripts without getting into code complications. As the popularity of the tool increases, knowing PowerShell can help simplify IT and DevOps Tasks and reduce dependence on third-party tools for greater control. Here are some useful PowerShell code snippets for various tasks:1)Working with Files and Directories: 1 List Files in a Directory: 2.Copy Files: 3.Remove/Delete File: 4,Create Directory: 2)Working with Processes: 1 List Running Processes: 2.Kill a Process: 3)System Information: 1.Get System Information: 2.Get Disk Space Information: 4)Working with Services: L List Services: 2.Start/Stop a Service: 5)Networking: 1.Ping a Host: 2.Get IP Configuration: 6)Registry: 1.Read Registry Key: 2.Set Registry Key: 7)\User Management: 1 List Users: 2.Create User: ‘sflemove user: 8)Miscellaneous:2.Execute Script: ate al 3.Variables: Eee Se ee nee obs iste eee ese Ls Sources: Website Name: 1)Information: 2)Photos: This research was done by using power point.

You might also like