Automate your Windows Infra and Apps like SAP using Powershell -- Real Scenarios | PyMinds Programmer | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Automate your Windows Infra and Apps like SAP using Powershell -- Real Scenarios

teacher avatar PyMinds Programmer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

48 Lessons (11h 29m)
    • 1. Course Intro

    • 2. Introduction

    • 3. Infrastructure as code

    • 4. Introduction to Powershell

    • 5. Environment setup

    • 6. How we use our Powershell scripting

    • 7. Powershell Basics -- Introduction

    • 8. Powershell variables

    • 9. DataTypes

    • 10. Operators -- Part 1

    • 11. Operators -- Part 2

    • 12. Conditional and loop statements -- Part 1

    • 13. Conditional and loop statements -- Part 2

    • 14. Functions -- Part 1

    • 15. Functions -- Part 2

    • 16. Exception Handling

    • 17. Cmdlets -- Part 1

    • 18. Cmdlets -- Part 2

    • 19. Providers

    • 20. Windows Management Instrumentation

    • 21. Background Jobs

    • 22. Classes -- Part 1

    • 23. Classes -- Part 2

    • 24. Classes -- Part 3

    • 25. Maintenance Setup

    • 26. Implement framework -- Setting the Stage

    • 27. Implement Framework -- Write the entry point

    • 28. Implement Framework -- Integrate the modules

    • 29. Implement Framework -- Connect to SQLite

    • 30. Implement Framework -- Connect SQLite

    • 31. Implement Framework -- Insert Data to SQLite

    • 32. Implement Framework -- Finalization

    • 33. Discovery -- Setup

    • 34. Discovery -- Understand how to discover SAP components

    • 35. Discovery -- Start the implementation using test data

    • 36. Discovery -- Complete the backend modules

    • 37. Discovery -- Implement the SAP Control detection

    • 38. Discovery -- Finalization

    • 39. Maintain -- Initial Setup

    • 40. Maintain -- Implement Stop and Start functionality

    • 41. Maintain -- Test Start and Stop functionality

    • 42. Maintain -- Write Reboot functionality

    • 43. Maintain -- Write Reboot functionality

    • 44. Maintain -- Test the functionality

    • 45. Maintain -- Scale up the solution

    • 46. Provisioning -- Introduction

    • 47. Provision VMs and other components using PowerCLI

    • 48. Conclusion

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Understand Powershell from Basics to Advanced.

Implement real scenarios hands on as we go through the course.

You will write each line of code with me as we proceed.

We will not simply learn and forget instead we will implement real life scenarios

Concepts of Infrastructure as code will be explained in this course. You will learn Powershell from Basics to Advanced. Post understanding the basics you will develop a framework to execute scripts in a scalable manner. Once the framework is in place you will develop modules to discover and Manage SAP applications. Finally you will learn how to Provision virtual machines and other components in ESXi  hosts using VCenter APIs

You will get a grip on the problem involved in scripting your environment and how to implement your scripts in a scalable manner especially when there are large number of servers and applications involved.

Assuming you have no prior knowledge of scripting you will be taught from the basics through Advanced Powershell concepts and then you will be walked through line by line on how to develop a scalable framework for executing discovery and maintenance scripts.

Then you will be implementing hands on along with me the Discovery and Maintenance modules to discover and maintain SAP ABAP servers and integrate them into this framework.

You all also understand the PowerCLI module to provision virtual machines and other infra components on ESXi servers using VCenter Powershell cmdlets.

Meet Your Teacher

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Course Intro: 2. Introduction: introduction Publishing Barbara Shell is a cross platform past automation on configuration management framework consisting off a command line. Shell and scripting language is used to automate redundant dusts. Provision gone for good on manage idea and adornments Access I t. Information for reporting on optimization applicable to cloud on on prum Ice. What are we going to learn? You will learn the basic and advanced concepts off our ship. You belonged to develop a scalable framework to orchestrate script executions. You will learn how to apply these concepts in real life scenarios like discovering, application and realignments, managing application and adornments, provisioning application and returns way. Take the example off discovering and managing a safety environments. In this course, same concepts can be extended to other application and we don't who should take this course . You want to learn how to automate administrative tax on Windows servers. You want to learn how to automate administrative dusts off applications running on these souls. You want to learn how to provision on configure Windows servers on applications. You want to develop applications and execution frameworks using power Shit. You want to write your own management? More deals using worship. How do we look firstly as Ewing nor knowledge off publish in. We need to understand the syntax on basics off publisher scripting like writing simple statements, writing compound statements like If four for each do do while etcetera. Next, we go through. Come on, let's providers and exception. Handing as thes are the backbone for publisher programming. Next, we understand what is W. M. I. How we use Windows management instrumentation to fetch management data and also a man who played the Windows Server state. Next, we also look at promoting to rent commands remotely on Windows servers from Central Management Server Execute jobs to orchestrate our scripts across source. By now, we would be a real off how to fetch the data on change the state of Windows servers on underlying applications in an orchestrated man. No, we would deep dive Oops. Concepts like classes functions on how we can create our own more disk using these concepts . Next, we look at how to use sq light databases in commercial, which we will be using in our scripting framework. We would also cover on how to call Web services as some of the applications exposed their application management. AP Eyes using Web services. Ward do develop after understanding necessary concepts applied them in, creating a framework to orchestrate the script. Execution across multiple servers in a scalable man. Finally, develop really script, more views or, to me, critical on time taking activities like Application Discovery Windows Post patching System provisioning on PS. Excite hosts using the center FBI system. Monitoring several compliance Check. Hence, our objective is not just learn martial and forget, but apply those concepts in real life scenarios off course. For the same purpose, we do have automation software like Answer Toe, Automate ICTY on application deployment using playbooks. Microsoft's come to monitor your infrastructure both cloud and on Prum ice. Also product based software like S a pre llama, an administration solution that helps manage system administration thoughts on reduce the manual steps in SMB ended on image. However, we are going to follow. We spoke implementation as it face to specifications off a customer very cost effective, compared toa about solutions and can also be integrated into the able software if necessary , 3. Infrastructure as code: interest success called I Easy. In the previous video, we talked about our objective off managing over environment using power ship. In this video, we're going to understand what this infrastructure is called. Infrastructure. A school is a process off managing and provisioning computer data centers through machine readable definition files rather than physical hardware configuration or interactive conflagration tools. The I T infrastructure managed by this comprises board physical equipment such as bare metal servers, as well as virtual machines and associated conflagration resources. The cold and the conflagration is often stored in a version control. In a natural, it means we're going to have to write potion called We're going to discover and maintain conflagrations about the servers and applications in conflagration files. We also standardize the server and application settings in a configuration file for provisioning. Finally, we maintain the cold and configuration in a version control. Why do we want to do this? Historically manage I t infrastructure wasa manual process. People would physically put servers in place and confident only after the machines were configured in the correct settings required by the always and applications. Would those people deploy the application. Unsurprisingly, this manual process would often result in several problems like inconsistency. High cost, high turnaround time hence script approach with version in contemplation configuration would be best. Now let us look at one example. We want to deploy a Web application tow cable to specific in museums using publisher. Firstly, we provisions to database specific servers with required CPU memory and storage. We installed database and confident Hetchy and replication between them. We also confident fight system and database backups. We followed a similar approach for two applications of us where every provision that CPU memory storage on back of conflagrations and also install applications on them. Finally, we configure the load balancer to balance the lower between the two applications of us advantageous no manual process all configuration automated using strips and conflict fights faster implementation time, standardized configuration, no inconsistencies. Configuration is security compliance. Here are the steps we follow using. I see approach. First, we maintain the server invent tree. We discover the software components installed on these servers by running our discovery scripts. We run these creeps regularly after every upgrade or migration. Finally, we classify all these applications in tow different landscapes like Dev curate fraud exit forced to discovery Face, we managed the in for application combination for below activities Sequential restarts Scheduled monitoring tasks to monitor CPU memory disk utilization extra perform automatic application patching Perform automatic application compliance Check in this course weevil implement points one into in detail. Three and four can be implemented by using the same approach. Now this is the exciting part Here we will understand how toe provision Williams using publishing stripping using these Andrej P. A's with specific conflagration temperance installation, off applications data basis Hey, check on figuration and Lord balances will not be implemented. What will be discussed in deep See you in the next course. 4. Introduction to Powershell: Section one publisher before getting deeper into publisher land. Learning about power shell scripting, let us get a short introduction. Potion Marshall is basically a task based command line shell and scripting language, which is built on top off. It basically helps the system administrators and the power uses to automate radius Tufts on the operating system, which includes both clinics back and Windows on, also managed to processes impartial at the state of tasks are generally performed using commanders which are specialized darknet implementation classes implemented for a particular operation, such as getting the services read. Starting off this system are restarting a certain specific service performing Hitachi Act exit. So these work by accessing data in different detest owes, like five system Registry Exeter, which are amenable publisher. While providers publish, it provides full access to calm Windows management instrumentation, FBI's enabling administrator to perform administrative tasks on local and remote systems. As we discussed in the introduction part as well, US using webs ws management and see am any building management toe remote control lending systems on network devices. Thank you 5. Environment setup: Section one environment set up. Now that we're clear about our objective, let's get into the environment set here we are going to set up a power shell environment on Windows 10 system. We mainly set a partial execution policy here, and we add horse entries for three Windows 2016 servers, which we are going toe manager remotely from the window stint system. Next, we set up the environment for three Windows to the 16 servers where we have about application servers installed on one several. We have Max TV and Central Services and on the other two servers. We have application service in start on these servers. We mainly disabled the firewall for demo purpose and also enabled remote to stop. For those who are not aware off the motor stop, it is basically used for remotely logging on to the windows now. So our first task is to understand the execution policy before setting it on Armindo Standing So partials Execution Policy is a safety feature that controls the conditions under which the progression lords conflagration, files and run scripts. This feature helps prevent the execution off Alicia scripts. Since publishing is a very powerful scripting tool, which has access to a lot of had been functions. So Microsoft has put a default restriction. So there are two things that we need to understand when we're talking about execution policy, the scope off the policy and the policy restrictions. So let us first understand the scope. Basically, there are five scoops in the president's shown and slide, the highest presidents being the 1st 1 the machine policy scope and the lowest winder local machine scope. So let's go through each off. These policy scoops machine policy When the machine policies, Copus said. The execution policy applies to all the users on that mission. You must use a group policy object Toe Applied execution policy with the Scope Microsoft Group Policy Object GPO is a collection off group policy settings which defines water system, will look like and how it will behave for a defined group off users next, as user policy scope when the user policies corpus set, the execution policy applies to the current user. You must use a GP room toe, apply an execution policy with her, with the scope similar to your mission Pause process policy. When the process Copus sick, the execution policy applies to the current publishing process. When an execution policy has to scope, the policy is stored in the promotion section environment variable that's deleted and the station is closed. So when you close the current power shell and run rent and you open a new session, it is not going to have the same kind of the section as the previous previous one. Because the environment variable has been deleted. Next is the current user when the current user scooper set, the execution policy applies to the current user. When an execution policy has the scope, the policies stolen a registry variable call contain a called Hecky Underscore current and the school user local machine scope When the local versions corpus it. The execution policy applies to all the users on that machine. When an execution policy has this Corp the policy is stored in hedge key underscore current underscore machine registry data. So basically the order off you feel try to understand the order of presidents. If a machine policy is said, it is going toe, take the highest presidents. All the other policies will not be be nullified. So and next is to use a policy the process policy that current and look. Now let us understand restrictions. So there are around seven restriction policies, so let's go through each one off them. And each off these restrictions would be could be applied to each of those cops that we have to find all those five scoops. So we'll also have a demo after this light. So let us see now each of these restrictions, all signed scripts can be run with this restriction. It requires that all the scripts and conflagrations be trusted by a trusted publisher, including scripts that you're right on the local computer. So the next one is by bus, which is the most dangerous restriction because it has no restrictions at all. Nothing is blocked, and there are no warnings or prompts this execution policies defined for configurations in which a power shell scriptures bird onto a large application or for configurations in which the publisher is the foundation for the program that has its own security model. However, we don't want to set this by US policy unless we have a huge power shell application, which has its own security model defied. Next is the default restriction. So with this default restriction. All the windows Klein's would be in the restricted policy we're going toe, understand? Restricted to the next slide on all the Windows servers would have remote signed restaurant , which we are going to understand that. So the remote sign So the default execution policy for Windows servers is the remote signed scripts can run requires a digital signature from a trusted publisher on the scripts and conflagration finds that I downloaded from the Internet, which includes download from e mails or from the instant messaging programs. But it doesn't require digital signatures on scripts, which are written on a local computer and nor downloaded from Internet. So now the next. What next is the restricted policy that we were talking earlier? The default execution policy for Windows client computers is restricted policy, so it permits the unusual command to be executed. That is, you can open a partial window and you can execute individual commands, but you cannot execute skirts that dot ps one fights, I will actually show you with them on this and the next oneness undefined. There is no execution policy set in this current soap current scope, and if all the scopes are defined us on defined than the execution policy, automatically said Arrested. And finally we have unrestricted so the unrestricted scripts can run. But there is a risk off Manisha scripts here. The difference between unrestricted and by bus, which we have talked in the previous slide, is that the in the under stricter scenario, though Windows environment actually draws a warning when you're trying to execute strips that have been downloaded from the Internet. Now let us go through the demo. So I opened the partial and Roman. So to understand, what is the current restriction policy I see Get execution policy. I can use the tap hyphen list so I can see that machine policy is not set. User policy is not set process, but current user is restricted and local machine assigned. In this scenario, I can actually call any script like, for example, get hyphen service on this local system, which is actually going toe. Give me the list off services that are running on this. So on this system, However, if let us see I rider script, I write the same script, get service in a coalition stoppages Hollowell dot ps one. And if I tried to execute this. It is going to give me an are not rights exception. So we just walked The restricted policy means basically you can execute the individual script commands, but you cannot execute a complete PS one file or a model or other kinds of configuration drives. So now let us remove this restriction. So how we do that? We set the execution policy with the scope as current user on with the execution policy as unrest and we set it toe. Yes. Now, if I execute the policy, is that the script PS one? It is showing me, although services so now I have basically released the restriction. Now let's get back doors, lights. So this is what we have seen for the restriction policy. So to get the list off restrictions that are applied on the server, you can actually, and on any system you execute this get execution policy hyphen list. And when we want to set to the execution policy, we set the execution policy for a school. And whatever the restrictions that we talked about all the eight restrictions on the five scoops. Okay, Now let's go to the next point. So this is the environment that we are going to actually try to manage using our social stripping, so we would be basically developing a framework which would manage these three servers. So what are the three servers we have? BB Osias, which contains database on the central services. These are basically some SNP processes which are running on. We have what? To application servers, which are upset about. So all these three systems belong to a single cluster. So we're trying to manage this whole cluster whole recipe environment using our portions to So what are the things that were going to do? So we're going to set up the hosts and host entries on the Windows 10 machine. That is the first step. And in the second step, we are going to actually set up the enable the Rdp and make sure the windows management instrumentation is running on each off those 2016 servers. I'm going to show both the settings right now. So what we do now is we go toe, start, run. So and goto drivers, So just already selected here on I goto TTC and I opened the host fun. So if you see the host file. The host file has all the entries that are mentioned here. That is D B A S E s applications over one applications over two and their I p addresses. So basically, we're setting this so that we can actually access our DB all the three hosts from our system. So this is the first setting that we have the second setting that we are going to do already. We have applied the restriction policy for industry now for Windows 2016. Let me take you to the Windows 2016 Sever. First thing that we would need to do is let the system come back. Yes. So the first thing that we are going to do for this windows it on 16 server is we are going to make sure that the Windows management instrumentation services running and it's an automatic more so whenever there is an automatic several restart or anything, it is still running. It is going to be running. And the second thing we're going to disabled the firewall so that we can actually connect to this. In the real scenario, the ports would be enabled on it is in the real environment But we're really not talking about security. We're talking about scripting, so we're just going to disable it for the demo purpose. Then finally, what we are going to do is we're going to go to the computer properties, advanced system settings and we go to remote and we make sure that allow remote connections to this computer. That is, hello, collections for remote desktop is set and it is applied. So this system that so now that we have the whole environment set up, no letters actually execute a test command. So basically, I'll show you how powerful the power shell environment is. So what we are going to do is we are basically going toe connect to our Windows 2016 server for the and get the services that are running on the servers. So we are going to call first, get credentials, which is going to store the credentials off the Windows 2016 server in our dollar threads. Object. So we got a dialogue here. I would enter the credentials off the window. Stone 16. So next what we're going to do ISS. We are going to call a W M. I object off class Win 32 service on the particular computer, That is D B A S E. S with the credentials. So let us see if this returns no air. Oh, yes. So we are able to connect to the remote server. Now, let us see if don't worry about those syntax, because I'm going to teach you the syntax in the next section. So here we're just checking if we are able to If our environment this problem services So I'm object, are tryingto access the first object of services? I'm sure there are many services running, so it is surely not zero. So, yes, I can see that. So I'm able to connect to the remote computer with proper credentials on I'm able to get the state of service. Thank you. 6. How we use our Powershell scripting: Section one free book. Now that we have about our environment set up for power shell scripting, we need to understand what and how we're going to develop District's and what this I was strategy going to be for our flavor. Firstly, we need to make our frameworks callable by catalyzing over stripped executions using publishing jobs. One important point to note is we need to executive the scripts in an orchestrated manner on each application cluster. An application cluster is a set off hosts which have all the components in storm for a specific application, for example, to database servers in Hitch E and to application servers connecting to the active Devi server if we need to stop the application cluster using scripting reading to stop the services. So that stopped the application services than the APP service, followed by the TV services and TV service. Similarly, we want to start the company deprecation cluster. We need to start the DB servers, followed by the TV services followed by the application servers and finally, the application services. So we need to understand that the scripts need to be executed in an orchestrated manner for each application tractor and in Palin, for all the application clusters that way I was scripting is scalable Next us the library to improve the reliability by making the execution as singleness. And in start off using conflagration files, we have a database on a client server architecture where a client application separates requests and updates. The database and the server process spawns new jobs by taking the request from the database , and each job executes our scripts. Honor specific application cluster in an orchestrated. So this this is how we improve the reliability. Finally, it iss extensible ity, that is all our scripts are more dealer in nature, so so that this improves the ease off execution extensive bility and maintain ability off the publish in court. So for discovering the application competence installed on the hardware first, the server invent trees uploaded into this sq life database. Also, the service look up, which are more deal references to each type of discovery. Scripts are loaded into the database and these service look up scripts are executed on. Each host could discover specific service types. Example s a P applications over Oracle database extra on each off these in men trees. So basically, I trade through or the whole in men tree. And for each off these inventories, we create publisher jobs, which badly execute service lookups that is, powershell scripts, which discover services. So this way it is scalable in nature. Once so, the main script the job off the main scriptures go through each server, take all the service look ups and start identifying the services and a big the set a specific debates. Next set off scripts are for maintaining the discovery landscape. Typically, we're going tohave a client server kind off framework where the U. Y there is going to be a client you are with summits sub. It's requests to run a sect off maintenance by monitoring scripts, which are uploaded in the database configuration files the strip name sign. So the server side would basically bring these requests and spawned multiple jobs and run all these scripts in an orchestrated planner family. For each of the application clusters, the sea framework will also be used for corrosion. Thank you 7. Powershell Basics -- Introduction: Section two introduction. In this section, we will get a grip on the basics off publishing. We're going to learn how to create and work with partial variables, the basic data types existing in partial. What are the operators and how to use them? Next, we step seamlessly into a compound statements like if if Els do do while four switch etcetera. Next, we look at special data types called collections and how to create and work with collections. Next, we understand functions and finally exception handling. Thank you and see you in the next video. 8. Powershell variables: section toe publisher villians. So most basic thing that we need to understand this variable in publisher Lord in any kind of district. So publishing lets you create named objects then known as variables, And these variables are used to store and retrieve values off standard or custom data. Trips on a variable name always begins with a dollar, and it can contain and underscore or alphanumeric characters the types of variables that are available in publishing. There are three types of variables user created variables. User created variables are created and maintained by the user by default. The variables that you created at the partial command command line exists only while the potion is open. So once you've closed the command line, all the variables that you created he was available get destroyed. Then there are automatic variables. Variables stood that store the state off publisher. Okay, these variables are created by power share itself and and it maintains that changes the values off these valuables. You don't have any control over this. You cannot change these variable values on Finally, the preference variables. Preference variables are also created by the coalition, but it's just that they are populated with the fort values and you can change the values. For example, the Max history count which actually stores the number of commands that are stored in the publishing history. So it is populated with the default value. But you can actually your food to change that. No, Let us take you through a simple devil, so I creat available. So first thing. So, doll of mine, maybe people on I set it to Hello. So this is how we create a medieval. So first, the variable before the variable name, you should put in a dollars. Okay, now toe access the contents off variable my where they can hit the tab toward a complete you can see the contents of the video. Now you want to change the value off this week. So you do by variable and in the value. So if I tried to see the contento value has changed from hello variable took another. So now what you can also do is you can get the output from a function or a commander and store it into every day. So let me show you. We'll talk about commanders and functions at a later point. But let me show. You need to understand the syntax. Basically, dollar processes is a condom. Get hyphen process. I'm calling a command record. Get hyphen process which is going to list down all the process and it is going to automatically store it into dollar process. Now if I check the processes dollar process, you can see all the processes that are running on my system. Right. So it is that simple? No, let's get Ah a step further. So you want toe clear this process with people clear and even hyphen Name my So you don't me? You don't give the dollar sign. And similarly, I think you can also clear the medieval name so it will also clear the process is so. This is similar to setting processes is equal to dollar. So basically, when you're clearing available, you don't need toe when you're calling the clear. Very well, commander, It You're not supposed to put dollars with the variable, so you can also remove this video hyphen name and again, we're not going to give any variable name dollar sensory and so this will remove it. Now let's against store the processes by calling get hyphen process so Now you have stored it. No, this dollar process. If I print it, you can see that it is not a simple object, like a string or an integer or something. It seems to have multiple columns and dollar process seems to be in every. So it has multiple rows as well. So if yeah, if I clear this and if I say I don't know start, lend. I can see there are 1 70 rules in this, but I want to understand or get throw some more light in tow. What? That object is actually. So if you see dollar process zero. So it has 1234567 seven columns. Okay, but this is not the complete object. You want to understand the complete object you redo pastors toe get member. So let me just show you. I take one object and I pipe it to get life. And I'm book, but and so you can see there are so many types off data, some off the mark off. Let's see what it has off. Remember, type Elia's even methods property, except lots of properties are there, which are not visible here. Right? So what I can do is I can for the filter it by saying member type property. So it will just list on all the properties that this has basically. So if I won't say the idea property Okay, so what I should do. So let's be clear the window and I say dollar zero dark. It is going to return me idea. So basically you want toe understand more about an object that has bean output it from a commander or a function or any other third party function with somebody else's develop. You can actually call get hyphen member so that you can basically introspect into that object and see what type off variable what type off died actually complex. Now, another important thing that you need to understand this you're the pass an object to and other commanders as an input or another function that we have reconnected in. So, for example, you have something called for five dollar profile, which is an inbuilt variable which is created by the portion itself and the value off dollar profiled is currently sector. Now you want the fastest to something, say, for example, you know that. Okay, so dollar and it is not case. Instead, case sensitive. You can write in any any case, any case you like. Publisher will not consider the case is okay. It's not case sensitive. So this is the way you pastor provide, or you can alternatively pass it in double courts, aspirin and the profile value will be actually passed that this this value will actually be passed. Alternatively, let me just show you I can use the function right host, which is actually going to write the output. I can say dollar. So it is going toe right. Okay, but and I can also put it in the courts. And this is my profile. I can try to death my five. So it is going toe right, planters. But if I put it in single courts, it is going toe considered the whole thing as strong. So this is a string my profile. So this year have toe keep in mind. So basically, when you're passing anything, toe a function to a command learned or to anything, you need to either put double courts or you need to pass it directly, Okay? No. Sometimes your variable names could have some special characters like hyphen In which case , if you want to create such valuables, you need toe call them or assigned them. You think? Huh? Places OK, so calling places. So save hyphen item. Is it going to let sink dysentery? This is how sorry. So I followed the dollar. Put a dollar in front of the only places. This is something. And if you want the output it so you call, it s You can use a complete and that's it. So this is one more thing that you should actually read them. And there is one more special variable that is called environment variables. Okay, this environment variable basically shows you what are your government's settings. That is when you actually go into BC. And when you check your properties and advanced settings and you see the environment variables that are listed here, all these environment variables are actually stored in dollars. Okay, So if you want to check what is dead in that get hyphen item he envy, so it will actually give you all the values that are there in that particular environment. Okay, so that is one more thing that you should remember. So sometimes your power shell might be needing some environment variables which are standard or which are custom, that you have created the government. Very settings like location off certain models, files extra or conflagration friends. So you can use this. Get me okay. And so we have understood how to basically a thigh in values to variable and retrieve the values and store complex objects into variables and then doing introspection on all those variables. And you're also understood how to access toe individual. So in the next video, we're actually going to deep dive into the data types on how, what kind of basically types supported by published? 9. DataTypes: Section two data types. So you have seen in the previous section on variables that you can store any type off objects, including integer strings at eighth hash tables into an object. So even complex types we have observed, like processes and off course services, even clogs computers. Everything can be stored in tow official objects. So this is the main difference between coalition and other scripting languages, like Bash. So publishing this highly object oriented in nature, that is, its objects can be really as complex as processes services on that simple strings and indigenous. So these partial variables are loosely type actually, which means that you can store an integer and then later on you can size Will storer stringing it OK now. Also, a single variable can contain a collection or array of different types of objects that same time. Show you an exactly so dollar A is equal to 12 on the same dollar in can contain a string, and it already can also contain them every Or it could contain some complex object like a direct train for so let us look at it practically so. I opened coalition. I say dollar is 12 and if I want to see the type than I type kid. Hi. And you can see that into 32 now, same dollars I can set it to aboard video string variable. And if I check the site? No, it is a strangled. Now you can see that it is interchangeable. So I could store any direct the first time and later on a string. Or I can even stole a collection off integer as well as a street say, for example, 12 comma would. So if I see the type now, you can see it into the net. The object. Okay, so not type variable. Okay, You can also strongly Piper publish allergic or a partial video so you can use a type attribute and cast tradition to ensure that the available can country specific object types are objects that can be converted to the type. If you try to a sign of value off, another type official tries to convert it to its type. We're going to see that if the type can't be converted, the assignments taken trains it throws an exception. Now use cars. Notation entered a tightening enclosed in square brackets before the variable. Okay, Now let's show you the devil. Oh, basically what I do is tie and I specified. Is it okay now? I try to assign value String 34. So now let us see the type of the object You can see it is still in 30. But if I tried to assign something which is not which cannot be converted into any teacher , publishing is going toe. OK, Okay. So how are we going to define the type? Strongly typed that there's bitten the square raises You're going to specify the type name and followed by Italy, and you can have it so you can have a string a car bide in a long boom decimal single. These are all the data type supported five. So similarly, you can see in numbers equal to eight. And if you try to a fine a string, it tries to convert it into an integer and it passes. But however, when you try to assign, hello it face Okay, I hope it is clear to you Similarly, when it comes to dates, you can also specify date time and you can specify in this former 09 12 91 and the date is automatically come back, OK? And also you can specify an indigent and there's going to take it So these are all the tight fit. So first, just trying going toe try to convert the date string into So another very important thing that we discussed earlier in the section ist Okay, basically, a day is a data structure that is designed designate, designed to store a collection of items. The items can be the scene by all over different time. OK, Kareem initialize and every assigned multiple values to variable the value stolen and a R d Limited with a comma and separated from the variable name by the Assignment operator equal , which is straightforward. Okay, so we're going to see this one as a demo. You can also create an initialize and every using the range operator Daughter were going toe talk about operators in the next section in detail. But just here just you can understand that if you say dollars be five through eight. So 5678 all of them Okay, So to create a strongly type Harry in the A, that is an array that can contain only values of a particular type casted a variable as an airtight. Such a string longer in 30. So I hope this is clear to you. And let me just show you how binary is defined. You can also find out a different off press will. So let me say the C is equal to I can save one bomber. I know, Omar. If I stayed on a sea, you can see it has one to have a word. Okay, So you can also What are the other things that we have discussed? So you can also use a range operator. So if I say dollars see is a good five or 50.8. So if you see dollars, see and you can see it has 5678 okay. And similarly, if you want to have strong typing, which is recommended Okay, so you just say in 30 to crack it open black clothes, dollar D as a 212 Country number four. So this is fine. Now if I try the same thing with pitch putting here, it will fail because it will clearly say it cannot convert hitch for type in 32. So it is going to fail. No alleys can also be created using percent percent. So what you can do is all a is equal to percent, followed by black It open on. You can give one to three. So you see dollars K. It has 123 Okay, you can also do it clear on this. So dollars a door Clear function I used So if I say dollars A it has gone on the objects All those objects that are stored in dollar they are clear. You can also use reassign. You can also call dollar a dark for each. If you want toe, look through this. Put in a lower bracket and use a special valuable. We're going to discuss the expression valuable later in the scores, which is very important. So what I can do is I can do a right straight win by host dollar on the score and close the statement with power back it. And it is going to print all the contention and you can also set okay, dollar e dawn and you can see that it iss are sect solid set value on one on like $10 you can see zero. Similarly, I can put level in the next time. So if you see 10. 11 and through, similarly, you can call. You don't get so get kick first. Sore. Okay, so now you have understood carries. Now there isn't other object, which is list. Okay, which is very useful. A system that collection dark generate. Doctor, I've been show you how to use this particular object. So what you do is dollar finest is equal to you. Object and system dog collections, Dark generic list. So now you have my list? No. If I see my list, it has no country right now what I can do, I can called advocate and I can put in. So it has to be a strength, right? So I can put in anything, Okay. And Ivan put something else. And if I see dollar my list So you have seen this. So we should also be able to call and I get the Knicks. And so all you have to give the object? Probably. So we move on, you can say hello. True. So it other don't room. Now if I say my list. So this is a better object when compared to strength addict, because this is dynamic more dynamic. You should be able to add more as we move through certain records in a database. Tables for reading files are logs anything. So this is a little better. Did I went back to simple Let's hash. This is also another very important want. A hash table is also known as a dictionary which other languages as letters like fighting or associative is a back data structure that stores one or more value. It has value. You can have a number off your pants. Okay. For example, a hash table might contain a series of I P addresses. And Okay, so it has a couple name. I feel discomfort. The name. I just kind of where the I P addresses are. The keys and the computer names of baggers. Okay, now in proportion, each hash people is a hashtag Look, A system that collection dot hashtag object. You can use the properties and methods off hostel in polish. So let us see how What are the fit decks for this? Hashtag So I did it my hash. Is he quick? CMS Eddie, you put in and insert off normal brackets. You use places, okay. And then you provide you can have any kind off and is equal to the back. Okay? Value us say test name is let us see. And cynical Fats has. Okay, so part of me also. So I have put in an person here. Just reason might happen. I need to put a dollar I can put in. So now, in facing my hash dollar, my hash so I can see the name has had its value is batons. So how do you access each office? So my hash Okay. And name Hattie. And what is the balance balances? So it was very quite simple. So hash tables have key value pairs, so you can also access keys and values here. So you can say that dollar hash dot He's dollar hash start. So now that we have understood, basically we have understood what the what are the data types? How you have to assign the data dive, how we can have basically type variables and using type. But even so, you can find them on this stuff. And we also talk about a raise. Talked about this. We have talked about hash tables. Next, we're going toe Get still into that exciting journey of publishing by taking up operators in the next week 10. Operators -- Part 1: Section two operators. So operator is a language element that you can use in the command or expression. Publishers supports several type of operators to help you man plate values. So these are the types off operators that we're going to discuss today. Automatic operators, assignment operators, comparison operators, logical operators, redirection operators, split and joint operators, type operators, unity operators and the range operator that we promised we would see in the leave your section. So ultimately cooperators ultimate cooperators. Calculating Humenik values. You can use one or more automatic operators toe, add, subtract, multiply, divide. And to calculate the reminder, the bodiless offer division operator. In addition, automatic operator plus and multiplication operator into can operate on strings and today says, But we're going to see that an example. So the addition operator can cattle rates the input the multiplication operator returns and multiple copies of the foot. When you're talking about streets and arrest, you can even mix object types in automatic statements on the method that is used to evaluate. The statement is determined by the type off the left most object in the expression. So that is one very important thing that you need to remember. So the type off operation is determined by the object that this president left most off. The expression left most in the expression. Okay, now let's discuss Look at the automatic opening. Let's do it ever so basically, automatic operators are plus minus into division more delis. Exeter. So if I have a numeric variable stored and publisher video, I can just say dollars B plus one. So I have a signed and I've put in an automatic operator. Sir, it is going to return a value to so similarly you for have dollar be is it called five and dollar See physical G Starla C is equal to And if I say dollar be into dollars, see? So we just right. So these are all the automatic operators. If I say dollars c B person aged policy, it is actually going to give me the morning lists. That is the reminder. So too does four. There is one reminder and that is a value that you're getting here now. These are all pretty much clear Dio now also let us say if you have a dollar A is equal to four and dollars B is equal to so dollar a divided by dollar be would be equal to cool. So you have also covered the division operators. So addition, multiplication subtraction division. They're all very clear Now let us look at how these plus and in tow operators manipulate on strings. So that was very useful for us. So let us take a string. Send off course the recess for so let us consider an example of binary. For example, A is equal to one comma, two commas, three comma four. So if I say dollar A into two so it is basically going toe Create multiple copies off whatever values that you have here. So you have 1234 and again a reputation off 1234 So that is how it works. So off course you can't do division subtraction and all that stuff. So let us try addition So dollar e so later Three assign I don't raise you go to this. So dollar A plus two. So it has just added one element. It is actually not adding to each off this, but it is adding an additional element off, so it distracts him. So adding elements to an area has become that simple so you can easily understand it Using this Now let's see the string operations. So if I have a dollar str is it could do you see and e I put in a space wanted Lee And if I say dollar S t r into two so it is actually repeating. So, as we have discussed it is basically creating multiple copies of whatever you're creating with the multiplication operator. We just quite useful Andi if I see bluff so I can use a plus operator who can calculate two streets so I can say blues plus Lee. So it is actually going to give me Bruce Lee. So it was basically can coordinating using the I hope this is care. Now let's go toe toe are commended Cooperative starting the assignment topless. So assignment operators assigned one or more values to relabel. They perform numeric operations to the values before assignment. Okay, so is equal to is the simplest assignment operator plus is equal toe increases the value of all variable specified by value or appends the specified value to an existing value. We're going to see this similarly minuses equal toe into is equal toe divided by physical Tomar Gillis is it Will do and off course plus plus and minus minus. So let us look at the examples off some assignment operators. So let me clear my screen. Now we have dollar. So the first assignment operator is equal to two. So which is very simple dollar A. He quotes too. So this is Doris equals two. So if I see the value, it is too. Okay. Now I, which is the simplest one, which we are already seen. Now let us see classes acquittal. So dollars c plus is equal to to So what it does dollars see is four. That means basically it is a short form of seeing dollars Easy go $2 C plus two. So this is what it is actually done. Now let us look for all the new mix. First letters complete. Although numeric operations so similarly dollars C minus is equal to one. So what would be the value off? See, it would be one treat. Sorry, because it was four first. Now it has got subtracted to buy this thing, which is nothing but dollars C is equal do dollars C minus one. So it was four before and it got subjected by one. So which is also pretty much here? Now let us say into is equal to so dollars see into is equal to so guess what it will be three in 2 to 6 Sadullah see will be 26. So basically, this is nothing but dollars. Easy call $2 see into toe. So the value off dollars see previously was three. So it got converted three in to do Is it called six and similarly divided by? So we have dollars See, divided by is equal to two So we're just going to get it back to three because it is basically going to be dollars C is equal to policy divided by two So previously for six and it was six divided by two. It has picked up three so it's very clear no more Gillis Soemadi Ellis is nothing but it is a reminder Reminder is going to be stored. So now the value off see is three. So what I do is dollar dollar, see, model ISS is equal. Do. Okay, So do. And if you see the value of policy, it has won because three divided by two. There will be a reminder of one, and the one has been assigned to this and of course, the plus plus and minus minus operators. So dollars see plus plus would make it value off policy as to and dollars C minus minus would again counted down by one, and you will get it too. Now you could apply the equal to and plus sequel toe to basically your strengths as well. So you have dollar X as they could loose, and we say dollar X plus is equal to leave. So if you see dollar X, it is going to be closely so it is that simple. So you're operations on string also is very clear off course. You can't do minuses. Equal toe into is equal to one marvelous and plus plus and minus minus under string variables. So certainly all those assignment operators would basically be applicable toe only numeric types. Now let's go to the next set off operators. They are very useful operators, which is called comparison operator. The composition operated lets you specify the conditions for comparing the values and finding values that match a specified pattern. Okay, so basically, you're going to match different aspects off multiple variables to variables or to do or more A levels. So to use a comparison operator, specify the values that you want to compare together. Okay, with an operator that separates these value so basically two values, you want to compare them for something. So so we have equality. So, basically, if two values are equal, you could use hyphen e que They're not equal hyphen any greater than hyphen GT greater than equal to less than less than or equal to. So all these would be useful for your. Except for the 1st 1 and the 2nd 1 you could use all the rest below for unique types, right? And now the second oneness, the replace operator, You can actually replace a particular string. There are billions offered that there's I replace and see the place as well, which is nothing but case sensitive replacement. We're going to see those examples, and we also have type, okay, and we also have matching. So matching, basically is fostering string matching so like not like match, and not much so the difference between like and match or not like a not matches like uses simple pattern that is a wild card pattern. But as the match uses projects expression. So I good expressions. So that is the only difference. And the final is the containment. So basically, you want to check a collection. If a collection has a specific type off object in that collection, so you use contains and of course, the negation office, nor contains that in would be the opposite. So basically, you check an element is present in and collection, so contains would be like a collection contains an element. So they're just complimenting each other. They just reverse operation. So that's the only difference. So let us look at a comparison operator examples now. So basically, uh, we're going to look at equality, so Legacy Dollar X is equal to five. And why also is a quick five so you can say dollar X hyphen Que god? Oh, so it returns true. Now if I change the value off, why to six and if I run the compassion again, it would become force now. Similarly, you have. Let's try for strings so dollar A is equal. Do truth and dollars B is it will do Lee, And if I checked dollar a hyphen, Kiku dollar be. It is going to return faults If I put dollars B as it will do, Bruce, same as this. And if I check, it will be true. So you can also use it for, um a string comparison. So just the compliment to it is not equal to. So if you just instead of equal if you use Nordic will Look, here it is going toe show it as false because equal do is true. The complementary to it is false and off course, less than equal do greater than equal toe. All of them would be for all your uric types. They will not be used for your strict terms and it doesn't make any sense, even using it for strength. Now let us see. Replace. So for replace. Let us say you have Bruce. I'm using the same string, so I don't want to change the stream. Replace, Have you stab toe order complete. Replace Bruce Coma De Bruce. So now what happened? So the blue string in the Bruce Lee has been replaced by the bruise. So it has become the Bruce Lee. So that is how you check the replace and the next operator is that type is or is not. So this is also very useful. So a letter safe dollars a is equal to 10. Then how you use it? This dollar a hyphen ease and you give the type Okay. Type is what? And so diapers. Sorry. So you have to specify in places and it just coming out Death True. That's going now if I replace dollar a tow, a string type and if I do the composition with the same in it is going to return to Britain has faults Now the complementary to it is nothing, but he is not. I can just type end the order complete It is going to give me true because a string so dollar is not in has become true. So that's it. Now let's go to the next type that is matching that it's like and match so and like. And match can be applied to not only strengths, but also raise. So let us first try to see Harry so stream. Sorry. Uh, blues Lee. Okay, hyphen like while card. So this uses wild card, which is true. And you can also say Ah, so it's not like would be not like so you would basically use and o t not like And it is going to give me the faults So it is very clear here Now let us try. So you have used white character here right now If you want to use match instant So just replace like with match and the star That's it. So because it is going to search for using regular expressions so you can see deuces existing here So it has returned true. Now let us try to apply the same concept in Ah okay area of strings Basically So dollar str is equal to and I see coalition Okay and bash. Okay, Now I can say dollar str hyphen like star shell So basically it is going to check for all the elements which has a shell. So it is publishing so the 1st 1 Okay, so this is also very, very handing. So basically it is going toe Take your airway you can search for do a wild card search or you can do a regular expression search using either like or match, respectively And it's really powerful And it's that simple to actually read flavors through an area and search for a specific street. Okay, so we have understood like not like match not match. Now let us see contains So contains us. As I told you earlier it is only for collections. So let us create a collection again. Collection is nothing but in every five. Ok, no dollar a hyphen. Convince one which is true. And if I try six It is going to return for us because six is not existing in dollars, so color it contains and not condense is just complimentary now opposite I mean so now let us see in So what you would say one in hyphen in in fact hyphen in dollar. So which is true? That means it's just opposite you Just write in an opposite fashion. That's it. Now if you say six hyphen in dollar A, it would return false because six is not part off a secretariat and forts. So this is all about comparison operators 11. Operators -- Part 2: logical operators. So publish a logical operators connect expressions and statements allowing you to use a single expression toe test Multiple conditions Basically So it is like you want to check Onda Operator, for example The examples are very evident in clear here So one equals one and two equals two witches and operated That means board should be ah satisfied which is not happening So it is going to written false and our operator so one equals one or one equals two Yes, one equals one is true So it is going to return True Saar Operator, That means exactly one statement Only one statement has to be true Okay, here C one equals one Zork two equals two In fact, both are true so it will return falls only one off them should have been true You have got to have got correct Not not is just on opposite So not one equals one So one equals one is true not off true is false So that is how it is evaluated So one is equal to one which is true not off true is false Okay. And you can also use an exclamation for a Not that is not one equals one. So which is pretty evident. We really don't need toe do any kind of far the demo over here. It's evident here itself in the science. Let's go to the next one. Next. Oneness. Redirection all this? No. By default. Publishers Sensex, common or to the partial. Consoled. Okay. However, you can direct the output next four. Okay. And you can use redirect error output to the regular off puts tree. Okay, use out file command, Let which sends Come an output to it. Next five. Okay. Typically, to use the awful command, let you need to use its para meters, such as encoding force with no global perimeters. Okay, use p object commanded. We will be seeing all these things in our really scripting. So you don't need to really worry about this. So let's go to the next next part. So basically you have different types of streams that have been defined on the operator, that justifying okay. And so one success tree to is the other. Stream three is warning stream for this verbals five his debug and six is information and starters. All streams. Okay, so the redirection operators enable you to send streams off data to a file or to a success output. Okay, I will tell you what is the success. Or you can see this is the sexes help. Basically. So here you can specify before the script. Then richest stream will be getting into the sex is OK, Andi, I'll give you them off this as well. So let's go to the demo first. So let us clear this very clear this screen. Now I'll type a command the i r fi colon, okay, and coma and a fake directory which is not existing. Okay? And I take the error stream. Okay, which is nothing but to and I send it to the sexist re. Okay, percent one and greater than dark B a r one. So what I do is dark slash one. So what distresses it do this too greater than one? Okay. To redirect the error, streams toe the success tree with the greater than to send this sender result to a success Tree five. OK, so that is basically what it is doing. Okay, so the greater than one is nothing, but it is redirecting toe sexist re and who is nothing but your So if you actually see your slot slides So let me just take you back to this light. Who is the industry? So what were put here? Who? Greater than 1%? One. So that means the other streams are being redirected to the second stream. And at the creators, greater operator, which is actually used for are sending it to a farm. So that does help you now if I hit enter. So, basically, now, if I look at the file, they had one daughter long, so you can see the sexists message, which is the C drive to see dry and the fake directory. So there is no fake directory, so it does actually given it Adam. So this is very useful when you're actually trying to redirect your streams. Error streams were different. Fire sex extremes, very different file. So it was very, very useful for us. Now, next to this, the Split operatives the split operators splits one or more strings to its substrates, basically, So that means it can words a string into an airy So that's it. You can change the falling elements off the split operator. You can also specify the deal emitter the maximum number of strings and other conditions. Okay, so let me just give you a table. So basically, what I can see is so let us a dollar str is equal to Okay, read yellow blue. Okay, now what do I do? I just say dollar str hyphen split. Okay. And so you I made a mistake. So hyphen split and dollar So you will be able to see that this is actually string And this is scenario you can actually checked out as well. You just assign toe variable and just see dot kept Okay so you can see that it is so This is also very useful operator where you would want toe slipped and converted it to an airy Take the first video Take the first element or the second element of the third element based on your your d limiter. So we can also specify the d limiter here. So how do you specify that the limiter let us see So basically this time you specify is the letter Say you're str has caught de limiter s comma. So the deformity Demeter is space whitespace Single white space. Okay, now what we do Dollar str hyphen split and you given the limited off so he tests actually split proper using you could have differently limiters. So this is also very useful and commonly used functions that function and let's go to the next one. So the last one the last operator is basically in fact not the last operator eyes while checking last the join operator. So the join operator is just on opposite to the sprint operator where you would want toe Can cattle eat and airy into a strict book you're getting back from? It's just the opposite off what you are wanted to achieve in the spirit operation. So what you have to do for the join operator so you can't just say join and e home a B. C. Okay, so this is an added. You don't like eso. It will still be in every so how you would want to join them together. We have to put in places so this is very important. OK, so you can see that it has joined all these things ABC okay or alternatively, you can define said dollars a physical to he Homa be Homa. See? Okay. And then you do join dollar. So it is going to come. What did it basically done? Captain ate everything so and they would get converted to a string which is also a very powerful. You don't need to put in loops and you don't need to keep on adding and all that stuff. So it is, Dexter. It is very important to understand these basic operators in partial. It is going toe. Make your programs short and easy to read and very efficient. So just keep all these points of your mind. I request you to do that. And then finally the high pockets. Okay, The Boolean type operators ease and is not so which we have already, which we have already seen in the previous lives. Right? So you have easy is not a nationalist as okay, so he's is nothing but whether a particular valuable is also particular. So that is how you have to it again. I'm sure you do. And then, as basically gone words, it okay, so you can convert Deep. Asked this so it'll automatically converted to do a daytime. So let us just check this one. So basically get hyphen deed. Okay, is off. If you see this beat time. Okay, so what? I'm going toe check here. Get hyphen deep. Okay, get hyphen. Date hyphen, ease. And you need to check. So it is too. If you had put in string, it will have become force. Become false. Now another. The compliment off it is is not basically so. If you put in is not here, it will become true because it is not a string and people I come true now. Ass ass is nothing. But it is actually going to convert your this thing in. Do a specific type seven has dick time, so it does actually converted toe. Okay, so you can say dollar d physical to this and dollar the dot Get Kai it this now that we have completed, though, I probably go the next operator that we're going to talk about this the unity open in every operator we have already covered actually, So we just look at it, have a glance. So the unity operator is basically plus plus or minus Myers incremento or decriminalize variables or object properties, and to set in tages to positive or negative numbers for example to increment variable from 10 to 11. You type dollars sleeplessness. Take that simple. So you don't really need a demo for this. So you never operated? It's basically used in four groups. So we're going toe. See the for loops where you can clearly see How do you know the operators are going to be used or even in a do? Or do I look very want to be some kind of a counter you could use to see into the open? The the last operator is the range operate. So the range operator which you have seen in the previous lecture as well, is just a shorthand way to set of parents. So let me just show you how the range operator works. So you can just say dollar E is equal to fight the nine. So which is nothing but a dollar? A. If I or put it, it will have 567895 night 5 to 9. It is something like that, so you can also discriminate it. Okay, so from dollar B is a golden 9.0. So if you're tired, see dollar be so it will be from 90 10 65 42 10 So it is very easy. You If you have consecrated numbers and you want to initialize them, this is the best way is just a single line statement, so it is really useful. So if you understand operators very well then the statements that you're going to write in the next and the next tutorials will be really efficient. Onda will be easy to read as well. So that is one thing that I have to remember. Okay? No. The next video. In the next video, we're actually going to look at compound statements like if statements do statements, false statements, sweet statements. Exeter. So that is going toe be even more interesting. Thank you. 12. Conditional and loop statements -- Part 1: Section two Conditional and Loop statements. So, firstly, let's look at conditional statements. So we have if, and such as conditional statements in publishing so you can use if statement to run code blocks. If a specified conditional desk evaluates to true, you can also specify one or more additional conditional deaths. Okay to run. If all the Priore you desk evaluate to false, that means all your Priore. If statements are failing collisions, you can run the block off court. Finally, you can specify an additional court block that is run if no prior conditional tests value. True, that means you specify a set of conditions. If those conditions don't pass, then you can have a default collision, final condition, which is going to execute. So that is basically you have. And if followed by a single test, then else if else, if you can have multiple l serves and finally the else statement. So if all the else it's also feel, then the final l statement is going toe get executed, that particular block or that particular sect of statements, is going to get executed. Now let us see an example. So now from the one we're not going to use a portion, in fact, were reduced power. Shall I see? So let me just show you the partial. I see. Don't. So it is a wonderful tool which is provided along with potion by Microsoft itself. So here you should be able to write complex compound statements. Okay? And we're going toe, Understand? As we go, we're not going to have a special lecture on partial. I see. So what you have to do now this you just need to click on new script, okay? And here you're going to write your skin. Okay, let me just show you a dollar A as they can't do 12. Okay. And then let me write my statement, and we will understand family how we use it. So you see, you can use this hyphen gt two if is greater than two. Okay, That means a is greater than two. Then you execute a specific set, okay? Otherwise, that is else. If Okay, if dollar e hyphen e que to that is if a is equal to do execute a 30 off statements under these braces, we have not yet given what should be executed. And finally, a global statement which does not satisfy if it does know is not greater than two. And that's not equal to us. Well, so you can see this in Texas. No, it's so simple. So what I do, I just Clinton so right host and value off value off a is dollar. So I told you, right. You can actually see dollar a so you can actually put in thing in the double courts Norton single courts. So you can put this off. Is this OK? Which is equal toe to okay. And none off the conditions ever of conditions. Satisfied? So I'm using copy base, just toe. Make it faster. So off the above odd satisfied dollar p. Okay. How how do you execute first? You can save the script if you want, so I can just put it in my documents in this and take a new folder. I can rename this folders my scripts. Okay. And just and this Okay, my first. My first Dr B s. So we're going toe save the file S b s one. Okay. PSM is nothing with partial model. We're going to check for other extensions as we do our program. Okay, So small spelling mistake. So I see this Good. Now, if I want to execute the complete script, all I need to do is executive this. Okay? The script is about bc click OK, and see the value off is 12. So this is what court executed. Okay? Because it is greater than do Okay. Now, if I make this too and I can also select these execution and execute only the selection. Okay, so executive this. So what happened? Value off the value ill off a is two which is equal to do. So this is what got executed. Okay, Now for made this one the third and we shouldn't get satisfied. I'm going to exit. Select all this Quite is again executed. See, not number Ever condition is satisfied because values one, which means it is neither greater than true to our equal to two at that's what else? Statement got executed. Okay, so now you have unrestricted. If statement. Now, let's go to the switch statement. Let us understand the switch statement, which is slightly more complicated, but this really very, very useful. Okay, now check condition in this good auto function, you use a if statement right? The if statement can check many types of conditions, including the value of valuables, the properties off these. So basically, if I go back, you can have different conditions here. Okay, So if is greater than toe on the type, offing is something else, and you can put different kinds of conditions. OK, but now in switch, you see what you're going to check to check multiple collisions, use a switch treatment. A sweet statement is equal and do a CDs off if statements, but it is much simpler. Okay, this is the sweet statement lists each condition and an optional action. Okay, if a condition obtains the actions performed. Okay, if a condition often so basically what? How is the food statement? Looks like. So basically, you have a switch and you have a test value. And if this test will you satisfied any off these conditions? Any satisfies any of these conditions than that particular action is executed. So, for example, if you see an example, switch four common to let me just take you in, sort off this. Okay, so now I'm just right. Dollar e is a quantum. Okay? No, I If I switch statement switch. Okay. dollar E on A I put in a curly braces, and then I see if the value is one Okay, then I just friend like toast, and I put it in double courts. You won. I can have this in multiple lines. Assessment. Okay. To make it clear, you could have multiple statements in this. That's why it is called is a compound statement. And I can put in two or letter C. It is 10 on and post. Well, you this. So the advantage of Publisher High C is it will also show you if there is any kind off. Okay, technically, So I just select this and execute so you can see the value of 10 became true on let us Scots it too. It has just executive this particle section off court so you can have multiple lights of court here. No, let's go back to the sweet state, but see more generalized kind of a situation so you can also run multiple six. Okay, like you can personality to a switch in sell off, Just parting a single value so I can say dollar B is equal to okay. And I say four coma to okay, on. I like this. It's treatment again. Switch dollar beef. Okay? And I see the value is one. Then you just put in one. Okay? Value. It is one. Let us it ISS and you can just copy this particular section hold. And if it is to, then the value will be too. Okay. And if it iss three values going to be three, and if it is four, I was going to be this. Okay, So I should have put if, as it effect so and what I can do, I can just for right it. So it is more clear to us. Sorry can transcend time. So now let us run this particular what happens so you can see it got executed for four first. Okay? And it printed out This is four. And let God executed for two and it printed out. Okay, Now, that could be another variation off this. Okay. You want to break once the switch? Any one condition is satisfied. You want a big so you can that you want to finish to finish off. So just introduce a break statement here. So if I put in a break for every off, he's like to see the behavior. Okay. And now I execute the whole thing again. Let us see what is going to get executed. So you can see it is four. Which means only the first item got executed. The condition got satisfied and it broke out of the search. And it is not going toe. I trade through the next elements. So this is one more thing that okay, now let earthy the other variations that we can have better. Uh, what do you say with this switch statement? Okay, so let us see the most genetic way to represent out its statement. Okay, so a switch statement can be having rejects. That means a regular expression, a wild card, OK, and exact on a case sensitive and value followed by the condition and the false statement. If none off these get executed, that is none off the string number, variables get executed. It could have an expression on a statement list. Okay, Executed. None of the conditions are satisfied. Then the defaults treatment gets executed. Okay? Notice goto or a simple set of examples in this area. Okay, so we understand how useful the suit statement is, basically just abstracting everything for you, right? So I'm going to clear this now, let's say but still, you see, the value of B is still existing here, right? You see, the water company shows me there are values but that some of the new session. So what I can do is I can just go here and click a new publisher. Tap OK, and followed by new script. So you'll get on your script here, and you can see if this see mine. Second. Okay. Dark be as and I seen this. So now here. I don't have dollar e anymore. You see, It is, uh it started to find here, whereas here it is, because it is a differential. It is holding its own. People's here. It doesn't holding its own women status that point. It's OK, you can do lord of Testing. You can open multiple tabs and you can do your well on separate tabs on separate sections and see how how your court is behaving. Okay, Now let us see. What we'll do is we'll write a complex. Which statement? Okay, so basically, we have a best variable. Okay, which is nothing but a hash table. So you know how to define hash table. So we need to specify like this. And we have name value. Pat's right test is equal to pissed. And let's support this and double courts and then seven Colon, can you put a semicolon and then you have tests two is equal to Yes. Okay. And no, what we can do? How do Right there. Test. Now let us say I execute dollar death docked to string. Okay, so it's not a completely let us execute disc complete thing and see what it is executing. What is the value you just giving us system nor collection. Start Pashto. Okay, now I'm going to write a switch statement. Okay, so switch okay. Hyphen exact. So we had using the exact phrase here and dollar test your s variable. Okay. And I opened the curly braces. I closed very British here on I checked the exact value off. This is system system, dark dot collection, Dark house. Okay. And followed by the bunch of court. That supper is supposed to run if this value is direct. So I just tried right host. Okay. Hashtag let me just copy this and put it here. Okay, on the second testes. Deft. And so right. Toast. Again. I'm hoping this one on and putting It s okay. So I can use single courts or courts. OK, but if you have a levels used civil courts, that so let us execute this piece of court. So I want Mexican time dark or time to use this. Okay. What? I can select and execute this This so you can see what it has printed investment system dot collection or hash table. So we said the test value is automatically converted to a string and an exact match has Bean tried out, and this has matched and you're desperate. So that is what is your exact statement? Okay, Now let's try a wild card statement. Okay? I'm going toe show of why Card. So? So while card letters, just go back to the publish this hour presentation just to show you this impacts again. Okay, So, uh, so you can see that this basically what we're trying, the exact you can also use while card. You can also use rejects. So let's see what you got. No. Okay. Why? You card And the value. Right. So that is what we're going to do here? Onda, let me just copy this and put a door here, okay? And I just put in some comment, okay? So just to show you how it looks like, how this interaction and we don't need to keep going sitting back and forth between the slight and this. So now, uh, letters go back to our example. Okay. Why so right? Switch. Okay, hyphen. See, you're getting in order for less. Well, wild card, OK. And 14 little C and I opened the place is closed places here. Okay, on. Uh, I can't. What is toe? Sure this at least one should be there. Right one. And that's why it was giving it up. Okay, Right. Toast this one. And similarly, I could just copy this. And I say to I said three on. I can just see because it's quite star. I can see efforts star. Okay? And I can actually this guy Yeah, and see you, IHS. Okay, if Oh, stop. Okay, Now let us see how would get executed. I save my script in case I lose it. I just select this electrocute only this election that you can see the value is therefore stuff. Okay, Now let us change this to exact so sorry projects. So we have checked Wildcard, We have checked. Exact. Let us make it magics X on lettuce. Make this f you okay? And letters check. Default are the defaulters. So if not think matches the default set of statements should get executed right by toast. Nothing matched. So that is trying to execute this NC. It's something wrong with this. Yeah, So let us. You can see that. And nothing matched. We didn't select the lower races. I guess so. If nothing matters, the default is going to get executed. The defaults it. So this is how you for the rejects? I can actually make this effort instead of making it a four star on if I execute this. So it is matches. Okay, So the logic, sis actually matching. So you have another very interesting variable that you would want to understand. Okay, which I have not talked about. Eso let me go back to the slaves. So the switch statement can use dollar underscore and dollar switch automatically labels OK for let me show you. The dollar underscore. So dollar and the school is a special kind of variable. So let me go back toe the dollar and the score. You so so like a C. I was writing a simple statement. So dollar underscored is something like this. Okay, so that means it is so switch. I take best. Okay, Close it. Okay. What? I can do this. I can put in condition. Okay. Fash I see dollar underscored, which is nothing but this. Okay, hyphen years. Okay, I'm using the ease operator. And if the dollar is called, that is whatever value I'm passing within this. Okay, which is string, then you see, found string day. Okay. And then you can also give a value. Okay. What is the problem here? So there is something wrong here. So I have to put in a race is close. This place is right. So this is how we have to put it. So that means if the value that has bean sent is a string, then you're protesting. And if the value is best, then you light the values best. Okay? Okay. This bunch of cold. So you will see board the conditions got satisfied. That is founder AR ight string and also the value off the string is test. I could have put in a break statement if I want, either. If only one condition is required, I can put in a blade statement here. And if I execute after the first condition is satisfied, the the whole switch statement is going to get exited talking. So that is how you can actually put in their bring statement as well. Okay, No, let's go back, do the next set of statements. So we have understood the special variable as well automatically labels. We have understood the wildcard similar toe case sensitive on second. Okay, So the value valuation will be done as cases, and you could also use hyphen file file name. That means it will actually get the value, whatever this value is from a particular file. So the power shell has made it even simpler because many kinds of conditions, you would want to store it and in a particular file so you can directly to treat the sick statement itself. So this makes terse statements. Very compact, easy to read. I'm very, very efficient. Right? So that's why you need toe clearly understand all these statements before we get into the actual script. 13. Conditional and loop statements -- Part 2: the next is the fourth group. So all the loops now that the condition certain. So we are going to go through four drums. So the four statement, also known as the Four Loop, is a language construct you can use to create a loop that runs commands in a command block , while a spacey fact specifying the condition evaluates to two. Okay, so basically, you haven't innit condition. If it gets satisfied, you initialize something here and then you have a condition, and then you have a order increment or a criminal and a list of statements that could exit , Captain. Okay, So for example, you want toe right 1 to 10. Okay. So what do you do? You say, doll rise equal to zero and the owner I list and I've got one. Sorry. And dollar, I less than or equal to 10 and dollar, right plus plus. And then you Okay, so let me show you this exam so it is very, very simple. Now I greet another coalition tab. So and I click on new script. Okay, which is specifically going toe Do it for this. I say my her daughter be It's one okay. And Now I like my for the first followed that we're going to write. So you always remember You should start a dollar for an evil evil. So even But in the for loop the dollar, I should be starting this semicolon. Okay, that is how you separate next. Is your condition basically dollar? I hyphen less than or equal to can. Okay. And I don't like less then so we need to put this as one. So it will still here it will go. And then it is a unity operator. Off dollar I plus Plus, that means it is going toe increments, the dollar income in the eye. And I write hyphen host Donna. Okay, so see, you have North's impacts that assessment, and you can exclude the whole stuff. And we forgot, don't you? I didn't know. I could not understand. Why didn't show it? So if I execute this, you can see it has sure it has printed out. Want to. So basically that I value started incriminating for each thing. It was incremental once by one step. So I think One printed two, then three, then four and so on. Okay, No, did this? There are other kinds off. Labour's off this blue book A for loop. So let us go through that. Now that we understood the for loop, the next one is for each. Now the Forage Statement is a language contract for stepping through our hydrating through a CDs off collection, off items. Okay, The simplest and most typical off collection to travel is to travels. And every day written off four loop, it is common to run one or more commands against each of the items. Basically. So let me just show you and let's see how this So if I say dollar letter Hedi a sequel to hey be I see Dean. Okay? And I can't write for each. Okay? Don't know. Letter. I create a new variable called later in. Okay, Dollar. You don't have hyphen here. Remember that. So it is not a condition. A lot. So it is that you actually so Lector, he okay? My chest have I can have a bunch of statements here, but I'm going to write a single statement off. Right host dollar let Okay. No, I select this sand. If I executed so you can see it has executed e b c So basically for each is making your life a recent Okay. Otherwise what? You must you can happen. If the college is not existing. Then you should first get the count Dollar account physical to follow. Literary Daut found. Okay. And then you take this particular statement. Okay? I use a court. Sposito. I use less than, uh, comb. Let's stand count. Okay. Dollar count. We start from zero. So I zero I was less than the account I plus plus. And you write this coast, See, you have to create a new variable you have toe take it off. So many conditions and all that stuff. So I don't know. Ah, letter every and we see dollar your daughter. Now when we execute this one, it should give us the same condition. But see, forage, you can understand the life is much simpler here. We just created unit available and the for each automatically assigned the each item within the literary. Do it and you can operate on it. You can have multiple statements, so I hope this is okay now. Next. Next. This for each is done for the next oneness the while loop. Okay, so the wild statement, also known as a lie, is a language construct full creating a loop that runs commands in a command block as long as the conditioner test evaluates to true. Okay, so the wild statement is easier to construct on the far statement because it's simplex is much less complicated. Okay, it has No, I I Plus, there's nothing is there now? In addition, it is more flexible than the 48 statement because you specify a condition. Just a simple conditioning test. That's it. Til the condition is satisfied. This Why? Look, pretty eyes, eyes going to keep running. Okay? Yeah. While statement test in a vile statement. Control harmony. Times the blueprints. So basically, we can say, while dollar value is not equal to three to keep incriminating the dollar, Val and right. So you're doing the incremental Everything in there was. Let us see how this study. So I will put it here itself. No. And I will say dollar viol is equal to zero. Okay? And why don't look while is not is not equal to three on. I first incriminate the dollar van door. Love last plus and hyphen. Most you can see now let us execute this one so you can see the first time it has gone in. In prevented one. It has attacked one again. It went in and checked the condition. One is not equal to three, which is true. It has gone down again and it isn't committed to two. Similarly, it's and German treated three and when it came back and saw three is not equal to three is false. So Egypt So it has typed only one toe. Now later, see another. So what happens before this bunch off court executes your condition is firstly valued relative Prior. Sometimes you would want the condition the bunch, of course, to be executed at least once. Okay, In those scenarios, how do we How do we pick it up? Those that it's nothing but do wife. Okay, so the do keyword works with the wild keyword or the until keyboard to run the statements in the script block subject to a condition. Okay, unlike the related. Why group the script block in the do loop always runs at least once, okay. And then notice after the execution. It is going to check for the conditions. Do I Look is a variety off my loop. OK? Even do I group The condition is evaluated after the skirt block is Ron in the wild loop. The skirt block is repeated as long as the condition is true. Okay, so this is the thing. Now there's one more thing like do I hope you also have do until look ok which is just the opposite off Dubai. OK, which always runs at least ones before the condition is evaluated. However, the tip broke runs only while the conditions falls So do world runs When the wild condition is true Do until runs till the until conditions force that is this simplest. So let us try this as well. So let us say we have Dollar X is equal to one comma, two commas, 78 seats. Okay on dollars sound is equal to zero and we see Do so and put in a bunch of statements here And I say while dollar while dollar X off dollar a Okay, donor e I need to close it correctly is not equal. Okay, so this is all very condition and here I do Dollar found plus plus is actually not required and dollar e plus plus, So I also initialized dollar 8 to 0. Okay. No, if I but I doubt dollar a let us see what is going to give us. I'll explain to you the whole it's impacts everything that we clear this first. Please get this so you can see the viol us come to three Battery. That means 012 entry. Okay, it does executed the value off it has executed till three. That means if I say taller X off E if I execute this, I don't see this little So what happened here? So let us put in some more. Actually, we can put in 12 and 52 now if you executed again. So the moment it has become zero. The moment it started looping in it started increasing the counter which we're not using, of course. And it is also increasing dollar A. And it has checked dollar X, soft dollar A. That means it is going through each element. And once it has found a value s zero s So it is a value of zero. So Norc equals zero has become false, and it is coming. Okay. How do you can also shoes in idle Eudes obviously search for equal in sort of an article. That means it will keep on going until the value off dollar X is equal. Okay, so we can also check this. So what does the syntax here Syntex that are here? Do on. Do Sorry spelling mistake. You and I L so yes. Now, if you'll see it is going to give you the same out. So that means I'm Bill. This is false. It is Keep on going to go within the loop. As Celeste, it becomes true. It is going to come out. So you can you say they do while are you can use later that So this is the end off the section. So in the next section, we're going to work on functions. 14. Functions -- Part 1: section two functions. So a function is a list of partial statements that hasn't named the suicide. Okay, when you're running a function, you type the functioning. The statements in the list run as if you had tied them on the command prompt. So that is basically what the function is the simplest definition off her function. So a genetic function would look something like this. First, a function keyboard key word followed by the scope, which is optional and name, which is mandatory. And then an optional bad Amita names. Okay. And these perimeters perimeter one paramedic who could have types as well. And then you have a set off commands within the current prices. So let us try to create some function sensi. Okay, so, first simple function. Okay, functions do not have to be complicated to be used, so it could be simply some group off statements or some functionality which that particular name does. Okay, so, for example, start be a segment which would actually call start process publishing. And as right. Okay, let us try this one again. We use our show. I see. Now let's create a new file. So we call it function functions dot be a swamp. Okay, so let us write our first function, which is a very simple function. It does not take any perimeters. So it is function forward by your, uh what do you say? Your function Name KPs, admin and no perimeters to dysfunction. And you just call, start process, come and licked. So you can see the helpers automatically followed and we start partial and vogue m s okay. And this is the definition of function. Merely executing the definition of function does not do anything. It will just stole the function. That's it within your partial console. Know what you can do is to call the function. You just type in the star hyphen B s. So now let me select everything execute so you can see that it is prompting for access. Super user axis on. Yes, in the ocean. So now let's big father. In the previous slide, we have seen function with no barometers. It was a very simple function. We just started a publisher Less partial process. No, let us look at name the perimeters. Main perimeters. You can define the name perimeters in two ways. Okay. So you can define parameters inside the braces. Okay, using the bottom keyword, but, um, followed by brackets close forward by your type, which is also optional and dollar parent one and parent too, and so on. You can have optional list of parameters and then the list of statements that need to be executed with this parent. So this is the preferred way. And Adam, or common way off defining parameters is simply outside your current places, so values specify within the brackets. So you specify Param one and bottom two. Okay, so let us look at these two examples how they fit. So now let us define a function called get small files function. We thisted time. We're going to use the preferred way off defining okay. And the define dollar sighs. We're notifying the type you can see. So this is one perimeter which it takes and get hyphen, child item, child item, a dollar home in the home directory with a condition that object. And here we would use the special variable dollar and the school lend is less 10. Whatever you have specified in dollars size and it is not a directory, okay, that this and not dollar on the school dot b s is continue. So basically watered us it. Retton's all the files in the home directory whose size is less than whatever is specified . Okay, not even less than equal to Western. So how do we call this? There are two ways to call it. Let us check the first way. So get hyphen. You see, the auto helpers already got generated. It is available now, Hyphen. There is only one perimeter size and 50. So let us check 50,000 just to see if we get some lister fights. Yes, you can see we got to Mr Fights, which you can also write. Get hyphen size 50. So which will be the first perimeter? Sorry. Get hyphen. Small finds 50,000. So I am just a meeting the hyphen size. So it is working. OK, now let's look at the default. The more common way off defining Get hyphen, small files and dollars size. We call me this whole condition and hold statement here. So this is one more way. This is a more common way of defining it, and we execute this and we can call using the sighs perimeter, which is also going to return and without the name off the perimeter also, it is going to return. And one more thing that you can do is you can specify deformed that IHS 50,000. Okay. And what I do this time I call it without any permit of that. So it should pick up the D 4 50,000 and I came save the function. I call this so you can see that it has picked up the before. Same thing can be specified here also size 50,000. And you can also specify bs default value help basically, so you can just put it as BS you bad rackets. So this PSD fort value is basically used by some external tools toe pick up the before. Okay, so this is actually not necessary. We don't have to put this. We can just for 10 the default value. Right? So that also will do fine. Now let's go to the next next complex city. Next level of complexity. Four functions so that this positional parameters a positional perimeter is a perimeter without paramedical. So that means you can actually supply any number of perimeters to have function without parents. Okay, so basically get extension. The first perimeter Dollar art zero. It is basically dollar arts which is actually going to store. It is similar to your JavaScript. So dollar name is about $2.0 plus doc Txt. Okay. And you can print out the name, so let us try this out quickly. Position perimeters. So what I do here is I define a function and I say, get hyphen, get extension without in brackets. That is no perimeters and dollar name is a good dollar art zero. That is zero it argument less dot txt We have concocted nated it to me and we are printing the name okay. And I call get hyphen Extension. Now if I execute this Sorry, I need to put in a value to this My file legacy right side. And if I execute this entrance my five dot txt. So basically, you can supply any number of arguments and you can consume those arguments using al zero r one r two extra and that is how you can supply. Okay, You can also have some conditions like the art start Lindus sequitur. How much and based on that you big positions. So it is just like your main function in your job 15. Functions -- Part 2: let's go to the next level of complexity. So we have understood the positional arguments. Now it does switch Fatima. This so a switch is a perimeter that does not contain a value instant. You type the function name followed by the name off the switch battlement when you type the own switch perimeter after the functionally the function displaced, Switch on in this case. Okay. Without the perimeter, it will call it us. Switch off. So I'll just show you how this functions function. Switch item that him and you specify switch within your square brackets, dollar on which is your name off the perimeter. Okay. And then if you have dollar on donna on, then you specify Use a search on execute some set off statements here and execute a different set of statements here. So we say simply such off. And this is just a function definition. So we need to call this perimeter using such hyphen item on. I just call it by hyphen home, Okay. And when I execute this, okay, so we have on editor here. So what is the problem here? So this has to be, uh, Mama. That was the problem. And If I execute this again, you can see switch on Esca. But if I simply execute without perimeter, it is going to think Fitch off. So even the switches particular. So basically, if you use switch as the type and you specify the perimeter So based on the absence or presence off this perimeter name, it is going toe execute a different set off comers. Okay, Now let's understand the next level of complexity. So function perimeters using splattering so you can use planting to represent para meters. Offer command. Okay, so basically, you're passing a command itself into a function using add the rate odds. Okay. The accurate odds feature uses the dollar arts automatic perimeter Brokovich represents undeclared commanded parameters and values for from the remaining arguments. So basically, what you're saying is you want to execute something in the background or as a separate process in a separate session. OK, so you used her splattering and you pastor command itself into the function and that command would get executed. So let us see how this functions function. Get hyphen. My come on. And I don't give any perimeters to this. And I see Get hyphen. Come on, dollars. Sorry, Philby. Percent. Okay. Now to dysfunction. I pass. Get child. I'd Okay, so I see. Get hyphen. My command on a hyphen. Name is get hyphen. So what happens? This the get hyphen child item would be passed into the Cecil argument and this will get executed. We just show you what's so this is okay. Now let's go to the next level of complexity, So piping objects to functions. This is very important functionality. And this functionality will be seen in Lord off Our scripting it is a very powerful feature off partial where you can output where you can pipe the output off one function or one commander it to as an input to another commander. So this way you're objects are basically you can say your statements will be very, very concise. Onda. They'll be very easy to read and very efficient. Okay, so let us see water. How do you buy objects to functions? Any function can take input from the pipeline. Okay, so basically this pipe, huh? You can control how the function processes the input from the pipeline using begin process , begin process and end keywords. Okay, basically how it us you have to define a function on in the function. You have to specify the bigon process and end OK and within the begin you would have certain statements. That means basically the initialization. So you want to establish a connection to a database and in the end statements, you want toe close a connection to a database and the process where you would actually process all the items that are coming one by one. For example, 12 and 41 would be passed to process each time. Okay, so one will be passed toe a sect of statements within the list who will be passed again to a set of statements within the list and sore. OK, Now you want to access these perimeters 1 to 4. Then you have to use the special variable dollar underscore, okay. And you've these 12 and four objects have some subjects like lend name or ah, science, etcetera. Then you can just put a dot operator daughter and the score dot and you can refer to those are perimeters within those objects. Okay, I hope it is clear now the process statement lift runs. So basically, this process statement list runs one time for each object in the pipeline for each object in the pipeline, while the process block, it's running. Each pipeline object is assigned to the dollar on the score. Automatic waiting. So this special valuable is nothing but an automatic variable on one biplane object at a time. So basically it will go 100 I. So that is how it is going to process. Now let us see how dysfunctions. So when you use a function in a pipeline, the objects bite to the function are assigned to the input automatic, credible sort dollar input automatic, readable will get a signed Okay, toe each off those members that you're passing to the pipe. Now the function runs statements with the begin keyword before any objects come from the pipeline. So before any objects are actually getting into the pipeline before the begin will get executed on the function runs the statement with the and the key word after all the objects have been received. Okay, so basically the dollar input eso let us look at an example toe, see it more clearly. For example, see here 12 and four this past toe get hyphen pipeline begin and okay, so the begin. If there is no process statement, then the dollar input will have. Although all the objects in the pipeline Okay, all the objects in the pipeline will be in the dollar function. Get hyphen, begin ent. Okay. And we define Let us say just bacon and and we print, I think and put Istana input. Okay, on, uh, similar. We copy the string and reported here. I see. And now you want to call it bars 1st 14 bite and then we see get hyphen it like that. Let us execute this Munch on. Hey, good to see what has gone wrong here. Ah, so you should not specify colon or let's start required. Okay, on, uh so that should be it. Thank you. This so you can see here. But what happened at the begin? That is, nor dollar input? Because before these objects are actually piped, the begin is begin Set of statements get executed on since we don't have any process. So the end will have all the dollar input induct. Okay. It is actually not passing it toe dollar underscore only if you have the process command in place. It is going to have it. So what we can do here to understand their let us say I put in process, okay? And processing. And how do you access that? Readable by dollar. Sorry. Dollar underscores. So now let us see how this behaves. So you can see here the input. So there was no input here in the biggane, which is because it is going to get executed before the objects are getting passed through the pipeline. And end also has nothing because all the dollar inputs have been extracted and placed in dollar. Understood. So this is a very powerful feature and you should understand this and you should start using it as much as possible. This will actually keep your cold very concise on it will be very efficient. Now, let's go to the next level of complexity. So we have understood the bite objects. Now we have filters. So a filter is a type of a function that runs on each object in the pipeline. The filter resembles a function with all its the statements in the process block. Okay, So how do you call a filter? How do you How do you define a filter filter. Whatever is the school name and set off statements. Okay, so for example, filter get a log switch. Dollar message on if dollar message. That is, If the dollar messages present, then that means How would you call it? Get hyphen it along. Hyphen message. If hyphen messager put him, it will only fetch, though. Message part off it. The adult message. Partof it. Otherwise it is going toe. Execute everything. So basically in filter, it is as if your complete what do you say? Your complete The set of statements are within your process. Block. So the falling filter takes log entries from the pipeline and then displaced the whole Either the whole entry or only the message portion off the enter. Okay, So based on your switch, it is going toe special. You can specify whether you want to display the whole man only part off the message or the whole message. Okay, Now, next is the function scoop, which is the last part, which is also very important. So once you're writing complex scripts, you would want to define the scope of the function as well. So if a function is part of a script, the function is available to statements within this script. Okay. By the fort. A function in the script is not available at the command prompt. So if you're defined a function in a script by the fort, it is not available in the command prompt to make it available in the command front, you'll have toe define the scope like global colon on the function name, and you can actually call the statements. Okay, so that's it. On functions. Thank you. In the next video, we are going to talk about her handling. 16. Exception Handling: section to exception handling. So exception. Handling is a powerful mechanism. Toe handle runtime errors so that flow off the application can be maintained, so if you don't do proper exception, handling the script would unknowingly get terminated. So in orderto avoid that you use, try, catch and finally blocks to rest pronto or handle terminating errors in the strips. Or, alternatively, you can use traps. Statement. Okay, toe handle your terminating our center skirt. So we're going toe. Look at both. Try catch finally and trap statements here. So first the try catch. Finally. Okay, let us understand the statement. First, you strike, catch and finally bought blocks to rest born toe or handle terminating errors in the scripts. That trap statement can also be used toe Handle the terminating errors in the script when and other occurs. Written a try block that is within that group of statements, which are encapsulated in the try block. The error is first saved. Toe the dollar enter automatic valuable. It's automatically saved there. OK, now, next publishing. Then it searches for the appropriate catch block to handle that. If this try statement does not have a matching catch, block the publisher continues to search the appropriate crash block or trap statement in its apparent scope. So whichever has called it. Okay, No. After the catch block is completed or if no appropriate catch block or trap statement is found, the finally block will be executed. Okay, If the error cannot be handled, the errors returned to the industry. So if there is no appropriate catch block, there is no trap statement. There is no finally block. It is going to be returned to the industry now the catch block and include commands for tracking the error or for recovering. The expected flew off the script. Okay, So if for example, let's say if it is not able to connect toe a database, then it should do appropriate recovery. Or let us say, if it is tryingto inserted daytime table but the table is not existing, then the recovery would be creation off the table and then inserting data into that. So the catch block is basically for recovering from the errors. Okay, The catch block can specify which other types of catches so you can have multiple catch box which can specify what type of errors they're going to catch and What is appropriate recovery action. It is going toe Take okay. A trying statement can have multiple class cash books okay for different kinds of eros, Then they finally block can be used toe free Any resources that are no longer needed for your script? Basically, the finally block will always get executed whether there is an exception or not. So, for example, if you have opened the database connection and you tried to insert daytime toe certain table on it has failed because off either an SQL later or let us say because the table does not exist. Then it will execute the finally block and it will close the connection. So in the finally block statement, you can actually write the clothes. So even in the normal scenario, when there are no exceptions, then also the finally block is going to get executed. No letters understand the syntax. Syntax is very simple and straightforward. Okay, so basically, you have tried with a curly braces and a set off statements within the try block. And if any off these statements failed you your on time era, then what happens? The catch block is executed. Appropriate catch block is executed for specific types. Okay, now, for example, if you see this exception, so dollar WC it's basically connecting toe. It is creating a Web client object, and it is trying to download a file from A You are and place it in temp folder. Okay, if there is an eye you exception or have a vector exception, that Web exception would occur. If it is not a memory download. The file. The EU exception conductor. If there is no Internet connection or it is not able to save it to the disk to the C temp folder, then this particular exception would be thrown otherwise, if any other exception has occurred, which is neither Web exception or are you exception catch with no type is going to get executed. Okay, let us look at this example. So let us write our try block first and then followed by the catch so the catch would have to type of feathers that were going toe catch. Let dot exception coma and we have system dart are your dot? Are you exception and we close this so it's there any other years. So dry block. So what we do your dollar W C is basically the Web client. New hyphen object. Okay, system dot net dot Web client. We create an object, and then we call dollar wc dot down, lord. Fine. Okay. And I give some haphazard x y that dot com slash my file, Doc, Doc. And it is placed in, say, C colon tempter Victory, tempter victory. The finally math, my file dot doc. Okay, I close the places here, and then you have the catch block the catch block has multiple cat statements on, I would say unable to download. Don't know Eddo, which is where it is going to throw and another cat statement which is going to catch any kind of an error. So we would say unknown at a daughter. Okay, so we have syntax enter here. Why is that? It's index. It'll try. Catch, exception. See? So okay, try. Okay, So there is a narrow you need to maintain a space. Your on. You save this and let's try to execute this one. So there is another unable to download the file and we have an exception which has called which guards exit, which has come for for this particular variable. If I remove this variable. And if I played really execute again so you can see it just throws animal predominant. So basically, your dollar error is going toe Have the complete other details, so you could actually capture their details and take for directions. So it is very clear that it is trying toe, So it is tryingto execute tryingto fail it. It is basically feeling in the exception or the U exception. And it was throwing this. Okay, otherwise it will f executed the unknown. Okay, Now let's go to the next next slide. Okay. Now what if the syntax so that partial matches the error types by inheritance? Okay, this is one very important thing that you need to understand. The catch block handles errors off the specified dotnet framework exception plus or off any class that derives from the specified class. Okay, in the example below, you could understand si eso system dart management dot automation, But come on, not found. Exception is basically a class that inherit from system exception. So if you give, come and not found exception and if that is the exception that got triggered, then you get this. Otherwise it's super classes. Exception will be caught. So this exception handling is based on inheritance. So we will understand inheritance on and more about object oriented programming in the next section, section three. So until then, you can just get an idea that this is the parent and this is the child. So if the child exception or the correct exception is not available, it will try to get to the parent Exceptional. Try to execute or cats the exception off the parent or the parents, parent and sword. Okay, so now the next one. Is that black? Okay. No, let us see what is a trap and where it has to be used. Okay, so it terminating editor stops a statement from running right. If there is a dominating error, it would stop the statement from planning. If Publisher does not handle the terminating error in some way either using, try, catch or by using the trap, then the partial would stop. Okay? The whole current by plane would be stopped Now Trap. How is it handled? Okay, there are 33 ways you can handle it. The trap keyword specifies the list off statements to run when in a rockers. Okay, The trap statement handle the terminating error. Cinder falling with display the error after processing the trap statement. Okay, that this within a function somewhere there is an error that occurred before that There was a trap statement. Okay. First thing it does is it will execute although statements in the trap and continue the execution. Okay. And we continue execution. Or that is it will skip that statement. It will go to the next. Okay, It'll also print out your it will display that Basically. Okay, the second is displayed the other and aboard the execution. Okay, so that is done by using a break statement in the trap. The third oneness. A silent it so that as you continue the execution, you don't say anything. OK, so these are the types off error handling that you can do. So basically, let us say, Let me give you an example. Okay? Now you are trying toe. You have restarted service. Now you would want toe, see if the server is available or not. You want to put it in a loop, sleep for 10 seconds and again bring this over and see if the service available. You wouldn't want toe if it fails. You want a country, Dok? You don't want to really catch that exception it a try, catch block and do something about it. Right. So what would you do? You put a simple trap statement. That's it. So it will try to pick the server. If there is an exception, it will continue to the list statement. So this is one good example for trap where you would like to use trap in slough breakage. So the syntax off trap statement trap error type and the statement list, okay? And so basically, you can see here function practiced. You have a trap, and you have an automatic. We're evil. You can use thought that automatic were able to get the egg error and you put some string here, okay? Nonsense. During which basically has no meaning to publish. It should actually throw another. Okay. And let us try this particular function. You will understand more clearly. So function practiced, and there are no bad emitters for this function, so I don't give any places and trap. Okay, So whatever statements that you want to execute for the trap ever found okay and colon and dollars on the school, so this is your automatic were evil and you say nonsense. Some string you put in here and you say complete function complete. OK, and now let's execute dysfunction. Trappist, let us see. Little clear this one first. Okay, on. If we execute dysfunction now so you can see the function has got completed to try to execute this nonsense string. And it through a letter saying that this is not a recognized name or command licked. And then it executed the trap. Basically tried to execute the trap. Statement failed. So it printed out an error and then function company. Okay, so this is one way of doing it. The second way of doing it. This you want to break so you can put in a separate statement here. So what would happen? It will not execute the next statement that dysfunction complete. So you can see it has got another. And it stopped the execution immediately after that, we didn't go to the next statement. You can also put in continue here and let's execute dysfunction. Oh, so okay. You can actually remove this. Basically, it is not going toe throw. It doesn't ever. So it is basically printing it out. It is executing the list of statements, but it is not throwing the others. So this particular editor message this completed and messages missing. So when you're going for country So let's go back to the slights. So basically what we have done this we display the error. We continued, we display the arrow, we aborted, we went silent. And we continue. So these other types, so in scenarios where you would want to try something and you don't want to really catch the exception which is provided by the coalition, you could use the trump. Or if you want to do proper handling, then use try, catch and fire. Okay, so in the next section, we would actually continue. But our advanced publisher So where we will try to understand glasses and then providers w in my and many more exciting topics. See you 17. Cmdlets -- Part 1: CMB. Let's cnd Let's pronounced this command licked is a small, lightweight command that it's used in proportion environment. A commander typically exists of the small script that is intended to perform a single specific action, such as copying files, changing victories, Exeter Command lit and it's the relevant parameters can be endured and partial environment . Or it could be included as part of a longer script that can be executed as desired. So, basically, Commander, it is nothing but an advanced function which has advanced capabilities. Okay, advanced features, which is what we're going to look at more Second, more important, point this the naming convention. So you have to name the common Red Power shall commander it as now work combination, okay with the hyphen in between or multiple hyphens in between. Okay, so that it is easier to remember, and it is easy to understand what it does. For example, get child item. So get child item would basically give you the list off files or directories that presented a parent folder. Okay, you could have additional parameters like a precursor of etcetera, which would actually occurs are different options off that particular command. Okay, so in this section or in this video, we're going to understand What is the syntax off this commander told were right. These commanders. Okay, now it Come on. Elected a single command that participate center by blind syntax and power ship. So previously we discussed about pipelines. So that is the main feature of Commander. So it basically except so it follows the by playing semantics. Okay. Uses the command led binding attributes toe, identify them as functions that act like commanders. So basically, they are functions their advanced functions and they have cmd let binding attribute that is actually shown over here. Okay, Now And you have various para Mido's. You have various param eter options extra. Okay, so we'll go through one after another now commanded Para mi does. So the first thing that we're going to look at is this Param okay. And the para meters. And what are the attributes that you can specify in the perimeters and what each of those attributes mean? Okay. No first perimeters, the mandate re argument so you can see mandate tree is equal to dollar true. Okay, So the mandate every argument indicates that the perimeter is required If this argument isn't specified. The perimeters optional. So if you don't specify this argument, it will consider this option. Let us go through this example and see, so we can see that we have to Perimeters name and place on both off them have been set as mandatory. Okay? And you did not worry about this Parliament of set one. We can actually remove this. So we're just showing the this thing. So now if you call. So let us execute this car complete, even get help. Okay, so I execute this. Now you see here you can see the syntax itself, and I'm calling it helps and greeting that. This is a hyphen name. Okay. And hyphen, please. Both off them. Our mandate re arguments. Okay, Now, if I make this as Doll of Faults legacy And if I execute this so you can see dollar place, there is a square bracket in enclosing the dollar place. Whereas previously we didn't have that square bracket, right? So if you see, there is no square bracket and closing this home stuff So this indicates that dollar place hyphen places. Basically, it is non mandatory. Okay, now, if I execute under this condition. Say I say send high fun greeting. OK? And I don't give any doc any arguments. Okay, so it will automatically asked me for the name. Okay? Name is something. Bruise. Let us say that's a Tele Bruce. Okay, so let us say if I make both off them as military. Okay, so now you see, Now we execute first restored this command in our partial hand, we call, send reading. Okay, Best and enter. So it is also asking me for place. It has taken name as test place It is asking me. Okay, so that is what was my victory. Okay, so the next perimeter is position. So the position argument determines whether the perimeter name is required when perimeter is used in the command line. Okay. When the perimeter declaration includes position argument, the perimeter name can be omitted, so you can just specify the value. We don't need to specify the perimeter name when the position attribute is included. Like here, you can say position is equal to zero. Okay, So for the name perimeter now and publisher identifies the unnamed perimeter values by its position, it by its position or order in the list off order in the list off unnamed Param Eter values in the command in which order that perimeter has been specified. So that is how it is going to deter. Okay, here you can see there is only one perimeter. So let us look at the example Now, Now, let's see how position books. So how do we specify the position I specified as an attribute? I Let's say I put it as one. Okay, that is the first part Amido I in the zero position. I put it as one. I'll put this as zero. So just to see how it works. So now what happened? So the commander, it is expecting the zero it argument to be the place. Okay. And the next argument, that is the first argument to be the name. So that is how I'm running it now. So send reading London, which should Goto place and Bruce, which is this position? One should go to the name. Okay, let us try to execute and see this one. Right. So Hello, Bruce from London. So what happened? London has bean, the zero it perimeter. It has gone to the road position, and Bruce has gone toe the first position. So it is working as expected. Okay, if I remove this position arguments now, let s see what happens. I remove this position arguments and I tried to execute. Now how it should take the default. So name should go to London. Place your good Bruce. So if I execute? Sorry. So I would be executing on details here. Execute. Hello, London from proofs. So since you have not specified the position argument now the zero it has become name, which is London. And the 1st 1 has become place, which, as we compose. So it should have mean like this. No, it will give us toe expected. Okay, Now let's go to the next Next parameters attributes. So the next activators Parliament. A sec name. Okay, this is again very important. Perimeter. You will understand this. So the perimeter set name argument specifies the perimeter set toe which a perimeter belongs to. Okay, So if no Param intersect is specified, the perimeters belong. The perimeter belongs toe all Barham. It does. It's defined in the function. Okay, If the perimeter sectors not defined therefore Toby unique. Each perimeter set must have at least one perimeter that it doesn't. That isn't a member. Now, what is this para meter set? You just see, It is very obvious here. So let me show you as an example. So it is more clear directly. So what I do is I specify this as my only trickles true. And I say perimeter set name is equal toe set one. Okay. And I put this ass set. Name is equal to set to. Okay, now, if I executive dis get help, you see what it is going to show you it is going to show you two ways of executing this function That is either using name or a They're using the place that that's how it has classified this toe on in these two sets. Okay, there are 11 banditry perimeter that this name and please you can define multiple parameters which belong toe are different sets. Okay, that also can be done if you don't specify the SEC name. So it is going toe include that particular perimeter in boat. All the sex, in fact. So basically, this is how you can actually, uh, specified out in the syntax in the get help that okay, you can either call this function using the name argument or using. Please. There is no point in calling boat with the name and the place argument. Some kind, something like that. Okay, so that is what this perimeter set name is about. OK, but off course, you will have to implement the process properly. Okay? If this is specified, or if places specified than how you're going to process all the logic, you have to write it. 18. Cmdlets -- Part 2: Okay. Okay. Now let's go to the next attributes. Next attributes is value from pipeline. This is also very, very interesting. Attribute the value from pipeline. Argument indicates that the perimeter accept input from a pipeline object. Okay, specify this argument if the function except the entire object, not just the property of, So that means there is a pipeline. So basically what we're doing here get process which is going toe send out process pipeline process objects. We have seen this before. Right dollar process is now out off this You selected the top 10 objects. Okay, 1st 10 objects which are high super your memory consuming. Okay. And then you have Pastor toh, your own commander. Okay. In your command, let you defined the value from pipeline as true and pipeline input. Okay, so that the pipeline and put us what is going to come here and in the process. If you see you have taken the complete pipeline input, you have looked through it. That means and you're extracting the name. And so what is it that you're accepting? Expecting from the pipeline? A complete object, not just the property. Okay, let us see this. Except so if you understand you Right, Process data. Okay, there is it Accepts one perimeter, which just pipeline input. Okay. And then where the value from pipeline is set to true, that means you're actually sending this data as a pipeline. Okay. And what does the process to the begin is not doing anything. It's just logging it, okay? Logging the data begin and end. We don't need end as well. So mainly in the process. You know that this is a pipeline object, okay? And it is an object. So you're looping through it and you're extracting the name. Everything Okay? So if I execute this now, you see the syntax off, how I'm executing it. So I'm just calling this and all the objects that are coming in. They're all going to be process objects from get process. And it is extracting the name. And but so you can see process, name and process. Okay. Hope this is clear. Now let's go to the next set off attributes. So the next oneness pipeline from value from pipeline by property Ning, our argument indicates that the para me that accepts input from property offer biplane object. That means it will not the process will not get the complete object from the pipeline, but instead it just take the property off the pipeline. Object. Okay, so the object property must have the same name or an yes after. So in this case, in the process you see, I'm specifying value from pipeline by property Name is true and I specify need that means whatever. I'm sending toe the from the pipeline toe, this particular function each off the object should have a name. Okay. Like this water just saying so. Let us look at this example as well. So we have set value from by blind by property Name equals true. Okay, Now, if I so just wanted to show you if I execute, get process. So what is it getting dollar pf store that in therapy and dollars p zero door. See? So that means there is a name property, right. So it is only going toe extract the name out off that pipeline. So from this pipeline, all the object that they're going to come from here, The 1st 10 objects are being taken, and only the name is going to be passed to this because we have a perimeter, which is specified where we specified value from by plane by property name where we have not specified the Elias. And we just specified any son named property. So if I do this select all All right, so you can see it has only got the property beam, so it is only getting name. It is not dollar input dot Me. Okay, so this is how this so hope. There's also clear it is pretty straightforward. Nothing toe get confused about. So let's go to the next set, okay. And other oneness value from remaining arguments. This is also very interesting perimeter. So the value from remaining arguments argument indicates that the perimeter accepts all the perimeter values perimeters values in the command that are that aren't assigned to any other para meters function. That means you have defined only one perimeter value. Okay, And you have you have passed in wanting to also additional parameters. So these additional parameters will be going into dollar remaining because this value from the meaning arguments a specified here on that's it so and the first value will come here and the other two would be going Okay, that means so let's see how this prints out will just check in the example. So I said, like this execute. So you can see Found one element. Okay. And in the eye, Dollars. Zero. What happened? It has Garda remaining the remaining perimeters. Okay, remaining perimeters. That's it. So best reminder. So for one element, So dollar remaining not count has one element additional remaining. Okay, so it's very cute and value its value. The value would have been assigned to your first. So it's pretty simple and straightforward. Now, let's see. So 100 parameters. There are other parameters that you would want to understand and you can actually go through the Microsoft help and you can actually see all these parameters. Help message Elia's allow now allow empty string allowing recollection There are lot of parameters. You can go through each of these from the help and start using them. The ones that I have described are the most important points. Okay, now comes the come 100 binding. So till now we have unlisted how to define a perimeter. Specify attributes to these perimeter, whether it is mandatory waters positional, whether you're passing it as an object or whether you have to consider. It doesn't objects, property and so on and so on. Okay. And how does getting entered into the process? We have understood all that stuff. Now we are going to look at the commander binding what other para mi does that you can attributes that you can specify for the common thread binding. So let's go through it. No. The common thread binding attributes uses the Commander Tie Tribute Act able to identify them as functions that act like Commander. It's right. So basically, if you have a commanded binding, then partial understands that this function is going to act like 100 okay? And it except spite objects. So and there are various other features. Okay, so commanded binding. Confirm impact. Okay, this is a very important, very, very important perimeter. You see how useful of this as we go? So the confirm impact argument specifies when the action off a function should be confirmed . Okay. By a call to the shooting process method. Okay. The call to the shoot process matter displays a confirmation prompt only when the confirmation em backed argument is equal to or greater than the one phone preference. Preference. Variable. Okay. Confirm preference Preference variable. So I have set it us higher and a compact. The confirming back also is high. Okay, if these two this automatic variable And if you're confirming practice set too high. Are if this is low con from preference in medium and this insect of high also. Then what happens? You will get a confirmation dialog OK, and only it will get processed Specified this argument only when does supports should process Argument is also specified. So you you should specify this confirm impact argument along with supports. Sure, the process argument as well, which is set to true. So let us see this example. So in this example, what we're calling we're calling invoke Stop databases. Let's say you want to perform this operation on a production system and you would you would want to first get a confirmation from the use that you don't want to just go straight ahead and executed. So what happens? It is not going to execute until you specify Yes, obvious to all. Ok, then I specify yesterday the basis stop. So this is kitty exit, okay? And if I execute the same method with no so nothing will get executed. So this is a very important and powerful future in publishing, so it is very straightforward. So even if you have written this in a script, not just executing from a command line, it is going to pop up. Okay, Now let's go to the next attribute for common thread binding. So the default parliament effect argument specifies the name off the perimeters sick that the partial will add them to use when it cannot determine which perimeters set to use. Okay, so that is when this default parliament affect name were coming. You can award this issue by making the unique perimeter for each perimeter set a mandate to re parliament. Okay. Now supports paging the supports Beijing argument adds the first skip and include total para meters to the function. So it doesn't do anything. It just adds this first skip and include order. Okay. So, just to support the pages automatically, these perimeters will get added. That solid does it doesn't do anything else. Okay, You have to implement the first skip and include article. Okay, So these para meters allows the user to select output from a very large results. Okay, Now, this argument is designed for commander. It's and functions that returned leader from a very large data source. Okay. And that support data selection such as SQL Database. So you want to quietly some Mr Database and it has got a 1,000,000 rose. Okay, But you want to see only the first tendrils, Okay? And you want to ignore the first and rose okay, and report only that number of objects so automatically these para mido's will get created . You don't need to specify them. Okay, on you use these parameters on. Based on that, you execute the ask your quality and get the data. And this. So what is the advantage? It standardizes the perimeter names as well. Okay. The bottom. Either names being first skip and into. So when you're piping, it becomes easy. Okay, so when you're using pipes where output from the process is coming and you want to specify only a number of objects from it all that gets what do you say? Standardized? No positional binding. Okay. The positional binding argument. Remember, we had a position argument attribute in perimeters. This is also related to the same thing. Okay. The positional binding argument determines whether perimeters in the function are positional by default, that is Can you use position? Are if you say position is that it is It is defaulted to true. If you set it to falls then you have to specify the argument. Let me show you that example. So here you can say position binding I will set it true And there are two perimeters. Name and place. Okay, Boat on mandatory. And I've said the policeman binding. It's true and I execute this So Hello, Bruce from China. It is working Fine. But if I said it as false and if I execute now it is going to fade. Why? Because you have not specified what is blues and what is China? Which perimeter? These things should be assigned to. Okay, a position perimeter cannot be found That accepts bruise. So what you have to do? You can just say hi for name hyphen, please. OK. And if you execute this, it is going to take the perimeters. No, it is exactly taking these perimeters. You could put this place also here. It's not a problem. So because you are explicitly specifying the name now you are free to call it either way. Okay. So even now the thing will be Hello. Bruise from China. So this is perfectly fine. Okay, so all these features make this. Come on, let's really very powerful. Okay, on this is the standard way off writing your functions. If you make sure that you right, all your functions, using this approach, the common rates approach, then it is easy toe biplane them. They all become standardized. And they automatically accept pipeline objects in a certain specific manner and all that stuff sworn and so forth. Okay, now let's in the next video. Okay? We are going to talk about providers. Thank you. 19. Providers: Section three providers. So publishing providers are doctored programs that provide access to special data stores for easy viewing and management. Okay, the data appears in a drive, just like see, Dr Detroit. Detroit. These data also has classified as drives, and you can access the data in a part like you would do on a hard disk drive. Okay. You want access? A particle of file in a hierarchy, A hierarchy in a directory hierarchy you can directly access. Similarly, you can access them also using some drive letters. Okay. No, you can use any off the building commanders that provide supports to manage the data in the provider drive. And you can use your own custom command. Let's that are designed especially for the data. OK, so let us see. How do you access this? Okay, so you need to call, get bs provider, and it will give you the name and the drive locations. And what are the capabilities it has? Okay. Here you can see some off the standard providers. Elias, it is going to give you the LDS and for the certificate and four and one of the important ones off course. The registry in for and the B is variable in four extra. So let's do it. Small demo. So similarly, we call PS provider and it is going toe list down All the providers that we have What are the capabilities? What is the drive? And let us say you want toe travels through this hatch KLM Okay, this is nothing but your ah registry. So you select this and you select this one. So within that which killed him So what is it? Kill him. See, Heskey Local machine and you have software Write software. You should be able to get all the registry values in this so you can travels to any Do any specific location and you can find on the registry values. Similarly, another way of doing it is for example, sort. So if you again execute, I'll get previous provider See the certificate information is located in the cert drive and one way is you can just a sec location toe that particular dry and then you can call get child item So this is going toe drivers through that in a hierarchical manner you can again go into the stores you can go into spot Rude, flustered and you can further go through and Trevor's toe hierarchically let it restructure hierarchically. So we'll see as we go through our implementation, where all we can use these providers and very begin quickly get the information. Now, next topic is very important. That is WR mine. So let's meet in the next video. Thank you. 20. Windows Management Instrumentation: Section three W M. I. Windows management instrumentation that your mind is the infrastructure for management data and operations on Windows based operating system. You can write the blue, my scripts or applications to automate administrative dusts on remote computer computers. But the, um, I also supplies management data toe other parts off the operating system and products. For example, storm that this system center operations manager from Microsoft operations manager Mom Or when those remote management without him, W um, I can be envisaged as a database off all the information about device like CPU Memory disk Services, Exeter First Command. You need to use this W my hyphen get object, followed by the W my class. Okay, these w of my classes are organized in names. Places to specify every more computer. Use the computer name perimeter. So basically, you call the basic. So if you see you can find it all the list off classes that are available within the w mind by calling the government get object hyphen list. We'll see the shortly and you can specify any any name, and you can go any the objects within their So, uh, let me take you through So if I call w my hyphen, get object hyphen list off any off these winter Tito WR mice. So if I execute this, it is actually going to give me a list off 1 32 the winter Tito provide us. So I can also quietly on these w my objects. Let me remove the computer name. I could give a computer on the mass will, like I specified I mentioned in the previous life so it can remotely connect to this, provided you have some kind off 80 authentication mechanism or you have credentials. That is that you can provide to this. OK, so I can just quietly selling star from winter to to service their name is Win Adam. Okay, Where the name off the services on formatting list based on the property hyphen property and a team off the properties within that object so I can execute this. Okay, I can get the name off the computer. What is the service name? Ordered the exit code or the P I d. Whether it what is the status All that I can see from here. So basically, w m I get object is going to get you almost a large number of information. It has got huge amount of information regarding the discs, the CPU, the memory, the failure, wors. Almost all aspects off your windows can be quite it, using the stuff you might get. Object. Hence, it is really very powerful. I don't want to dig deep into the W my because we're going to extensively use WR my in our coming lectures for actually building up our framework and writing scripts for automation. So let's move one toe jobs now in the next video. Thank you. 21. Background Jobs: Section three background jobs. So publisher background jobs run as Run, says Command without interacting with the current session. Okay, they basically start in the background. So when you start a background job, a job object returns immediately, even if the job takes an extended time to finish. So it keeps running in the background. You get a handle of the job, okay? And you can continue to work in the session without interruption and your background. Your job keeps running in the background. It is a very powerful feature, which can, which is going to be used by our scripting framework. Andi. It basically helps us in scaling up our script. Execution wherever we can actually execute are stripped badly. We're going to use the backup jobs, okay, and we start the jobs. So basically, let's see the FBI. It is very simple and straightforward. To start the job, you need toe call the start job and provide your script that needs to be executed, and you can call get job to get the list off job ideas that are running received job to get the results or longs from the background job. You can stop a job. You can keep the job and awaiting status, or you can remove the job. Okay, so let us look at these commands. And also we have invoke Ament. You can use the invoke Command to run your script in the background. So which also you can, which is also what you were going to see in this current video. So let's first start with the start job. So how do we start a job? So first thing is, we need something which is long running to actually see how it runs. OK, so we call start hyphen job, and we need to give the script block. So we say hyphen script block. Okay, we give it in the bar, brackets get hyphen process. Okay? And let's immediately execute another job to see what is the status off the job. Okay, look. So let us select everything had execute, so you can see the job is still running in the background on its commanders Get process. So whatever script that that you're going to execute here, single line or multi lines is going to come over here. Okay? I can just see dollar so I can now call kit job. So let me put it here itself. Get hyphen job. Okay. And I can either give the job name or I condone tickly execute this to see all the jobs that it's getting, so you can see the still executing in the background. Okay, So if I executed again, it's still executing. Okay, Now you want to. I received the job. That means basically you want to see the job logs. Okay. Hyphen job. And either you can give star, or you can give job star. It is going to work in any ways. You can have wild cards also here, so I'll give the exactly OK job. And if you execute this, I want to see what is output they're going to get You're going to get the list off processes that are running. Okay, now, if I do a good job to actually check the status it has completed, Okay? Now, the has four data states do have any more data which will be displayed from the received job. So it is false. So it has no new laws it has already completed. So you can see that it's nor data and you can also call only running job. You can actually call Stop hyphen job. I would recommend you to give the exact name off the job. Job one. Okay. Sensitive authority stopped. So there is no action that is going to happen. And you can also remove this job from our session. Okay? Completely so removed. Job, job one or removed jobs start it is going toe removed. All the jobs. Basically. So now if I do a good job, there should be no jobs, Okay? Of course. We had only a single job. If he had multiple jobs, all the jobs would have got removed from our section. Okay, so let's go back to us lives. So we have seen get job. So we have started a job first with a strip club is good block, get process. Then we have got the job and we have seen the status. It was running and finally went to complete. Okay. And we also called receive job, which has actually output it. All the results. Whatever the job has guarded court in the output. Okay, in the standard output. And you can also do a great job. Where if on a running job, if you hit the way job it's going to stop balls. The job. Okay, stop job would stop the job. So that this one more thing, you can remove the job, okay? And you can see the status off any failure. If there is a failure, then you can go to state and full and reason. Okay. So we can also look at this. You could say dollar job. Ok dot child. Sorry. Don't a job your child jobs. Zito on What's going to give you is going to give you the job name, okay. And job stayed in full dart. Reason. Okay. If there was any failure, it would actually give you a reason. Right now, there is no failure or defending. Exception had occurred. You can actually pick up that exception directly from here so we can easily manage our jobs . We can easily spawn jobs. We could easily pass them, remove them once they are completed. So new jobs with the same name can get executed. All the operations can be done very easily using potion. Now you can use the invoke Ament in New Commander. It runs commands on a local or remote computer and returns all the output from the comments including errors. OK, using a single invoke a man, you can run commands on multiple computers and you can use the flag hyphen as job, basically as job which would basically run this and more. Commander, back in the next video, we're going to look at what classes. Thank you. 22. Classes -- Part 1: section three classes. So a class declaration is a blueprint usedto create instances off objects At one time when you define a class, the class name is the name off the type. So basically a class name is nothing but a blueprint off an object and you use the class name. Do create instances off that type. Okay, Example If you declare a class name device and initialized agreeable with dollar death to a new instance off device dollar death is an object or instance off the type device. So basically, device is defined as a class and you instance she ate an object off type device. OK, Each instance off device can have different values and properties, so basically in its properties. So basically, each device has its own private properties. It has certain members. So basically, if you look at the genetic, uh, definition off a class, it starts with class, followed by a class name. And of course, you have inheritance. We will talk about it later, but basically it would have some properties and it would have certain constructors and it would have some definitions method definitions. Okay. And how do you instance? Hate a class you instance Hate a class. You basically assign it a variable and you use new object forward by the type name on the constructor argument list. Or you can define it as a new object with new method. Okay, new basically the new operator. So Colon colon new. We're just actually going to create a class subject. We're going to see all these in this video. Okay, now, class properties properties are variables declared in a class coupe. OK, A property may be off any building type or an instance off another class. So basically it could be a primitive data types or it could be your own classes or it could be classes that are provided by the partial frameworks. Okay. Classes have no restriction toe the number of properties they have, so you can have any number of properties. So first letters define a class and see how it looks. So first you define it by specifying the class keyword and the name on, followed by the curry braces. So here we are only talking about properties, so let's define three properties, and this is how you define the brand property and you have another string which is specify . It does model on the property and string. And okay. So you can see How do you define their all defined as normal weight even start you actually declared. Okay, now let us in. Stan. Shayt this okay? Don't device is equal to device type. Call and colon on you. Operator, close this. Okay. And what you do dollar devise dog. Let's see if what awful books start. You can see now brand physical do. Let's say it does Microsoft and hello otherwise dot mortal is equal to surface four. Letter C and dollar device. Don't friend escape you as it quite do some number. Okay. Okay. Now, if I actually put into their device, let's see, you can see there are no syntax errors. Select this and execute the complete command. So what you see here, you have defined the class and declared a class, and you have defined three properties in their class. And then you defined an object off the class and the object is stored in the variable dollar device and the device Start band brand divide device sort mortal device. Start, render. All of them have been initialized, and you have finally printed out the device so you can see the device valuables here. Okay, So this is how you declare a class properties, in fact, so let's go to the like, slide class methods. Now you have defined the properties. Okay. Now you want to manipulate these properties. How do you do that? Using class methods, methods defined the actions that a class can perform. Okay, So methods may take perimeters that provide input data, OK? And methods kindred are out protesting. They're just like functions, but they're written within the class. Okay. Data returned by mattered can be any defined data, so it can return any kind of data type. It can take any kind of deal type as inputs. When defining a method for a class, you referenced the current class object by using the dollar this automatic available. So if you want to reference any variables within that mattered the classes variables, you have to use dollar this dot The variable name. Okay, This allows you do access properties and other methods defined in the current class. So basically, you can also access methods as well other methods that are being declared in this class. So let us see the definition here. So you can see here glass device. And we have the same old were para meters that are defined. And then a method called to string, which returns dollars on percent. Zero colon s. So this is basically going to print brand pipe. Okay, mortal pipe, The Brenda Rescue. Okay, so this is how it is going to print it, so and then Okay. Let us see till this, then we and okay, let us go further. If you see the class rack, there is another class that is to find. So in the class rack, you have defined slots, initialized it toe aid. Okay. Again, you have brand mortal. When they're asking you a satiety, then you have devises. Okay, That means Iraq has won eight devices. So this start slots, it's nothing but eight. Right? So you have eight devices in Iraq so basically Iraq and contain eight devices and you have methods to add a device at a particular slot value. Okay, You can remove a device that is contained in a slot value. So you're setting it now and you can actually get the available slots okay. So distorted by the slots this start devices. So how do you call them the perimeters? Within a method you call it using dollar tous so you can see here dollar distort devices. Dollar distort device devices at a slot is equal to this device. Okay, so now if you see how he has instance hated the rack rack is equal to black cold and call a new. And then you had device. You have initiated a device and you have adventist device the surface pro toe Iraq. And then you printed out the rack and who also printed out the available slots. So what you can see here, you can see that there are zero to seventh lord start are available. Okay. And how many devices are there? There's only one device. Rest off them alone now. Right now. So only one device has bean added to the black. So let us implement this example. So we have already declared the device. So we are going to implement the method for this. So which returns a string on implement to strength? Okay. In the truth street, we're going toe return on be say fetal. Okay by one by to okay, and I've been format Haifa and f Okay, dollar this dot See brand calma dollar this dart mortar call. Marcelino, don't Don't start. So, basically, you're calling the members within this matter by using dollars dollar. This means it is this classes properties. Okay, Now you have declared device. Now let us declare our back. Castle. So you think class black? Okay. Iraq has eats. Lots of Iraq has only eight slots. But you can put your devices and we defined us as eight. And again, this has a brand immortal haven't rescue. I'm going to copy these method thes members. These members are different from the device members, okay? And then you have an area of dividers, Okay. To find every don't go devices is equal to so we define. Okay. Ready? Okay, Call and Colon, do you on Don't at the start slots, which is nothing but heat. Okay, Now we are going toe. Now that we have defined all other members in the rack properties are members, you can say you're going to define your methods. Okay, so this method is not going to return anything. If it's not going to return anything you're going toe put it us white. Okay, So, advice on a device. Don't go deaf, Okay. And? And dollar slaughter. Okay. And then maybe had the stroke devices start. Just start devices at Dolo slot do I don't know. Okay, So that means you have added a device at a particular slow. Okay, you have an area off eight. In that aid, you have put it on one off the locations. Okay? Similarly, we have abso we need toe define dream. Also remove device, so end. Okay, dollar slot, so it will remove at a particular location. So it is going to put it as no, that means here, slot. I don't know. That means there is nothing. There's no more any device attached and that next we are going toe returned and every off into joyous, but get while abou slots on and going to see it all end and dollar I is a quinta zero initializing the I and we are returning. Okay, dollar and percent. Okay. And I don't know this don't devices don't for each Okay, if dollar underscored, this is your What about equitable Hyphen cube? Don't No, That means it's going to be Don't I print dollars by and I bless us into inclement. Okay, so let's see. What is the syntax? Error? Here it available. Slaughters and dollar distort, divided start for each. And then you have to put a floor bracket Dio. Okay, Dan, you have another floor bracket. That's it. That is the correct way off declaring it so No, we have defined the rack so you can understand this rack. Has I doing three more device and get available slots, OK, No, let's define and all right, C k is equal to CK. Okay, Colon, colon new. Okay, it is completing as well. So what else do you do? And then let us call this s dollar eso you have already defined device. Now let's add this device. So what do you say? Dollar black dog on. Sorry and device. And I'm going toe Add this device at a second location or in fact, third location 012 and let me bring the rack and dollar. Don't get available slots. Right. Get animal slots is actually going toe down the Come in this out. Let me execute this complete stuff so we can see here. There is one device at the third location, right? And it's brand model s key. What not defined Get the slots is already initialized to eight. Because we have already initialized slots. To me, that means our rack and him on Lee eats lots where you can plug in your devices. So this is how you define your classes. And this is basically a composition. Okay, basically, what is happening? Your rack composers. More different devices. So and your data types need not be probably just primitive data types. It could also be your own data types talking or data type supplied by barbershop. 23. Classes -- Part 2: supplied by publisher. So let's go to the next slide now. No, we have successfully defined methods we have to find, admit, er movement or get available slots week called them as well. Okay. And we call the get available slots. We have seen all these values. OK, now let's go to the next slide. So, constructor. So this is the next part. Okay, Now, constructor is a special kind of a method legacy. House by heat is especially a constructor. Constructors enable you to set default values and validated object logic at the time off, creating the instance of the class. So right at the time off incense creating the object, you can actually do some kind of a validation. You can throw an exception if the if the object is not probably getting formed. Okay. Also, you can initialize thes values, So constructors have the same name as the class. So, basically, each country How does your publisher recognize it as a constructor? Because it has the same name of the class. Okay, so for the device class, you could have a mattered with device, and Richard doesn't return anything. Okay. And that would be considered. No, the class can have zero or more Constructors defined. So of course, we did not define any constructors before. If no constructors define the class is given a default. Param Eter less constructor so automatically a parent metal s constructors defined at runtime. And the object is instead she ate it. Okay, this constructor initially that all the members weeds, default values. So what is it? The object types and strings are all given all values. Okay, They're all in central Paris now. When you defy the constructor, no default less perimeter constructors created. So that means even if you define one constructor, the default less parliament less constructor before Parliament. Less considerable Lord get created. Okay, create a para metalist constructor if one is needed. So basically, if you want to create initialize your members with specific values OK, then you at least create one para Metalist constructor and initialize it to specific values . Otherwise the user would have to initialize those values and there could be a lot of school professors, so he might call some mattered on a null object or something. And it could throw an exception unknown exception. So it's better that you have at least one constructor which initialize is all your objects . All your data members. Okay, so how do you define a constructor? So see, now you have device and see in the device You have another kind of a mattered whose name is also device which does not return anything, not even void. Okay? And it has it takes in three perimeters and these three perimeters are getting initialized . Toe the data bus okay? And you can call it directly in the constructor itself. You don't need to initialize thes methods separately. You can actually call it in the new itself and past those. So let us look at this example. Now let's define the constructor. So we know it does not return anything First point second, you can say dollar be so we will give the perimeter types also so that it becomes, uh, strict. Ok, so don't be Call mom. String dollar, Ben. Ok, which is mortal and are the string all of v Ok, which is Brando and I closed the braces. And how way initialized thes dollars this dart plant your dollar distort dollar brand. Okay, you have to remember that it is stalling. This start is a cold. $2 B. Okay. And dollar this start mortal physical do dollar. They should be em. Right? So that's where we caught another. Here, dollar em and dollar this start. And that s k u. Physical too, right? No. Save it. Now, if you try toe, execute this. So let's say V initialize the device, so dollar they have is equal to device. Colon, Colon, you constructor. Okay. And in the new itself, you specify this Microsoft. Okay, full and your and really Okay. And if you print dollar death, So let's see what comes up. Okay, Execute. So you can see it has a properly god initialized. So this is how you use constructors? Okay, Now let's go to the next light. So you have understood. Constructors. Fairly simple. Oh, so now you have members. You have methods. You have constructors. Now you have huge in attributes as well. Okay. The Hugh didn't attribute hides the property of method. Okay, The property off a method is still accessible to the user and is available to all the scoops so you can call the hidden attributes. As for okay, the hell and members are hidden from the get member command. That's it. That is the only thing OK and can't be displayed using tab completion or intelligence. So basically, those heated and tributes will not be You could call them if you know the class declaration . But save somebody else has returned the classes for you. And if he has set it desperate and that means he doesn't really want you to use them directly, he wants them either to be initialized internally in the construct 11 or the method level. So it is Better not be Houston here in variables. Okay. And let us just see the no example off on variables. So in our back, we have put it S s so I can put it s hit. That's a head on keyboard. Okay. No, before this, if I don't put this. Okay, so what happens? Okay, so, dollars back Okay, by get Okay. So if I execute this, you see what's going to happen. So it is basically going to show me the slots property as well, along with all the methods on device. OK. And also the object methods like equals Exeter. All of them. So now if I make this hidden slaughters okay and I store this class again? Porsche executed so you can see the slot smothered. But the slaughters perimeter is not available, so you can't see that because it is hidden. Okay, so that is a difference. However, you can actually call that slots Dollar que door. See, I can't see the slaughter. So because I have implemented this particular class, I know that there is a slot starts member and its value isn't okay. So if you have declared any member as Hillen or anybody else who has implemented the class has declared it as Hillen, then it is advisable not to use those particular members our methods. Okay? They are supposed to be used internally within the class. 24. Classes -- Part 3: Okay, Now, let's go to the next slide. So there is a static attributes. Okay, this is the next variant. Often attribute or even a mattered toast. Arctic attribute defines a property or a method that exists in a class and needs no instance. That means it has a class level. Very, but okay. So that you don't need to instance a the class toe access that statically. So a static property is always available. Okay. Independent. Off the class in stand. Sheesh. It's always available. The particular static property ecstatic property is shared across all the instances off a class. Classes, objects, basically. Okay, Any object can actually access this particular object, and everybody will get the theme value. Same output for those objects. Okay, the static better is available. Always. All static properties live in the entire session span. So you have to remember all the static properties will remain in the entire section span. If I close decision, all the static properties will go away. Okay, So that that's a basic Okay, So here we have basically defined and another important thing. A static member, for example, Static rack installed racks. Okay, So within the rack class I can put in the installed racks. Okay. And static cover off the rex. So for each dollar rack in the install drags, I am going to poverty for tax. Okay, So that Chester, that is the signal for static. Better on de static method only has access to the static properties. Okay, In a static man member, you will not be able to access non static properties. But the same static member can be accessed by, ah, non static methods. Okay, so that is one thing that you don't remember. Okay, let us look at this implementation. So what we do here is we define a static both. Oh, let's see. So we say static and then we define black as an airy okay, and dollar installed tracks is equal to eight is basically blank. Harry, that means what we do. So once you have created the rack, so we say C k colon installed racks. Okay. Plus, is it Plus is equal toe dollar auto CK back. Okay, So letters again called this one. So it's got executed properly now. So you have actually what you have done you've created in your back. You have created a new device. You added the device to Iraq, which is also working fine, which is a position to and then in the installed racks, you have actually added the track. Now, if you see the racks that if you want to call the turn off, how do you call it? Black Colon. Colon Power off, Max. Right. So that is how you call the static Mattered as well. So if you call the power off racks. So what has happened here? Installed Brax. Let us see what is in store. Drax Value U. So there is nothing that has God into the install drag. But if I see the rack, Okay. Rack has got all the values and the written the rack. If I'm actually calling in store brax plus physical rack, it is not ableto so Can I put it in and percent, But this. Okay, on defy Execute this. So I called the rack. Okay. Now, if I called the get so if I call in store Brax So I've got the rack. Okay, Now what happens? Know what I can call? I can basically call not being able this and volatile flax. Okay, so if I call this power off racks. It is going to turn over that particular. Okay, so let us go through this whole stuff. It has slightly complicated. So basically, you have created a device to allow and you have added by thirds to it. Ah, sorry. Data member Stuart. Then you have added matter. Okay, then you have added a constructor to him. So the momentarily constructor, the default constructor that the publisher runtime would have created, is no longer going to get created. So whenever you are going to in stand Szeto Device type, you would have to give all these parameters dollar be dollar M and dollar V. So that is what we have given here. Okay, so this is how we have instant treated it. Next is the clock. Iraq. Iraq is actually composed off its lots. Okay. Which has got its own mortal Brandon. Brenda. Okay. And for the rack, we have not created a constructor. We could create a constructor, okay? And we could initialize the slots in the constructor itself. Okay? And then we invited methods to this. So we have mattered at device, so a particular device would be attached to a particular slot. Okay, Remove device at a particular slot that is also provided here and available slots. It's going to print out all the it developments lots. And after this, we have also defined startek variable and static variable. Or remember what we could call it on the static method to access that. Okay, so that means the installed rags is a global member for the whole rack class. Okay, you can directly call this particular member by using the data type crap Black colon, colon and the installed racks. Similarly, the members so popular Franks is called on the at the class. Okay, so that is how you can actually call. Okay, so now let's go to the next slide. So we have understood the static attribute now, property validation attributes. OK, so this is also very interesting thing, which makes your classes well defined. Okay. Like the validation attributes. Basically, these validation after boots allow you toe test to the values given to the properties and see if they need the pre defined requirements. Okay. Validation has triggered the moment the value is assigned, so you don't have to write any kind of validation. Okay, Most off the validations are taken care by the publisher. So you should use these kind of features and start off implementing the implementing or reinventing the whole. Okay, It makes the program more efficient on more easy to understand. Okay, So these valuation attributes, for example than a validate no or empty. Okay, so it is going to validate the moment you define a new device. It is going to initialize thes variables, right? Using the default constructor. If you're not provided the constructor and it will see these are defined us now and it's going to try an exception. Simple. You really don't need toe implement decency on There are different types off attributes OK , which our theme attributes as you defined in the advanced battery does in your commander. It's so the same para meters. If you remember in the Commander's whatever we have seen, all these parameters are actually applicable to the perimeters that we define in the classes. Okay, Now let's go to the next light inheritance. This is the final topping that we're going to touch upon. This is also very important. One. Please have a close concentration on this so you can extend a class by creating a new class okay, that derives from the existing class. So basically, when you're creating a new class, you can actually derived from an existing class. And if you derive the derived class basically inherits on the property from the baseline. So whatever you have defined in the base class, all off those filter more here and you can add the scene. Also, the methods okay. Also the methods, not just the properties. So you can overwrite those methods and properties as so. First, it is going to inherit all those things. And if you overwrite them, if you will redefine those methods with same input parameters, okay, or theme names and data types, it is going to override those parameters. Okay, Now, inheritance implementation is defined by the colon operator, which is what you have to understand. Okay, On another important point forward, the point to publisher does not support multiple inheritance. Okay, Classes cannot inherit from more than one class. Okay, so you can only inherit from one class or you can use multiple interfaces. If you want to inherit from multiple objects multiple definitions you can inherit from multiple interfaces, but not from classes. Okay? The derived class should always be left the most in the class declaration. Okay. Cool. And so whatever is the derived class, that is, your new definition has to be the left most in the colon, followed by your class from which it is going to inherit, which is only going to be one and coma. The multiple interfaces that you can supply. Okay, so basically, let us see here. So class asset has got brand and more so. Class device extends asset. Okay. It has got a hidden divides type. Okay, so device type is a in, um, so it is basically an enumeration where it has different kinds of values assigned to in digital. You could actually associated test, and he didn't member okay, with undefined value and a string status and device type. So basically, what happens though mortal on the brand would automatically be inherited by the device because it's an asset. Okay, so I'm not going to give an example here because in the next section, we are going toe work on inheritance we're going to look at In fact, all the our frameworks will be based on classes, class inheritance class members extra. So there you are, goingto extensively work on inheritance and glasses and all the concepts off classes. OK, so I'm going to just take you through inheritance in this section. Uh, so basically hidden type status. So see here also class computer server extends device. OK, a computer servers. All sort type of a device. So now devise the computer. Several would extend asset the members off asset as well s do Did the members and types off . You're the data member and types off your ass. It OK? All of those would be coming in from the sorry data members and types of divine assessment . So basically, a computer server would extend device and as it data members, okay. And also the additional data movies that are defined. So that is what this inheritance. Okay, calling the bees constructors. Sometimes you would want to call the base, constitute when you're actually initializing or calling the constructor off your class. You would also want to make sure you incense created the base class. Okay, That is very important. How do you call that? You called it by calling colon bees and the perimeters that you want to pass to this base. So here you can see There is a class person that is defined with a person constructor which is actually going to take dollar A which is the age. Okay. And class Children extends inherits from the color class person he has got the school his age also were coming here would get derived. Okay, So when you're in Stan shooting a child, you're going toe. Send the age and the school. So the ages automatically getting initialized by calling the colon based on the age perimeter salary. And the school is getting in in stanch aged here itself, within the local constructor. So this is how you call the constructors off your super class. Okay, So, inheriting from multiple interfaces. So, basically, how do you do it? You have a derived class, you have the base class and you have comma the interface name and a date to face name other than to face name and so on. Okay. Publisher classes can implement an interface using the same inheritance syntax used for the base class because in interfaces Hello, multiple inheritance. A power shell can class implementing and interferes may inherit from multiple types OK, by separating the tight names after the colon that is after the colon with commas. Okay, Just put in the interface names. Kama Kama Kama. That's it. Okay, the power should class that implemented interface must implement all the members off that interface so and interface impartial is nothing bark. It's caught a set off methods which are not implemented. Okay, now, when you're deriving all those, you are supposed to implement all those. So this enforces upon the developer that if you're inheriting a particular, that is, if you are considering your class to be off some type of the interface, it is in acting as a particular interface. Then you have to make sure that all the methods off the interface are implemented in this derived class. So that is what is the constraint. Okay, otherwise you're going to see he going to give her runtime. Okay? Meeting the interest implementation interface members causes a pastime error in the script . So you have to make sure that you implement all the methods that are declared in the interface all the interfaces that you're actually inheriting from, okay, inheriting from interfaces. So class, my compatible is inheriting from system thought I comparable. So you have to make sure that the method compared to which is declared and I comparable is defined here. Okay. And then you can called my comparable bar system dot I compatible. So again, you again. You have to define this particular. Okay, so that's it for this lecture. So in the next section, we are actually going to implement our framework. The company framework. Thank you. 25. Maintenance Setup: Section four Discovery set up. So basically, in this section, we are going to set up our complete environment now that we have understood how to program impartial, and we are very well conversant with the complete syntax and the advanced concepts. So now let's dive in and create our environment so we can start programming. Okay? No, we'll do a number of things in this video, So we're actually going to set up a directory structure first. The next we're going to install on download a lot of stuff from Internet like visual studio code and the database sq light database assembly files on de Escalate studio where you can actually see your databases view your database tables and all that stuff. So let us diving. So the first step is the directory structure. So in the directory structure, what are we going to do? We're going to create Ah, in the documents directory, we're going to create a subdirectory called Publisher and Automation and within automation , we're going to create a DB discovery with under discovery, we're going to clear the client and server models. The client is basically the u y. Okay, and the Silver directory were actually going to write our publisher main plus the entry point for our partial execution, which is going to refer toa a number of models and will also have 1/3 party directory where we are actually going to put in third party modules which are not part off the standard portion like our rescue light assembly. Okay, so that is the first step. So let us do that. So I opened the publisher prompt and I say CD documents. I moved into documents. So first thing that we're goingto do us create a partial directory. I use MD. Okay, make directory. And I go and do the ocean directory, okay? And I create another directory called Automation in a you stab. I go inside. Here, we create DB directory. Okay. Where our data by base file will be located. Andi, we're going to create a discovery directory where our discovery scripts will be located on . We're going to create more dunes directory. Okay, where are more deals will be located. And finally, our third party directory where our rescue light assembly files should be located. Okay. I couldn't use the command. Let me clear this and let me see the tree structure. So we have DB Discovery, more dunes and third party. Okay, now we go into discovery and under the scullery, we create blind and we create. So did OK, Let's come back and let's see. So we have our directory structure now. So we have db Discovery. Under discovery, we have we will have client and so over the client will have the u Y. The severed would have your actual the court main coalition execution scripts, which are actually going to refer to your models. Okay, the client also could refer to the model bargains. And finally, the third party data tree where we are going put in our sq light. Okay, now let's move on to the next slide. So now it is the sq like installation. So first, we're going to download the sq light from the internet. And then what we're going to do, we are going toe extract a zip, file this particular zip file and execute the test in the territory. Okay? And we're going to extract this into the third party directory under sq light subdirectory . Okay, so let's do that. It is pretty simple and straightforward, So let me go toe chrome browser and put in the particular you are from where I am actually going toe download this particular zip file. So this is a 64 bit bundle. If you have 32 bit, then don't forget to use the 32 bit bundle. If you have in those 10 32 bit in store so you can see that it's almost downloaded. So I just call the fordo on. Let me extract this. So first, let's open and see. What does it have? It has everything. All the install files so I can simply extract this one extract all I'm extracting currently toe the download strictly itself. Okay. And then what? I do I basically close this window as well. We name this file directory two sq life. Okay, all the washing Information control. Exe. Cut this particular directory and I go back into documents. I go into publisher automation. Okay, third party and I raced door. So this is sq light. So this is how we have. So we're not installing anything for six. We're just extracting the assembly. Okay, The next step is toe executor. The test. Okay, that the best talk, It's this particular test rt xy. So this will tell you whether your database is going to work or not. So there is a windows prompt. Okay, you can actually click on more information and click on run. Anyway, there is no risk in war, okay? And we can actually run all the tests on this particular sq light to see for the test passing. So you can see devotion just has passed to the rescue light and function. Correlation table creation, multi trading insert table. All the tests that are there the lock test. Everything seems to be functioning in order. It's pretty. So that means you can actually use this assembly. You can refer to this particular rescue light assembly and start directly incorporating or writing court and portion, but this. Okay, so let's wait for the test. All the chest cases to complete. So once all the best cases are completed, then we are actually going to set up a set off environment. Very so you can see everything is succeeded. So I close this. Okay, Now, let's go back to our slides. Okay? Now we have completed the sq light assembly installation and also testing. So we have also tested it. So what was our installation location? It was located under third party directory and sq light subdirectory. Okay, now let's go to the next step. In the next step, we're actually going to set an environment variable whose name is sq light Underscore Assembly, which is actually going toe point to system, not data dot SQL. I don't deal assembly file where we have extracted. Okay, so And after that, we're going toe test this particular simply if we are able to at that particular listen, OK, and see, let's try this. So to add the environment variable, we type PC and we click on properties and we go toe advanced system settings. We go toe environment variables and we click on new and here we specify the name as sq light underscored assembly. Okay. And make sure you spell it correctly. It should be exactly like this and you browse and you go to that particular sq light directory. Third party sq light. OK. And select that particular file which finds that this is the file system Dark later dot sq lie dot Deal okay and open. So this is automatically said click OK and click OK, Okay. Click. Ok, so this is I don't want to do this first thing. You close the current publisher. Okay, 100. Good. How do you do it? You just type exit. I'll go back to the extracted files, sq light. Okay. And what to do Here? Use right. Click on this particular deal called the properties. And make sure you click on this unblocked check box. And so the in book check auction goo be okay. Now you click. OK, And again click on. Publish it. Okay. And now let us see if we can at this particular type first, let's see if the environment variable is reflecting. Sq, I put you stab. Yes. This particular environment variable is set properly. You can see that. Now, Let's see if I can call type and type hyphen pot. This will be pointing toe envy, Colin. Sq light. So you can see there is no edit, which means the assembly's successfully loaded. So there is no problem? No. Let's go back to the slights. So the environment set up for rescue lighters Done. Okay, so in our publishing, first we need to add this type somehow. Okay. We'll see how we're going to add this in our partial. So it lords this particular assembly before we make any calls. Sq light calls. Okay? No, we have other environment variables that need to be set. So oneness Piers Morgan part which is a standard publisher environment variable where you are actually going to store all your models. Okay. And then we have PS auto home part where which is your automation directory, where you're going toe, which is going to be the home directory for all your automation scripts. Okay. And PS orto devi park is your database file location. So in your rescue light, the database data is told in a dark BB file. Okay. The DB finds location is referred to in the script by PS orto db. Okay, so this is how we are first going to Lord Sq light assembly, and then we're going to load this or create the database under dislocation. So let us create these three important variables again. It's the same thing. We go toe properties. That is because PC, okay. And because the properties and we go toe advanced settings, environment variable and under the user valuables. Okay, we're going to create it under the user variables only. So yes, more do pot. So this is the location off your more duels. So very start it is automation. More deals. Okay, so this is your So you need to select browse directory because it's a directory. Look issue, right. So you goto documents and you goto power shirt and you will do more to So this issue Morgan's directory OK, similarly, we are going toe add bs, underscore or do on the school home on the school bus. Your automation home directory which is going to be documents. Okay, Power show had automation. So this is your home directory. Okay, So home directory and you're finally your date of its location. Okay, ps underscore orto are the school db underscores, but And we're going to provide the directory okay, here as well. So go to documents. You go to power share you go too deep. So you have You're done. So you're basically added P s mortal part Bs automation Home directory and PS automation db pot. Okay, home, but and people so I click. Ok, I click. Ok, and finally I close this one. Now let's see what else is left for us in setting up the environment variables. So we have set up all the other environment variables. Also, basically PS model. Okay. Automation Home directory. SQL I d be pot. Okay, now, finally we go and download the visual cold. So till now, we have been using the power shell I see or the partial window. We are actually going toe. Start using the visual studio corner. Okay, so what we do, we click on this? Are we? Let's do one thing. We copy this particular directory, so we do it separately. Okay, so it has opened. It was opening your visual studio court. Andi. Now you can download the respective 64 bit. Okay? You said installer, We want a 64 bit insulation because our operating stupid 64 bit on it is downloading the official story. A court now. So visual studio corners also from Microsoft. It is an open source i D. Which can be used for programming in various languages, including power shell job. Are your JavaScript x attracted? So you can just click on that on the executable on it will, So you can actually create a desktop icon nestle and click next click it start. So this is going to install your visual studio code. So now we have all that is needed. Okay, let's go back to our presentation. So, basically what we have done here, Visual Studio Court has been installed. We have set up the environment variables on we have installed, extracted the sq light and provided permission to that as well. We have unblocked those deal files Deal, file, single deal file. And we have created the directory structure under which were going toe right, all our publisher. Okay, so we're not going to use partial Iasi. We're going to use, um visual studio code. Okay. Thank you. 26. Implement framework -- Setting the Stage: high in the previous video. We have set up the environment for our development. Basically, in start, though required assemblies and we have set up the environment variables we have installed over development tools. And basically, we have set the stage. Now in this video, we are going toe Look at the discovery face and see how we need to implement. Okay on. We're going to use visual studio court for it now. There to competencia. Basically the server and the service lookers. Okay, now, So the server and what does the script do? It basically I trades through the complete on the service lookups and for each server, it is going to execute a certain set off scripts. Okay, the service look up is nothing but more new names and the function names. So it has to dynamically load these moderns called some functions so that on each of the service, bypassing the servant into it. Okay, so to the script and the script is going toe, do some discovery and updates something it could update, or it could create some tables. Okay, so in this video, and a few more videos were going toe set the whole stage Okay. Okay. So let's see how we are going to go out. We're going to go about in developing this. No. As we said before, we have two major components that IHS service. Okay. And lookups. Or let us say service lookers. Okay. And eat. Server has got a server name. I would call it as server. Okay. It has got a night be on whether discoveries enable for this. That means you want to run Discovery on this particular service. Okay, Discovery status, whether what is the discovery status in the discoveries driving on it. Okay. And what was the previous discovery? So as Celester discovery ends, we could probably set the discovery. So we could say these are the columns in the vascular table, OK, And the next ists of his lookups. What is the service? Look up. It's basically a more noon, and we're going to call a function in the morning. Okay? So each more you can have multiple functions defined in it. Okay? And we have description, and finally we have any. So, basically, these are the things too important competence off our discovery face. Now let's write some surgical and see how it looks like. Okay, the first loop. OK, it could be a do loop. Mostly, uh, would go through lookups. Okay, let's look ups and end. Look up. So for each off this look up, it is going toe. Look through service. Okay. Service. Okay. And then create a job. Name. Job name. Okay, that is based on on. So over. Look up and function That is going to be called. Okay, So what more do land function or look up in fact? Okay. And check if the job is existing existing. Okay, that is good job. We have already discussed about this in the previous section. Advanced permission. But we're really implemented. And if the job does not exist, if the job does not exist, what do we do? We started. We could get a job and started. Okay, Clear and stunt. So that's this is this is how did it is so simple. Okay, now let us. So let's implement this using our Polish Visual studio court. So we're not We're no longer going to use our martial law, Social Iasi. We're going to use a proper development environment provided by which provided by Microsoft . So letters opened the fordo so that the first step So we know where our folder is, Right? Under documents under publisher. We have an automation folder. The directory structure. He said like that for learning. Open it. Okay. And if you see, this is the directory structure. BB is very real basis. So we're going to concentrate on the discovery folders. Okay? And on the more Nunes for the now, let's go back to our this thing. So what do we need to do now? Let's create a model first. Okay, so this model is going to be called biter discovering main script actors. This particular look OK, and what is the first thing that this loop has to do before this group? We need to fetch the servers, and we need to fetch the lookups. Okay, so let's create a model first. So how do we create a born you? We didn't discuss this in previous sections, so I'll tell you now. So we create a folder with that particular model name. Let's call it. So where did you? Okay, so the responsibility off this model lists to call the database. Okay. SQL SQL database and fits the sober details and inventor details on do a lot of other rescue operations. So in this server DB directory subdirectory, you click here and create a new file. Okay, which is also going to be sober leaving. But it will be not. Yes, one in Philly B s m. One. Because that's how our social will know that did it is a potion more. You okay? No. In this partial modern, we are going to write to functions. OK, we're just going toe right to functions, so function. Okay, Fritsche. So of us. Okay, you can ignore this opening message. And okay, the second function ISS function Fitch. So this you cups. Okay, now we're not going to write the Devi part right now, So first, let us put in some data, Just test data. So dollar service is good. This is nothing but an ari off service. Keep it like this. And the next s dollar. So there's nothing but a dictionary object. Right? So it is going to be with curly braces. And what do we give here? We give the silver. Okay, is equal to see absolute one. Okay, seven colon and I P is a little you can give some Might be here, so might be okay. We don't need other foods. Okay, so if you actually see the basic fields are things okay and we're going to select only those for which their discovery is enable and the status is not running or not in progress . Okay, so So Discovery State, this is not currently running, so we're only going to fetch those in our in our actual court. Okay? And so this is sober one legacy, and this is several One, this is of us. Okay. And similarly, copy this. Make it so do so do This will be absolute do. And this is 13. Okay, now we happened. This $2 servers, dollar servers plus is it will do dollar. So one okay. And most of us and no, sir, Verse plus is equal to dollar. So too. Okay, Simple. And then were returned. A service. It's that simple. Okay, No, we have some test data. OK, now, second nous lookups. Okay, well, we call it service. Lookups is on. So and Eddie, So we use normal brackets and then let's create one service. Look up. Okay. And this is ah, next on the object. So we use a flower brackets on what we give here for these. What other things That we need function more dual function and description, right? So for more dune, or do we define more dualistic will toe legacy? Yes. Discovery More A semi colon function Physical to discover. Yes, OK, and description this insulation. Okay, similarly, we're going toe Create another service. Look up! So this is service. Look up one and we create another service. Look up! So let's look up to the sequel dough. But send like this on more fuel is equal to let us say to discover on article database Okay , Discovery more do. Okay, so and seven calling and function function names. We keep them unique. We just don't write. Discover the right this tower oracle. So keep the function names unique for simplicity on description Insulation. Okay, No, we use service. Lookups plus is equal toe dollar. So let's look up one Okay. Dollar service lookups plus is equal toe. I don't know. So I look up to and we return this Okay service. So now how does publish alone understand that this more duel is located in this particular directory? So basically, by using that particular piece Mortal part in the government will even that we have declared in the previous section Okay during the second. Now we need to call this in this over B s. Okay, so we create a discovery dot B s one. Don't be Yes. One, five. Ok, and now here. What do we do? Let's see. Import hyphen more do. OK. And so we're DB Okay? Hyphen force. We want a force, The import. Why? We want the fourth input? Because each time you make any changes, it is going to force Lord changes. Okay, so let us try to execute this important. See if it puts Yes. So there is no error. That means they're just actually working. OK, now we can call Fitch said reality. There are the completeness working fit servers and Fitch Services. Okay, so let us try to run these, so we goto servers directory. Okay, See you discovered e. Okay, CD servers. So directory clear it and they're still very dark. PS one or the complete works here as well so you can see we got the service. Okay. The item is already added more do so there is a problem with the letters. Look at darts over TV. So what happened yet? I s discovery. And this has to be look ups, right? So let us execute again and see whether the changes will get executed. So, yes, so you can see it is sprinting out your servers and you're spending out you're more successful. Okay, Now we have created some test data. Now, what is that next step? Our next step is actually writing this loop where it will look through, and it will actually create these jobs, and it will start running these jobs. Okay, so let's see this in the next week. Thank you. 27. Implement Framework -- Write the entry point: high in the previous video, we have basically created several TV model on we have implemented to functions on duh injected some test data into those functions so that when we call those functions, we get the server inventory and we get also the service lookups right now in this section, we are actually going toe go a step further and implement the actual loop that we were actually discussing about under previous section. So let's look at those who record for that loop. So it is basically looping around the lookups and snooping around the servers and then creating a job and then executing that particular job if their job does not exist already exist. Okay, so that is the particular loop that we're going toe implement. Now we're going to use object oriented classes for this, Okay? So that it is more easy to understand and represent what we are actually trying to do. Okay, so let's clear this discovery DB okay? And let's implement a class discovery and we will create a constructor here. So in this constructor, we are actually going to call import more duel. Okay, so over db hyphen force toe force, though luring off this and then we call another. We create another method which returns Boyd. Okay. And which is called Start this going. Okay, start Discovery, which is a method off the class discovery, which is borders actually going toe do the actual discovery process. Okay, so how do we do it? So we first get the list off service. Okay. Dollar servers. Physical, too. Fed servers. Okay. And he said dollar service lookups. Okay. Is it cold? Oh, fetch service, lookups. Okay, quote through this, and then we do for each. Okay. And look up. We can just specified as dollar donor look up in dollar. So this lookups we don't want to use for group you want to use for each loop as discussed earlier. And within this, we will have for each dollar silver in in dollars off us and we'll remove all this born in this one. So this. Okay, so that's okay. Find no at us. No for each Off the server. What are we going toe do We're going toe extract. The ah host name okay, is equal to dollar servers dog. So over. Okay, So that ihsaa that is all we call this and We also have a more dual. The whole Oh, more duel is equal to a dollar. Look up. OK, so this will be Look up, Lord, More deal. Right? So it's very sort of complete. There's created something else 40 years on and dollar function. So is it called? $2 look up dot for so now regard the host function and model. And now let's create a job name. Okay, Job name. So this will be dollar job name. It will be a unique name which would be based on more dealing. Okay, plus dot Plus And then we could actually give it us dollar function. Okay, Plus plus daughter host me. Okay, so you have a spelling mistake here. We put it us. I OK, so we have the job name now what we do now, we need to actually check if the job actually exist. This particular job is already running in the particular in that current session. OK, so dollar J o. B. Is equal to so we called the get job. Okay. Hyphen name. What is the Jordan job name? Dollar job. Name. Okay, hyphen. We give e a okay and silently contribute silently. Continue which means if there is no such job, it would not throw an exception here. It would actually silently continue without throwing any exception. Okay, if now you check if this job is not know. Okay. Hyphen, not equal dollar. No. Then what do you do? You create that particular job, right? And not equal tunnel and also and hyphen. And what we can see is dollar job door status we have seen previously. So status hyphen e que? Yes. What? We will not do this right now, so we're just checking if the job is not equal to know. That means there is no job right now. Okay. So is not equal to know. Way would say equal to know. Then what we were do, we would actually create this particular job. Okay, So how do we do that? Using start job. Okay. Hyphen name, daughter. Job name. So that would be the job name. And then we have another point, which is called the initialization script. Okay. We'll not do the initialization right now. We will just execute a skirt block. Okay, Script block. Okay. And dollar function. Okay. And let us call this function. We have not yet implemented this right call discoloring more deal. Okay, hyphen. What is the argument list for this function? You're going to give them more do, which needs to be called Homa. The function that needs to get called. Okay. And on which dysfunction. It's too big card. Okay, so now we didn't implement this. So let's implement this particular function. We implement dysfunction outside the class scope. OK, so we call this function called Discovery Model. Okay. And water, What do we give here? We give Dolo more deal. Okay. And coma. And although function, which is also a string type, it's not banned entry to provide the type. But we're providing it anyways on a string I don't know. Okay. And well, in the braces and places. Okay. Now what do we do here? Here's we will say OK, we'll just write it, OK? Right. Host basically writes your listing. Okay. Writes it to the console. So what? We can write in the right host. We can see uh, corn more do. Okay, Dollar more do. Okay. Or we can say called function. All of function in dolled up more do. I won't do okay on most Don't know okay? And let's say we sleep for 10 seconds. Sleep is nothing, but it's going toe. Just wait for 10 seconds. Okay? So you could ignore this morning. OK, so now what? What we're doing here? We are executing a loop. We are extracting the hosting more dual function job name. Okay. And we are trying to get the job object with that particular job name. We see if it is equal to know, then what do we do? We run this particular star job with the script block containing a function. Okay, whatever is there in the function, this whole block will get executed. And what are the arguments started forgetting past into this particulars to block the model function. And Hosni So that's it. So this is And now how do we call this now that we have written everything, So now be in. Stan shared this discourse. Discovery is equal to discovery. Call in Colon. You right? So this is how you create a discovery class off the above class that you have discovered, uh, declared. So dollar discovery dot Start this company okay. And told your braces That's it. So you have actually completed the mean more duel or the main? A surge. A script Discovery script that is going to get executed right now. Let us see if we can actually execute the script and see what is going to happen. Okay, I go to Discovery Directory. Okay, sweetie. So over directory. Okay. See you. Less clear it. Okay, let me just expanded a little bit. And now what do we do? We just execute the Discovery Dart Bs one. Okay, so let's see what happens. So it has returned. Okay. Now, if I see get hyphen job, you can see there are four jobs that God actually executed. Okay, so that ihsaa very strange. We are supposed to get only two jobs, right? So why is it getting four jobs on? All of them are running basically. So if I check the get job, all of them are complete, so these jobs got completed. Now, what we can do is so we can say dollar job. The let's debug NC get jobs. Okay, is it couldn't get hyphen job. So we got the jobs. Don't daughter jobs. Siegel. Dog name, zero. Dark name. So what is this Discovery model? What does the discover the discovery that is getting executed on on of it's over. Right. So on the absolute one off course So we have now if you'll see the second job we we are supposed to get right. So this is only gon aps over to now the third job, third job or court executed. So the third job we got the the article discovery was executed on DA. There was no more deals that is provided here. We're not getting any mortal. Why? We have to see s 012 c two to also you're not getting the model so more Doolin function. So basically call function. So the model is coming. But the function is blank for this particular these things. So let s see what is the mistake that we have done on the server? Db So this should have bean function. There is a mistake we put junction suggest so we re execute again. So what would happen when you re execute? So it will anyway force your changes? Whatever done. No, you have done in your sovereignty Beef. You missed this hyphen force keyword. Whatever changes you do, you have to close the session opening musician only then it will get important. Okay, so now let us see again. So what we will see do is remove hyphen job because all the jobs are completed so you can remove them. If the jobs were running, usually you had to stop the jobs and then remove them. OK, so I removed the jobs and does star. So if I see the jobs down, get hyphen job, there's nothing that. Okay, See this? No letters again. Execute Discovery. See for this. Working fine. So if I see get hyphen job. So they're still running. So it's going to run the low. Ah, 10 seconds because we're put in a sleep off 10 seconds. Right? So that means they're all running in parlance. Okay, All the execution is happening in battle. You don't have to wait for one execution after other. If there are 100 servers that all the 100 executions would have happened in battle, OK? And all those jobs would have completed separately. Now let us see low. Now if we see the jobs Okay, again dollar jobs. Is it going to get hyphen job? Since we're not giving the name, it's going to get all the jobs put it in dollar jobs. Okay, Dollar jobs, zero door name, which is fine. And one also is fine. Which is running or not Absolute to discover. I s OK now. There to see the 2nd 1 Second one. This article. We're not We're getting the proper function. Well, you know, on three. So it's very clear. So in this section, we have actually completed the the discovery. The what do you say? The basic framework off Discover it is that simple, actually. Now, in the next section, we're going toe implement the models. Okay. How we are how to implement these models. That means in the discovery more dual people have toe actually call the models here. We're not calling. The models were simply way had simply, just making some call. That's it for this particular function. This function should actually call the model. So what you can do now? Actually, you can see has more data. It is true. That means there is some support that is there in this particular this thing. Okay, So what I can do, uh, I can call received job. Okay. So what I can do is see every haIf and job. Okay? and dollar job Dream. The doctor is going to be dollar jobs. Okay, zero dot name. So you can see so called function discovery eyes. So this particular right host is now available here. Okay, Now, if I do get jobs, Good job. You see, this has become false because already have read the data. Whatever. Logs, whatever. Lots out there for the job. And similarly, Aiken below the logs for all these jobs as well. Okay. No. So what should actually happen? We should actually call the more you'll hear so it can dynamically call that particularly important model fourth it like we have done here for the server db And make a call to that particular function. Okay. By using the invoke Ament. Okay, let's see that under next my 28. Implement Framework -- Integrate the modules: Hi. In the previous section, we have implemented the main loop which runs through the inventory. And for each look up, it is going toe execute a specific function. Now, in this video, we will have toe implement the court for running specific models from it. In that function, that is, you have to dynamically load that model on you have toe executor function a specific function that is specified in the look. No. What would be the advantage of doing so? Each off these models can be spaces separately developed and they can all be integrated. They can all be placed into the modules directory and they can be used. That means basically you are simplifying the development framework on you are allowing for Balor development. Okay, so let's jump right ahead. So we have implemented the call Discovery model. Now, this called Discovery model should actually Rhonda function. Okay, so but on the model for a specific model. So first we have toe right, the more deals for that. Okay, now, what are the models that we have said we would be looking up that IHS eyes Discovery model and Oracle db discourage so Okay, so they should be the folders that we need to create inside the Morgans directory. So we have Iess Discovery model and we have particle. So create another directory cord or Kaliska removed him. OK, now, within the IRS Discovery Morgan, you should actually create a file also with the same name. Okay, so I create a new file Dart B s M one. Don't forget, it has to MPs m one, not B s, one. Okay, now what is the other file? That IHS Oracle Discovery model? Ok, we call here like click create a new file dot B s m. Okay, If you declare it as PS one, then that model never get loaded. Okay? So keep that in mind. Now, what is a function that you're going to execute? Discover eyes. Okay, now this Discover I s were going toe right it and discover I s model. Okay, So, discover. Yes, it is going to basically take more new and Bordeaux. You don't need more dealing function, right? You just need the host name Dolar. That's it. Because this is the modern, the function that is actually getting so you don't really need that. Okay, now, similarly, we go back and we get for the article. Okay, so in the article, we're going to describe a function in declared a function or dollar. Okay, that's it. So now you have about the functions. Now, how do we call these functions? That is the main implementation. So let's do one thing so calling. So we can just say right hyphen host. Okay, calling this color I s okay. On on a dollar. Okay. And similarly for Oracle db So we right. I felt host calling discover Oracle on I don't know. Okay. And let's also do asleep here. Let's go to sleep here, actually. Sleep 10 seconds, OK? And we do the same thing. Here s for sleep for 10 tickets. Seconds. Okay, so now so this we're just We have just left it. Left it, dummy. So what is actually going to be implemented in each off? These functions were going to actually implement some w and my calls. So this particular host name okay, with some centralized credentials, OK, which is all stored in the database. Okay. The centre credentials and using those credentials is going to make it appear My call, it is going toe check for some Windows Services. All that stuff. Okay, now that what do we do now? We go back to our discovery script, and here somehow we need toe lured that particular model. So how do we load the model? You say, Board hyphen More deal. Okay, More de Lima's dollars more deal. Hyphen force. Okay. And then we need to call invoke expression. Okay. Hyphen expression. Okay, this is how you dynamically call a function. Okay? And what do we do here? We call dollar function, OK? And although host me so I don't know horsemen. Right. So if you see your calling, dollar function and passing dollar holds name and we'll remove this. Okay, So one more thing that you can actually do. Let's say if that function does not exist. Then it is going toe failed. Get that particle job itself is going toe fake. If that function doesn't exist, are the mortal doesn't exist either? Okay, so this is how we're going to make a call. So now what do we do? We say remove hyphen. Job star will remove all the jobs. Okay. And just according to score, So let's see if it works. Okay? Get hyphen job so job is completed so we can see if life a job. Okay? And can I just see sequence? Tous ce ab server is not Liqun iced. Has a name or commanded. So what is happening here? Uh, it is, uh, throwing an exception. Okay, so object not phoned. So here we have by you have missed here. That is the reason weight has happened. Okay, Now let us remove all the jobs. Start in this, Okay? Just execute that the Scordia again. I can type and job. So it's running. Dostam are running now who were completed. Okay, so what is this completed one? Okay, I have a job. Okay. 20 pine 29. So it has given another Saudi, so arti c there's a mistake. You see me job? Okay. I'm 20. My so calling this Cody order to this Cody on job. So you're just working fine. So if I see now, get hive job, all of them are completed. Okay? And if I see for c e i e. Job. If I say star all off those all their job blocks are going to come here. Fine. So now what did we do here? We have actually dynamically loaded that particular model and dynamically called that function directly, OK, passing in the horse name. So you can see the host name is also properly getting called. And all these methods are also probably getting cold. Okay, Now, what is the next step? The next step would be, since we're not going to concentrate on more deal development here, what are we going to put for the oracle? Discovering for the eyes Discovery, ex cetera. What we're going to do now is the database development. Okay, so in this overly be, we are actually going to implement the sq light. Okay. Ah, functionality. When we are going to create a database and insert certain tables in tow the database and insert inventor into the straightaways inside the look up a rolls into the straightaways. Onda, we're going to use developer studio for that Escalade. Della passed radio and badly. We're goingto or removed us sample data, and we're going to directly collectively the base and extract that. Okay. Okay. Thank you. 29. Implement Framework -- Connect to SQLite: Hi. In the biggest section, we have understood how to create more use and also hope to call those mornings dynamical. OK, now, in this section, we are going to work on the database portion where you would actually store your inventory and story or look up. Okay. The service. Look up, names and functions. So first, let's go to the soberly be Oh, shit. Morgan. Option More unit is a PS and one morning, So Okay, so what we will do is we'll start by creating a server class so overly class. Okay? And we're not going toe go through or have a separate lecture on how you're going. Toe. What? But sq light we're going to see Yes. Okay, so So first thing is, we create a static member, okay? Called collection street, which is nothing but a source. That is, it is the location off your database file. Okay. Data source. Physical. So you define it. He envy colon. Okay. S O B. What is our listing? B s ok. No, this is the video that we had declared in our ever onward. Set up slash This covering, doctor. Okay, so this is our date of its flight. Okay, Now, the first thing that we're going to do this create two methods. Okay? Now, these two mentors are basically for oh, no single method, in fact, for opening connection. Okay. Okay. Next to be creator constructor. Okay, so the constructor would be to see the master lasting okay way Don't possible about this, OK? And in this what we do this on, I like looking at the state Baath. Okay. Don't you envy Colon? That's cute light. All right, so since sort of Phyllis Foky, I think it's going to work. And so I just checked. We can execute decency if the assembly is getting this Assembly is getting so this is actually going to lower your complete now ascending or your calls to your publishers working portion section. Now the next portion offer this toe, Get a collection. So how do you establish your connection to the so to establish a connection, we create another function. Okay, so what does this function? Uh, well done. That's studio. Okay. System not thought Yes. Light? No. The whole que light. So this is the bandage off using visual studio court. Okay, so he calls. Okay, connection. This and this partner who created a very evil corn, which is your connection and create a new object object. Okay, like name. Okay, system, not you. Don't sq light? No, this light greater your project, then you have set the string corrections. Drink. No connection. Strip azi Quito. Holy call this so TV. We have to find out. Connection Street has static, actually. Street cred. Then your tone go. Okay, so this is how we create a connection to that particular. Now, let us make Accardo this and see how it works. Okay, so what you do, you see? I don't know s so really beat. And we called. You basically created use over. Okay. Okay. And so double right? Yes. No, get No, this is, uh this is how you call it. Okay. So instead, off there's let's do one thing that does actually goto the creator function. Okay, Get so let's function just toe. See if it works or not. No. So Okay, so let us call it over here. Okay? See less. So the first thing that we need to do is import module. Okay, so over db hyphen forced. So this is forcefully going to load this module, and then we'll say, get collection is equipped. Okay, So in order to see dollar called, So yes, you called right now legacy if that particular levy files ever created. So the date of this file has God created. But this is how you can infection. Okay, No, The second step, the next step, it's toe create certain people's okay with this particular Oh, in this particular leaders. Okay, so what we do, you say strength? Just static, Okay. Oh, okay. This is the sq. Okay, so we create, like, the school statement here. What we can do is we can write it in a multi line. Okay. And what is this? We call it Dolo. Create underscores people s court. So Ok, do you don't escort people underscore? Serve us. You have to see if North exists, okay. And, uh, even serve us. We open the flub of races here, and we say my which is Joe. Okay. And its supply Many key. So every table has a primary key, okay. And orto inclement, it is an indigenous, so you can get one increment on. So So that means you're saying he true The database is responsible for order incriminating the primary key. That is the idea. Okay. And the next us. So So as we go through easily, understand what all this means. Okay. How you define David. You know that. So it's just very simple. Just a matter of practice. Okay, so So this is another column that really finding. And we have Beatrice. Okay, Cash. And this is also not a 6 32 Okay, I I Oh, great. Okay. Coma and risk. Anybody discovered easily. Okay, this is golden on that. We have discarded status. Given that it is sexist or failure, we're going to store it here. Okay. And then I will say this court date. Okay, this is a dude. Now, let's see how we would create this. Okay, so we would like to create this table here. It's okay in the conservative. So in the constructor, we're going to do this. We're going to call daughter this. I don't get connection. OK, so we're going to use dollar this, right? Okay. Very this thing. No con this. Okay. And what you do here once you get the connection se SQL command. No, no, Come on. Okay. Iss, I think dollar corn dog first to create a command. You come on. Okay. So once you have graded the command, you need to give them an excuse for this comment. Okay? No, No, que Let's see. Clark do okay. No. So be okay. Okay. Great defense of us. Okay. This issue, ask your that. We do can't execute it. And you say dollar sexist. Okay, come on dot SQL command. No. Execute long, Quick. So Okay. Right. If you want. Like, toast dollar. Okay. So what did we do here? We got the collection. Okay. And we created a command object. We specified the SQL. So how do you specify the sq dot command next week, Mr. So here we will say this is how you specify this And then how you execute. So just execute long quite so that it is actually okay. Now legacy. So basically. So we will say, get connection off. So let's say initialized tables. Okay, initialize statements. We don't mean these functions what we're going through. Okay, so just write it so we can keep calling them, so don't be quick. So this is all you create, right? Created you object. You created a new object and then what did you do? The hollow has Stevie touch it. You don't need to do anything because the Constructivist directly calling this and one more important thing that you should remember. You should go on Dollar corn dog. Forget this. Want to close? Disconnection? It's OK. Sorry. Feel This should be court. The connection, basically. And then we created a command. Specified the excuse. Espuelas also is very simple. You can see three table if not exist service. And then what is the primary key and one of the columns? Other columns that you actually specify. Okay, so now this is not going toe interim later. In fact, it's actually going to create. So let us run this. First you need to do with import this Morgan. Okay. North said accidents. It seems to be working fine. And after that you need to call this function. What a certain initialized tables initialize. What is this? Start walking. Oh, I see. You spending stick so that doesn't put again initially, I still rules. OK, this so data, sir. Oh, we don't You should know. So yes. So executive known. Ready? Okay. Databases not open. So what we need to do first we need to actually open the connection. Okay. Dollar call not open. Okay, so we should not forget this bust Open the obvious connection. So on a Okay, So that means we opened the collection and we close the collection. Hope that this So that means we get the connection. We open the correction. OK, well done. The quality and we close so again, import once more and unusual. It's so let's see what happened here. SQL ero So on under good night's token. So we have some. Be sure that s que so here it should not be floor brackets. It should be this this now just again input. See if there are any for the US You so sex. That's why just giving their its okay. In the next video, we're actually going toe three the remaining devils on. We're going to also see those prints. Okay. In the her story us Good. I think 30. Implement Framework -- Connect SQLite: high in the previous section. We have created a service table in the section We're going to create the remaining people's , so let's jump in right away. So we have created one table. Now, let's go ahead and create the rest two tables so the other table is going toe. Basically store your lookups. Okay, so I say string, Okay, static. Don't know. Table under school, your cups. Okay. And is equal to So we have Moneyline's drink, huh? And then the create people. If not this, okay? And then we have service underscored. Look up and use praises. Okay? Again, we have Heidi. So this idea in digital okay, on primary key. Okay. And it has auto increments as well, so we don't need toe white, tiny keep on checking nineties and probably nineties. Okay, Now, the next s more you'll which is, uh, where cars 32 medicine that wanted a string off length that he don't Okay, function. And this is also Oh, that cut 32. Okay. And description. So let's get 1 28 So we'll have more space for this. Okay. Enabled a less boolean. Okay. And what is the next table that we're going great. So this also is going to be string. OK? Static okay on Don't know it's spinning. Create people on that score. Conventions. Okay, so this table is actually going to start Good entrance. So great. A multi lines drink table. We've lording this. Okay, if Nordic this contentions discovery make it caps, it doesn't really matter. It is falling according convention, so that and we can copy the i d. Okay, ideal to implement. Okay. And wardens do you need you would need user name. So we're considering. So it is going to be a global credentials for all. Okay, all horse. So that cats, it's 24 and password IHS Also that cuts it's too full. 64. It's possible characters length. Okay, so we have provided the skill strings. So now what do we do? We just go toe about particular off this thing, okay? And we open in a single collection. We're going to specify all off it. OK, so we're going to create a common, so it's going to be the same. We just copy this twice, okay? And instruments executing create table so over again. So what we should do? It will be Okay, Table, look up. Okay. And let us remove this. Also, it will be great table pretensions. That's it. So simple as that. So basically what we have done, if you look at the quality of skill quality, for example so just to understand, it's very simple, actually create table, if not exist. So the table exists. It's not going to recreate table. So each time when you initialize the sour DB, it's going to check the tables are existing or not. Okay, if the table erotic this is going to recreate, it's not going to delete an existing active. Okay? And then you're creating three tables. Basically. So that is so us. And service. Look up, Interventions. That's it. Okay, so now again, like that's Ah, loan the module again. Let's clear this. Okay, Import more. Do so really be force. Okay. Initialized tables. So we have an editor with the one off the statements near lawn. Ok, near long. There is some kind of a rush. So there is that known so syntax error near loan. So this is an excuse letter, So let us see where it could be. So I d in digital primary key. I need it by Mickey Out of increment. Uh, prime Mick, your instrument function. More new description and bullion. So we could be one thing that has just comment this out. Have to see if it works. Is it the first common or the second? SQL which is actually causing issue It is so it's coming to solve as well covered sq it as well and initialize so there's no problem here. This is fine. Oh, district the next SQL statement. Okay, we Lord the models for the dark. So this is also fine. So we have a problem with the target school? Basically. So the last escorts treatment? What is wrong with the last SQL statement? So if Lord exists right, it's lawn exists. That was the problem. So now let us force this and initial lights seems to work. Success zero for this table as well. Now you want to do you get your tables? Okay. You're just saying the tables exists But we didn't really see the database. So what do we do? We go to documents, sq light story You the one that we had installed in the set up extracted in fact. So we opened this escalate studio and we kowtow. Database and database. Okay, Sq. Light file. Okay. Now that basically the date of its final, so should have got created. Let's see that. Documents. Okay, our show Automation. You know, the TV directory? We should have disagreed on TV. Yes, it has. God created So selling this particular file, okay? And that's the connection. First connection is fine. Okay. Okay. Now Celik, Justice Cody database and open the collection. Okay, so you can see all the three tables here. So we have discovery credentials, which has three columns. Okay, I d use uneven password. We have servers. Server has got six columns. We have ID's over. I p Discovery enable Discovery State Discovery date. Okay. And finally, you want service? Look up. So it's look up. Has got i d more dune function description. Anybody, right now we have on the tables that are required for our discovery. Now, what we need to do is to insert data into servers and insert data into credentials and into service looking okay. So once we insert the data in the next video in the in, the subsequent videos were going toe actually are right. The methods to update the stables or fetch records from the stable and finish our friend Look. Thank you 31. Implement Framework -- Insert Data to SQLite: Hi. In this video, we're going toe insert catering to the three tables that we have created in the previous section. Biggest video. So let's do that. So the first step that we are going to do is we're going to create another directory called Conflict. Okay. And we create a Jason five in this conflict territory. Okay, Lord Jason. Okay, Now this Jason is going to be read by our program, and there's Jason directories. Jason, file is basically going to have to our configuration complete configuration. So how do we do that? So so so of us. Okay. And this and next would have a list off lookups so that this lookups and okay, now each of these service would have So let's define threes of us. Okay. Name. Okay. A miss name. Iss B. C. S. Okay, the service that we have created previously, and, uh, I be be a sport i p address in 90 to 1 68.1 dot tens etc. And then, uh, that's cool. And he burned. So this is going to be true. Okay, we call Paedo seems set, tries to more times and you say this Absolutely one. Okay, 11. And this is absolute too. And this Okay, no look. Ups, lookups water. We're going to give. They're going to give more. Do copy the values from there. Okay. And then function. Okay. Description. Okay. So we'll have toe copy on this from our hard quartered values. So from the server TV. So let's go back toe. So data that we have actually, yes, data that we have used previously. So we got this. We put it enough. Jay's on fight, so you get more here. Okay, on make of the function. Okay. And we get the district. Okay, so we take copy off this again and we update for the classroom. He's not really examples were just putting in some dying to the David's. So discover Oracle. Okay. And the description. Okay. Oh, so we have the complete configuration now, So now what we're going to do is we're going to write a function in somebody be okay called initialize data. OK, which is actually going to believe this conflict? Fine. And okay, because it wide data OK on, I don't take any conflict nation on, uh, let us see how to be. So, for it is the first step that we actually need to do. They need to read. Jeez. All right, So this is how we leave. Jesus. Cheese on is equal to Okay, first read. Get Cordant. Okay. And we say hyphen. Raw data. Okay on hyphen Bob. Okay, but there's nothing but daughter. He and be calling. Yes, OK, hold. But the home directory in the home directory We go to Discovery subdirectory, and we caught the conflict. Okay? And we go toe conflict dot Jason. Right? And then whatever data or later, that this come coming, we pipe it to the command lit standard conflict from She's on. Glad to see us. We would have converted Trump's against me. So what happens? You get a Jason Dickson directly? Okay, so now that you have the complete Jason, what do you do? Let's do one thing seconding is dollar distort. Get connection. Okay, so this what does it give? It gives you a connection. Object? We started in dollar corn dollar corn dot open collection. Right, Because the open connection on this and dollar corn dog close connection. Right? And no, sure, we will do forms to four times basically foreign films for each okay. And then what do we do? Dollar server? It okay? Don't know, Jason dot So so So they do for jobs like this. And so I think you hope we haven't. I did this particular object. It's pretty simple. Okay. And this? I don't know. You look up Okay. In Dona Jason. Dordt lookups. Okay, so, hope. What is this service and close races. Okay, No see you. Let's a service. And this is Lookups. So we have come here right now. What do we do now? We need to create an SQL. Okay, So how do we create an obscure? So we will say in so desk your okay, let's create that in sort of school as a static. Okay. As a static on, let us put it as, ah, local media bill itself, because the values off these valuables keep changing. Right. So what do you see? Don't know. It's Cuba. So this is underscored. Rescue. Okay, quick. Multilane street? No. In the marketplace string. Or do we do this insert into okay, this so of us. Okay. What are the things that we are going to me give server? I be okay. Underscored? Anybody only going to supply these three battle meters. Right? If you see the conflict reason, okay. Name a server and desperate to score any so and then And this. Okay. And And person So okay. And m percent I be And 1% D I C school. Okay, so this is this is the SQL statement. That means inserting two servers. Okay, Whatsoever. I discovered enabled columns with these specific respective values. OK, no. Let us complete the loops for loops. Okay. Had to see first kiss, so don't know, hosting is a dollar silver dart. So a doctor named right name Okay, me right dollar high p is equal dollar server dot Be and I don't know, physical silver dart discover any look. It is There are detailed X three objects, Right? Because see what? This in this statement, it automatically converted the Jason into data dictionary. OK, so we came up to servers and on all each off these servers, we are getting the hosting I P. Address and discovered Curtis name I Pinterest and Miskell. Okay. And now what are we going to do? We're going toe. Create an SQL command. Okay. You don't Command is equal to okay. dollar corn dog could create. Come in. Okay. Now we have created an SQL command here. No skill command dot Com and fixed. Well, we'll have toe bill set to come index later. So what? We'll do this Don't look good. No comment. Skip this case. Okay? Come on. Not bad at this battle because Daunte had with Well, you okay. And with value is what we're going to use to replace. Oh, uh, your add sobo. Okay, basically replace this at server. With what? That host me. Okay. Okay. Similarly, what we're going to do Copy this. Not three such values. Right? So I told me, Okay, at I p and this is going to be at i b okay on that. Yes. Nothing but dollar. Let's go Any okay? No. What do you do? Don't know. Command, if you need to specify, supply the command. Dexter, Command Dexter's nothing Board your rescuer. This acquittal, okay? Don't know. So desk units of what? We can do it. Insert underscored servers Underscore. So those. So you take this. Okay, so this is over and then dull SQL come and don't execute non quiet this portion now. Similarly for you. So what we're going to do here. I'm going to save daughter sort. You look up. Underscored skirt. Monty Linus Q 11. Okay, no, in this Marty lame excuse. So we're going toe put in the SQL inside into Okay. Is that David name? Let us just make sure David name is service underscored. Look up. Right, so it just correct. So we go back here. Service underscored. Look up. Okay. More than the columns that we are going toe ad for this morning function and and one do or values had okay, more and function. Okay, that so just make sure correct. So we have more dill function and description. More function and description, right? So down we go back to this and we complete dis as well. So what do we do first? You get these valuables here? Don't know. More Do is equal to look up. Thought more. Do right. Study. Dollar function is a good $2. Look up. Dog function. Okay? Don't know. It's a good talk. Talk don't description. Okay, so this way you have got on the values. No, we will add the's para meters. Endings could weaken copy on this year, Actually. Okay, no more do. So this would be at more doing do right? And this is add function function Close this. Okay, that function we had function here. Okay. On. And that description don't miss anything and destruction. Okay? And this is insert. Look up SQL right in certain Look up my skirt and execute. And we closed this connection. So that's it. So now what happens? It is basically going to lure your Jason first. And then it is going toe loop through the servers and Jay's lookups, okay? And then it is going toe insert comments. Okay, Now let us try to execute the SENSI. Okay? We'll create another one, or what I can say is initialize tables. You can actually see initialized di die as well. Okay. Medicine says so you can see is dollar STB dark initialize. So just check if this book So So first thing that's clear this Let's force Lord no errors. Okay, Andi initialize tables. Okay, we have in a school. Okay, so there's a spelling mistake Insert. It should be insert right. So that is a missing. Okay. And then if you execute again, you should statements. So just Mr Archer, we need toe. We know this and thanks. Okay. Now there's Let us see if the data has already got or has gone into the David's. Okay, let's go over the skills to do you know. So which is in Commins? Yes. Girls studio on Sq night Studio, open this sq night studio on. What do we do? Yes, it's already opened, right? No. Collects. Connect to this on. What do you say? Create tables. I need toe open An editor. It does hold opening todo So I created a very creative you import execute SQL from file. Okay. No, no likes parents. Can I? Yes. Okay. Constraint triggers, and all of them are there. But I need to execute. Minuscule. I ask you open, dear. Escorted open escalated. Okay. Now Selig start from so of us. OK, Sam, if I execute this, I can see there are a number of service support executed because it re entered all the data . Okay. And similarly, if I see Celik star from lookups, start from cups, okay? And if I sell it this Andi execute good. No such service underscored. Look up, right. Service underscored. Okay. And that's execute decency. So yes. So it has created these. I don't has created these two records. No. In the next section we're going toe create the select statements and also the truncate statements so that before the day dies inserted the table data is actually clear. Okay, so once it s so that it doesn't load the duplicate data. Thank you. 32. Implement Framework -- Finalization: Hi. So in this section, we're going toe do a little bit off clearing off the tables before they're getting loaded. And as for less a couple off select statements toe, actually fetch the sovereign territory and service lookups. Okay, so let's do that now. Okay, So first thing that we need to do is clear the table before it is getting inserted. Right? So let's do that. So let's have more functions defined here wide. Okay, Clear tables will have a single function for that. Okay. And dollar corn as a call to I don't know, this dark get connection. Okay. And the second thing is dollar corn door open. A connection. Okay, then. Dollar corn dog Close the connection. Okay, in between, we're going to write. Ask your dollar. Okay. Clear underscore. So close on the score. SQL Okay, so this is going to be the lead from serve us. Okay, That acute that this is the simple SQL delete from service. That's it. Okay, then what do we do? SQL come earned okay is equal toe dollar corn doored create. Come and right and dollar SQL. Come on, door. Come on. Next is a cold Oh, dollar clear, rescuer. Okay. And dollar esque. UAL command dot Execute Not quieting. Okay, So, similar thing we're going to create for assessment. Copy. Okay, insert off. So clear. So what we do here? Don't know. Clear Lookups. You look up. Sorry. Okay, you be underscored. SQL okay. Is it goto delete from so this underscored Look. Right, So that's what I say. I know that it's the table, so let us just conform. The table is correct, my lord. Okay, so that was underscored. Look, so that disconnect. So we have. And finally, we have close to action. Okay, so we call this clear table in the initialize. Okay, So how do we call this dollar This Start. Clear. That's it. Okay, Now, let's see if this works. We clear? I had so I d be okay on initialize Davis. Okay, so there is an error server underscored. Look up is north existing trade, So there should be actually service underscored looking right. So this is coming at 80 line 18 Line 80. You shouldn't see service. Okay, lets see. No Force Lord and I initialized. Okay, so now let us see the number of entries that we have select star from servers. So we have only three service has expected. And select star from lookups. So we have only toe We have another mystic Yo, you can see the enabled. It's not populated. Okay, we'll fix start as well. But first, let's see if we can. If we executed multiple times the initialized tables doesn't have any impact. Just let us see that So But it's still have Yes, it still has only trees of us. Okay? And it has only two service lookups so is enabled. Working fine for this salty discovery. Enable is set to one. Okay, which is true. But here service. Look up. We have not set it properly. So we have to fix Dr C Just got any less enable is not here And we have docked in the Jason as well. If you see in, the conflict is in Ah, so we don't have that particular variable years So we only have more deal function and description. That is why we have not pulled it. More deal function description were actually can set the valley off anybody less. Okay, so let's put that as well. Your and a bird colon. True right and here s fun. Need to put a coma here and then And a bird called in. True. Right now in this over db where are you going to do here? You have toe pick up that ballot. Mitterrand Sore dollar. Any bolt is 1/4 dollar. You look up dark Anybody, right? And in the SQL, we are going to put here so and a bird, right and coma and percent and anybody. Okay. And we said this parliamentary as well. So basically you're adding the value off anybody here a neighborhood and right? No, let us see. Effort No. Clear the console, reimport my things and then initialize the table. Okay, let's see if I look at Look up your enabled except one, which is true on service also, it's fine. Okay, Enable is coming for us and discovery status. We have not populated it and discovered it needed also, which is that I am not okay. We're going to populated at a later point in time when we are actually executing those executing the mornings. Okay, So what else do we have now? The next step is we need to select the later. Okay, So we need to select service. And so basically, we are going to call this fits of us and French service lookups. Okay, so let us right. Those two here. Okay, So we weren't We're it in here. Very toon and Eddie. Okay? And we see Fitch so us Okay. And okay, so I don't know so of us, does it Quito percent. Okay, don't dollar. So OK, so know what do we do? Corn physical toe. Okay, Dollar this dot Get connection. So we get the connection and we opened the connection. Right? Corn open. Right. And another thing is dollar corn dot disconnection. Within this, we're going to write off select statement, right dollar SQL Just say the auto rescue because there's only a school in dysfunction. OK, select. So coma I'd be okay. Thrown so of us. Fair. Okay, where u S c underscore and a bird? It's a quick. Okay, So this is how we are actually going toe? Uh, right. Quiet e. Okay, now, organs to be do same thing again, so dollar SQL command as equal to dollar corn dog Create come and right and then dollar SQL come and door come and text is equal to dollar SQL. Okay? No, because they're secure that next we use a new object called adapter. We create a new object. Okay, Is equal to its a new object. Okay, new object, off type system data dart, sq light dot s que light. And, uh, so sq light data. Okay. And then what do we specify here? Dollar SQL Command. Okay. And no one stayed after it's done. So dollar data is a core do new hyphen. Okay, you object system dark later dot He does it. Okay, so we created it, does it? And we filled the street. Basically. So you think that using the adapter, Okay? Don't know. Don't full ok. And within this film, you'll specify donor data. I don't know. So once you have filled the dollar leader, you can actually get the count, and we can actually close the connection here. Okay? We don't need the collection anymore on your I don't know, calm is a quarto. Don't know. Data. Good dog tables. Okay, that's only one table here. Okay? Don't rules. Don't. Okay, So that is how you goingto get the comb find. So now what do we do for dollar? I is equal to zero. Okay, I less than don't count. Count. Okay. And dollar, I plus plus Black. Okay. No. What do we do? Ah, we get the rose. Okay, so we copy this, okay? And put it here. Rolls off. I okay. And zero. So what does that you don't want That is the server. Okay? Said that IHS dollar hosting is equipped to this. Okay, so dollar horse name. It's a call to table start. Rose start. There should be dollar, right? That's what it was. Okay. And similarly, copy this old stuff for justice. So the second oneness, what do you do? Your creator So that object don't know. So we're is equal to and percent on. We see Morse name as a Quito. Okay. Dollar horse name, I be So we just checked out. Okay, Right. And then so dollar, so us plus is equal to dollar. So basically a pending this particular singing to the area. So let us just check ones. So this will be server only. It will not be horse name, so we need to change this stuff, so no, it was fine. So you are happening. All these things and you're retiring this back to. Okay. Now, what is the problem with the stolen account? Save all you anti. So I left then. Okay, so let's see the video contest assigned but never used. But this are we not using this, Joe count. Okay, so we used to throw count here. Okay, that's really surprising. So any Oh, he should be daughter. I said that's OK. It should be. So if it is yellow on, we can't use this, okay? We'll have to use hyphen. No, it's so if you get yellow here, it means it has never been used. Okay, so just make sure that all the variables you have defined and declared in your classes are methods are only used. Otherwise you're making some spelling mistake. Okay? Now the same thing works out for your fetch. Look up. Okay, so I copy this whole method, so dump you okay? And then what? I do. I say that's lookups. Okay. So what do we need here? More? Do right on a function from look up. Okay. There. Enable this one. Okay. No, we created an object. We got this. We got this. Now, what is this? More dual function and also the description Okay. Description. So 01 and to another variable. Right. So what we do for this? This will be more Do okay, and second will be function. Okay, it'll be description. Okay. And this will be Look up. Okay. And this will be Look up lookups, right Lookups. Okay. And another very important thing is this will be more your okay and function. Okay. And description is a dollar best option. So everything is fine now and then Finally we are going toe, but look ups here. Okay, so this is working. No, no. What we're going to do, we are going toe. So oneness fit servers and others fetch lookups. We need to change this signature. Okay, it would be yes. Service lookups weaken See? Okay Fitch Service pumps. Let's call these functions here. Remove or damage data. We don't need our dominator anymore, right? Well, removal this thing and what we do here and this also going to remove this no longer going to use this, right? And then we're going to initialize STB, okay? And we're going to return dollar STB dot s d B door. Fitch, serve us right? Freight. So us. And here also so I'm going to say dollar STB dot Fitch service lookouts finish. So now we have the complete back and done a few changes we are going to do as we had. But let us first try this out. Is it working? Yes, that is no issue. And now, if I called fetch service. So I am able to get the data from my database. It is no longer getting from my listing. Dummy. Data fetch service Look ups, right. First service lookups is also are returning the data for me. So it is only returning that enable. Okay, now in the next video, what we're going to do is we're going to actually run that. In fact, we can run it right now. It has already done. All the things are ready. So all we need to do now ISS clear this and get typhon job. We'll remove these jobs drivel. Pyfrom job. Just make it more clear for us. Okay, Clear. Okay, Now what do we do? We go back toe, we execute discord. That's sick. That's it. No. Get hyphen job. You can see they're still running. Okay. And, uh, so basically, let us even They're getting completed. see, most of the jobs are completed. Completed this one that is still running and that's it Completed. All the jobs are completed. So basically there are three discoveries. And let us get the job names. Encino, That's acquittal. Get a job. Okay, Dollar jobs, zero door. Seattle don't name. So this is discovery on the service. You're right. So we had three servers and on each off these trees of us, there are two discoveries that are running so totally we have six circuit. 123456 So which is particular? Perfectly fine what you can do. ISS job start. So this is going to give the complete Longs. So calling Oracle Discovery on DBS Yes. Okay, calling I s discovery also on BB A, C s and discovery on Absa one naps over to an article Discovery on one. So it is running really as expected. And so in the next section what we're going to do is we're going toe right, riel, more deals and we will start implementing the complete framework for our set up. OK, so off a set up or basically have DBS yes, application So on. Applications over to and with SCP installed on all the servers. Off course. We can install anything on this. We can discard any kind of applications. So just for the Sekoff, some complexity. So we're going to show you I'm going to show you home. This is going to work for this landscape. Thank you. 33. Discovery -- Setup: height Now that we have the complete framework Ready the database. Ready that database tables already. Now we are ready to start implementing the discovering face models. OK, so we're going toe target s a p applications because they are the major enterprise applications which are there in almost every big company. So we're going to start with discovering SMP services. Okay. And what does these models first of all, Wardo, these more deals do they executive certain lookups so basically, they execute our discovery models, okay? And they update the landscape in fort the database. That means we need to create certain tables which are more real specific. Okay, you fit is ASAP. Then we are going toe. Create certain tables in our SQL database which are specific to the SMP systems are recipe applications or we call it a subpoena landscape. OK, so if it is article, you could have different set of tables. Discovery Devens for arc. Okay, So before we go for actually implementing the SNP Discovery scripts, let us do one thing. Let us first create additional methods in our server DB model. OK, which takes care off, actually connecting to the reader base wherein you can give a generic table creation SQL statement. Okay, one on also the table update SQL statements. So basically, what we're saying is our model will simply past the table creation SQL and toe the server DB and the seventies would create the table for us. Okay. And also, how it is going to create given a school to update the table that that particular table or tables. Okay, so let us do that. Letters jump into the court. Okay, so I go back to partial on and let us see. What do we need to do? We need to go to Sever Devi, okay? And we create to tape two functions, okay? And what are those functions? So oneness, Boyd. Okay. And create people looking, create more deal table. Okay. And then where does it take? It takes a string. Barry Madore, which is nothing but create table sq. Okay. And so it's lost. This something. You need to close this as well. Okay. And what does it do? It's very simple. So we need to remove this. Okay, No more it us. So this is perfectly all right now what we do is first we create a court connection Object . So dollar this start get connection. Okay, Next, we opened the connection. Okay. And finally, what we do? We close the connection as well. Okay, in between will have to write our statement. So what is the statement? So dollar sq command. Is it cool to dollar corn dog? Create common. Okay. And what else do we have? We need to set the SQL text for this command text. Right. Tall SQL cover and door come out next. So is it cool to Dolo? Create David Less girl right now. Once we have said this, the final part is dollar a school dog. Make this. Oh, okay. Executive known quietly. Okay, that's it. And we close. Okay, Now, one thing you must have noticed. We are not following proper conventions for these functions. And second were narc it implementing the we have not implemented the try catch. So these two things were going to do in the final stages. Okay, once over complete framework and everything is ready, then we're going to re factor are cord on. Try catch blocks wherever necessary. And so Okay, just toe clean. Apollo cold. So Ok, now we know how to create eso if we call this particular. So create table memorial table. So we create a function as well for this. Okay? And make a call so you see function create more to table doesn't take any perimeters. Oh, yes, it does. Take a perimeter that this string and the low create table SQL Okay. And let's copy this and dollar STB door. Okay, Actually, table Okay. Dollar great devil Sq. So no whatever. What about the next one? The next one would be toe, actually. So now that we have created this in certainly dyinto this particular creator table. Okay, this is also going to be We're going to follow the same this thing. Okay, Insert data into more do table, OK? And I'll keep it very simple. It will also take insert They die school. Okay, on the floor brackets. Okay. And just copy this old stuff. It's just a seam. You just need toe. Just clean it up a little bit. They should be small. L okay. There should be small l and this will be insert data, sq. Okay, Now, again, we're going to write a function for this. So so make it quite simple to simplify this. What we say function okay And string, dollar insert They die Obscure. Okay. And dollar STV is equal toe So over db Poland Colon were calling the constructor right? And then dollar STV don't insert into this and dollar insert Dada esque. So now we are ready to actually implement the so more OK for discovering SMP. So let's just create that Mordor in this course And in the next video in this video and in the next video, we're going toe actually implemented. So what do we call this Discover recipe? Clear. And we're going to create a file also with the same name. Don't be S m one term of that. OK, it should be assembled. Okay, Now, in the next video, we are actually going toe implement the Discover recipe 34. Discovery -- Understand how to discover SAP components: Hi. Before going into the development off the S A P Discovery Morning. What we're going to do is understand whatever recipe systems are, What are the systems that we are actually going toe monitor. Okay, so let's open the north bad, okay? And let me describe, or though. So these are our three servers that we're actually going to monitor. Okay. One is D B A S E s. The next one is absolute one and absolute. Okay, So other application has three service. So in the first several, we have and database. Okay, which is called back Stevie. Okay. This is an exit piece database. Okay. Andi, you have central services. Okay, so this central services basically take it off locks. Okay. Applications application box to the database. Okay. And then you have one applications over. Okay, Now, this application server has work process. Okay? Want to and whoa. Process. So and then. Okay. Now what happens? Your requests actually come to this application will process one off these work process. Okay. From the central services. Okay. The central services or dispatcher, which is going to dispatch it in the application, So Okay, the application server dispatcher is going to forward it to one after process. All the user requests when I'm talking about this now, this was work process basically downloads the leader and the AB ab court from your database and processes the user's request. And it goes to the next processing and goes to then exposing. That is how it is balanced. Took a load. And so you can have n number off users going to this application. So no, Hugh, you have on the absolute one. You have another application fication sober. You can save one. Okay. And this is applications of or let us zero. Okay. And you have applications, so Okay. No. So what happens? So this is a basically three dear architecture. Okay, you have a database and you have an application layer. Okay, which is nothing but application Central services as the last application server and then the user interface. OK, Which we are not showing here. Basically, what happens? Users basically what they do de send requests to each of these applications of us. Okay. And these applications servers basically process toffs requests. Okay. By loading data and the relevant programmes into the world process, they process the data and Garrett on the data and screens back to the user. So there there are different kinds off programs like transactions of Apple Weapon pro. Okay, X attracted a lot of other problems. We don't need to really go into it for administering the streets of us, but this is what we're actually trying toe. Manage. OK, so first part, they're trying to discover this. Okay, Now let's log into one off this over, okay? And let me do that. So I do a remote desktop. Okay, so the more district connection on I connect db SCS Silva. Okay. And give the password for that. So it iss longing corn now into my administrator account. Okay, so that was it was locked in the acid isa locked in. You can see there is a S a P MMC that has opened. Okay, okay. Elated. Refresh. Since I locked in, it is trying to refresh its sense. Yes, it has refreshed now, so you can see there. Said database cadet D B. Okay, this is this Blue surrender is representing a database. Okay. And then you have es es the sister application server. Okay, This is actually going toe. Take care off all your application locks. Okay, That means or table locks. Each user cannot access the same role on the same job at the same time and update the data . Right? So that kind of application locks it is going to take it off. And this is one application so that we have. And if you see the book process table, this is what it is called. Okay, these are the about processes that they have. So we have 15 processes. Okay? Different types of a process. We have been our dialogue process. We have background work process. Except so So this is the basic architecture. OK? Similarly, we have on the absolute well one, we have one more application server which is running, which has again 15 process, perhaps over two. We have 15 process. Okay? No, this sister. Now, if you'll see in for a typical client, you'll have a large number of such systems. Okay, One is you're going tohave production systems, development, quality implementation, different landscapes. Okay. On each of these landscapes, you will have multiple such servers. Okay? And here we don't have any higher availability set up. Otherwise you would have a high availability as well. That means your your services, the central services will be running on high, available more. That means it will have to hosts one actor, one passive. If the active one dies for any reason gets restarted, or any hardware issues, it goes into the passive more the passive nor becomes act similarly. Your database as well. So in a high availability, more What is going to happen? You'll have to databases one active, one passive and data replicating between these Those two service. But we're are actually not looking at such complex architectures that really complex production architectures. We're looking at a simple system. Okay? And imagine if you have insect systems with 3 to 4 horse. That means you would have to manage 40 servers. OK, your first thing you have to do is discover all those four piece of us. What are the services that are stored on them? Okay. And then you manage those service automatically. Okay? Now, that is what we're going to do in our powershell script. That is, we're going to discover this particular So was what is running on the service. We are going to discover processes. Okay? No. Before doing that first thing is, let's look at the interfaces that this particular servers actually exposed. Okay, So what I'm going to do is I'm going to download a client called Soapy, so the SoBe u I is getting down ordered, so as Souness. Okay, later download. Tell them what we're going to do is all these components, right? All these components that we were talking about leaving the database, the central services competent. Okay. And the applications there was the three application servers. They all exposed certain web services. Okay. And we're going to look at those web services and along with these, okay, along with these services. Okay, Davis, one more service that is actually running, which is called a sippy host. Control. Okay, let me show you that as well. This also host control and host control. Exact. Okay. Now, these two in peel 00 and build 01 are basically leader services when those services and also the services that are shown in your M. M's. Okay. And build one being the central services. Okay. And then peel zero being one application. So similarly on these also, you will have nbl underscore zero, and then peel underscore. Zero. Okay, ASAP underscoring, underscoring. Is it on each of the service? Okay, so, no, we were talking about horse control, right? So let's go back to that. So this recipe host control is one off the process whose job is to help you detect or discover waters running on What s a B? Compliments are running on this on each of the horse. So each off the three horse, we're going to have this except, of course, control service preinstalled along with the along with every installation off recipe. Okay, so how do you access this host control? So what, you can do this? You can call Ah B B A s. Yes. This is one of the host colon. Okay. It's always running on before 11 through eight. Okay. And s a B host host control. OK, question mark question. Mark Lewis. So you can see that this is a web service. So this host control actually exposes a Web servers, and you can call the tedious methods on this website. It's okay. Like, for example, if I see list instance list instances, if I search for it. You this particle, A mental web service method is actually going toe loose. The instances that are installed on this particular host. Okay. And you can also call less data basis. Okay, The list data basis mentored is actually going to list. What other databases that are installed. What type of databases is that Max TB is that article isn't harder exit. All that information is going to provide. Okay, this is the first level off discovered. No. You want to understand Waters? No list incentives, for example. Okay, So, list instead, office would basically give you the list off instances that are really and the type off instances. If you want to understand, then you can easily find out from another third Web service, which is can be, which is exposed. Why each off the instances? Individual instances. So what is an instance? If you see in your MMC, let's go back to our MMC. So says the MMC that we're talking about the management console each off. These are instances. Okay? And these are the numbers. 000 is the instance number. It's a two digit number. 00 98 97. In fact, 98 in light. By not reserved instances, and it is a the 1999 which is the host Control scored a reserved instance. Number. Okay, so each off these instances intern exposer Web servers. Okay. And now hardly find the instant members. You can order natively. Find out the instant numbers from the service name. So if you actually see s a p and peel 00 So in San 00 and as big ASAP and build 01 This is instance one. Okay, so this is how we can understand. Now we want toe. Understand? What are these services exposing? Okay, So what we do is we installed soapy? Why? So I went into the soapy WEYDERT og and downloaded the open source version off the Sochi. Why? We really don't need the paid Washington, okay? And we installed this particular soapy why? And we make calls to this service your web service, and see what kind of data it is going to return to us. Okay, Now, the soapy why is successfully in start. So what we do, we unchecked us, and we run the superior by clicking on the finish bottom. So this is going to expose your so pure launcher so pure. Let's wait for the so the way to get launched. So we have launched a soapy Why you can click on this tile against Skip. Okay, we create a project first, So we'll right click on this particular server and we say created empty project. Okay. Was this okay? We have the project here. Now we have as I mentioned before, we have two types off interfaces. So first, it's the host control. So let's on the host control first. Okay, so what we do, right? Click W s deal So basically control we So we have added that abuse steal from the bottle, okay. And I click. OK, so you can see that I've just year list getting loaded and you got loads off methods that you can call. Okay, Makes got me calls to So for the d B A s. Yes. Okay, so let's call list databases, for example. So I double click on the request, OK? And I dont pass any arguments as these are all optional looking. So I delete all the optional arguments in this e en discord argument. Probably delete. Okay? And I call this so it says unauthorized. Okay, So you'll have to provide your authorizations. So one our tradition that you can provide is so you click your new authorization, Select diapers Basic click. OK. And you give the administrator okay, or you can use a safety 80 and Monceau. Okay, You can provide your recipe alien possible. So Okay, I see Administrator, I have the password. Okay? And what I do know, I execute. So this method is actually getting executed. Now, let's see for tactfully returns. Any databases running on D. B. A s E s okay? Yes, We got things. Yes, yes. So now you see what is there? The there is one database item. Okay, There is only one item. And in this item, what do we have? It is the database. Instance. Name is and Bill. Whose name is this? The databases Wim endures and are 88 which is nothing but Max TV. Okay, what does the database version? Okay, what is the database name? So we understood it. There is a database that it's running. You can also get the competent if you wish. Okay, you can get what are the components that are running within this particular religious? Okay, now let's call list instances similarly. Okay, I never click on this. Okay? This is also I am not going. Do send any off these Pata, Meet us back to this over, Okay? And I kick execute again. I'm getting it is unauthorized. Okay, I go back and provide the authorization doing the installation off ASAP. Right in the service. A society. So what? This discord The server name and peel, for example, this s a P and P. L is nothing but server idly asylum. Okay, the server really can also be seen from your management console. Okay. So you can see this is A and B l. Okay, eat service or each cluster application cluster has its own unique idea in the whole laughter and dry environment. Again. And that application A Really it's a three letter alphanumeric are resting starting from and Robert. Okay, so it is, and yeah. Okay. So that does your aside. Okay. Now, during the installation, you will also get a user called and be a society idiom that this and beer, which has authorization to call that particular service. Okay, host control service or alternatively, you can also provide a You deserve it. Administrator access. Okay, I'm just using the administrator for our purpose. But actually you would have. You will have to use the n b A lady in. So now here. You see what has happened? It has listed out two instances. Okay, 00 and 01 Right. If you see the services in here, see this? These are the two service services running on TBS es host. Okay, this is the host forward by the intense number host followed by the instance number. So similarly, if you see in the services start embassy, you will see those SMP services. Okay, so that is a S A p and bill 00 and 01 Okay, Now you can get the patch. You can get devotion in full. That is what does the Colonel patch report? Bachelor villages there, OK, And borders the instance. Number off these patches said now what happened now? Our bushel would have toe first. Detect Your database is okay. And it should detect your instances that are running okay. And one type off t or this is what are these type off instances? Ok, Is it a central services? Instance, Is it on application server instance. Okay, there's an application about or application Java and various other things that you can actually find out. How do you find out, Dad Using the second. Ah, which one? The second Web service, which is exposed by the instance. Okay, so that IHS d B A s e s. Okay, Colon 500 Okay, that is instance number 00 and 13. Port question mark. Just Okay, So this ISS the Pheap service that is exposed by 00 instance. OK, similarly 01 instance would be 50113 instance. Okay, which is also going to expose another instance. Okay, now lettuce examined these two instance, these two web services. Okay, So how do we do that? We again go back to your Why? You're right. Click. Ok, W stu on. I put this 50013 Okay, click. Ok. Okay. No. Here you can call. Get process. Missed. Okay. In the get process list, it does not take any perimeters. Who can see? I think optional I go back. I give the authorization to this. Okay, Basic authorization again. Get the administrative credentials. So basically, you can give NP lady, um credential here, but I'm giving that mystery credentials. Okay, executing this so you can see what are the processes that are running so you can see this mess? It's over and in queue server. So messages ever in in case of a run on the central services. Okay, similarly, that is 01 And if you try to execute five 0013 instead off 50113 Okay, you will see it is running this place. Work. I g s D w, Okay. And GW rd. You can actually see these processes in your MMC. Okay, 50 when we called the sentence of cystitis. This one which is instance 01 Okay. Your process had message, sir. And thank you. So over. Right. So you can go back here and see if I put 50113 And if I execute, you've got messy. It's over, monsieur. Discourse over and in Kosovo. Okay. And civilly, if I go for 50013 50013 and execute so you can see this place work, okay? And this so you can see here if you go for the next application. So the applications for instance you have displaced will work. I g s W r d Do you really I g I see, man, So all those process will be able to see you. So that means you can easily recognize whether it is an application, sobo. But there it is, a central services competent. Okay, Now you got a clear idea as to how you need to discover your services. Okay? Basically, from the inventory, you make a call to the host control Web service. That is the first smp horse country web service called the list Instances. You call this data basis, OK? And to find out the database type and you find out from the instances you get the instance idee and based on the instant side, you create this port number, which is five instance, number and 13. So for 2010203 All that instance numbers which are getting from list instances from the host control you call the s Epic control website. Okay. And in the SNP control Web service, you'll get to know what other processes and depending on the processes, you can classify that it is a job application server. It's an about application server. If it is a Bob G anything if it is a Hana, any kind of things. So that is almost all the sir competence. That s a p provides all the flavors of conference can be detected using these two interfaces The host control as the less though a sippy country. Okay, the host control and a separate culture You need to remember. So in the next video, we call these web services and we detect the competence in our infrastructure that is, in the three servers that we have. That is BB. Let us go back toe eso that ihsaa BBs? Yes, absolutely one and absolute. Right. So db es es. We had central services application, server database and absolute were one and absolute. Do we have applications? Us. Okay. See you in the next video. Thank you. 35. Discovery -- Start the implementation using test data: high Now that we understood how to access the management a p a for detecting or discovering the services. That s a P services on all the three horse. Now let us go straight into the implementation, right? No, let's define it class. So we define everything in a class here. Discover it's a p. Okay, on, find this class now in this glass. What is the water? The parliament is that it's going to take. So there is going to be a host name. Okay, Don't know. Host name. Okay. And I would define a constructor discovered recipe. Okay, on I input dollar host name. Okay, so and this will be daughter distort its name is a call to follow boasteam we initialized. Are this Cody? Okay, but the horse name Now, the second thing would be you want to direct your instances from the SNP control Web service. Right? So how do we do that, Eddie? Okay. And addict instances, okay. And let us just initialize instances. Donor instances se kowtow it iss daddy. Okay. And return incidences, which is also going to be starting with five now. What do we do? No, he's right. The we first constructed. You are looking because we are going to make a Web service called Right. So we get on so many groups of ex cons using portion. So that's the beauty of it. Now let us say first we get the credentials. Okay? Okay. Be a scripts. Goto, get Typhon credential to get hyphen prevention Commander, it is going to throw and dialogue box. Okay, which is actually going to contain where you can actually enter your use radiant password. Okay for making according to that web service. Now, second part that we're going to do this. You are okay on a make Http. Okay. On. Plus, don't just don't host me, okay? This is the whole steam plus cold in 1128 Okay, on slash as they be was control slash Question, Mark Wst. This is how you're going to call them Host Control. Ok, that's right. It as well just to make sure we are getting it correctly. Dollar you are I good quality one, Not a problem. OK then. No, we extract user okay? Yes. The name is nothing particularly be Yes. Okay. Don't. Okay, it's that simple. Okay, get retentions. You can get the user name and to get the password. What do you do? Do dollar. Yes, red dot Get network. Okay, Get network credentials. Okay dot Possible. Okay. And don't so using trim. Because it is. I've seen notice started since the white space. This chick that that's what. Okay, then let's right. Difficult entrance. Will not trying the pretensions off course. We're not supposed to show you the credentials, right? I'm not sure. Now we called making cups of this car. Okay, first grade. Epoxy object. Okay, proxy is equal to new hyphen. Web service proxy. Okay. And hyphen, you are high is equal to daughter. You okay? And you've created the proxy and dollar poxy dot credentials. Okay, D a. This okay is equal to new hyphen object. Okay, on a system dart necked dart network pretensions, credential. And then you give don't he was a name calma. Okay, we're calling it credentials here just for testing. Okay, Please remember that. Because it is going to open up a dialogue. Books? No, we can't do that in an automated skirt. Right? We're going to store the password. Dates of credential dictates in a database, and we would pull that from these, okay? No. The simplest final part. In fact, s dollars. Instances. Okay, dollar proxy dot Okay. List instances and the boss known object. Because there's nothing that I need to send. Okay, I don't want the way. Do I would see Let us with this. You We don't need it so far away. But this year don't instances, okay? No. So for each Okay, instance I don't know, instances we open the bracket and close the bracket. Okay, Although society is it going to don't go instance tort and mess I d. I would show you how we're getting these things. So I've done it before, So I remember sicknesses. Amos, I d So what I'm doing? I am looping through this. And for each item that is each instance and meeting m s I d m host m system. Okay. I don't want version and four, we could use devotion. And for us and a lot of other data extracted from these websites is what we're just limiting. I'm just limiting to show you how it can be used. Okay, So famous I d and next oneness m whole straight and host. So door host M post put it as a call to I don't know, instant store dollar instance Dart and most okay. Next. This him system normal. Digital. So very useful. Okay, darling. And system number. Okay. Yes, it for two. Don't know. Instance dot And system number. Okay, now I create dog Instance is equal to a dictionary object, so use flour braces. Okay. On s i d is a co $2 Assaidi. Okay. And what is gonna use I n s d In our instance, number is 1/4 dollars. I m system number. Okay. And system number read. From here, it's like spelling mystic. Okay, am system number. I don't need the Holstein because I know the host, right? The horse name is anywhere coming from here. I don't want to send us. Okay, so this it's done. And now what? I do daughter instances. Plus is a dollar, for instance. That's it. No, you have basically created detect Instance. Okay. What do I do now? From what I could do ISS dollar PS crates. Okay, I have all the others have been cleared off right now. Let us create a function. Okay. Function. Okay, Onda, it is actually returning. It had it right heavy. Okay, List instances. Okay. It doesn't take any and put Okay, Andi, I see. Yes, a discovery. Okay, so I create a new object off this, okay? And I called us. Dollar s a big donor. Has BD okay and I have returned listing system. They don't depict it's dances. Okay, so that's it. So if you and see so function I don't need to return anything into law automatically. So distance dentist said this is just okay. Now, where did we declare? We declared it here. Right? So now let us first important this iPhone, right? And discover s a p sapi force. Great. So there is no error it on. So if I say what I can do, is there something wrong? Because I don't specify the full steam as well, right? Don't know. Otherwise it wouldn't No way to predict these instances from right. So what I'm going to do now again, call this okay? And then I don't know, host name, because it will do. Okay, D B A S C s Okay. This is my host name. Can I bring this to all the host name? So, people Yes, it is able to bring the whole dollar horse name where they could so know what do I do? I called list instances. Best instances. Donna Holsman. So it is asking me for the use of name. This is get credentials, right? And what is it possible doing? And you see invocation field Because it does not contain method, get network credentials. So we have a problem here Now letter C B s credentials. B s credentials. Doesn't seem to have get network credentials. So there is something no credentials. Okay, No pretensions. Okay to see you. Hear it again. Okay. Before, for this. Okay, then I tried from the beginning. Specified the holes. Name, right. I see list instances, ballstein. I give the you so and I get sport. So it just made a car door. Hatred every db es es one. Want to wade horse control Wst here to see if it tests. I returned Something it doesn't seem to have done. Okay, so why is that? So list instances has been called on the proxy on Do you want? Oh, right. Host Don't society okay? But if it's actually entering into the fourth group, so see here there is a Mr Grade instances has Bean. So I would just call this and don't rules. And it was extremely right Looping the instances again. We're sitting the instances toe blank carry. So that is the problem. Okay. And fix this. No, we'll clear it. Okay, before it's loaded in this time, rededicate coalesced into this legacy. All right, list administrator. Okay, give. Yes. So you can see it hasn't turned me a society host me and Sister Mighty and Washington for okay, Like tossed society as m Assaidi avoided it. Print it has printed this for me, but in the instances, it ISS returning a society and AM system number in system. Okay. Said that this instance instance and dawn. So this also the corner desk, my honesty. Okay. And we called us. Why? Because that is already an instance. Variable. You're a cane writing this, as instance, I'm writing this as instant apologies. So that is what a scalding the issue to spreading out all the data. I don't need the complete data. Right. So clear. Hi. Call this and I called witnessed instances and straight up. Welcome, moderate. 123 So I'm still getting the Bushmen for why am I getting the version and four I am supposed to insert into rolls. Right. So I'm going to return Draws. That's it. Said that was the mistake. Okay, Another mistake. In fact, let us see. So perfect. So no regard society and instance. Number. Now, what is the next step that we're going to do now that we understood? What is the instance? Number? Okay, we are going toe. Make another call to go. Most control recipe country notice they be hosting to the SNP Control Web service running. Going that specific board. What a support. Number five instance. Number for the 00 to be 00 I want to report. Or if the instance number 01 it would be 50113 Okay, So that is going to be are done in the next video. Siyuan today. Thank you. 36. Discovery -- Complete the backend modules: Hi. So, in the previous video, we have detected the instances using the host control. I say be host Control a P A. Now, we will use the as a beacon drone FBI. Okay, Toe, Understand? What does instances are? Whether they are central services over that they are applications of us. Okay, so let's dive into the cold. Like today. So what we are going to do? Let us see. We have returned the function detect instances, right? No, we will say detective recipe. Okay, so this is going to return void. Done. Anything, predict ASAP. Okay. Why does it return wide? Because finally is actually going to update the database table directly. Okay. We're not going to get anything from this buy from the school. No. First thing is dollar instances as the control donor there. Start detect instances straight. So we call in the air and predict instances. And we got just over nexus incenses. Sorry. So forage again. Instance in, I don't know, instances. Okay. We get each instance now. Each instance has scored aside an instance number, the one that we're interested in is instance right. Using the instance number. We need to get that board. OK, that is it for 200350013 If it is a little one, it will be 50113 Okay. So, lips, I can't leave the port. Okay? I NST Port is equal to first. This It's end. 50,000. Okay, Los end off. Okay. Dollar instance. Okay. Door instance number, which is nothing about this. Right. This instance number which is already there in two 100. So it is automatically going to get converted into from string toe 00 to 0. An