Step By Step Mastering PowerShell | Mukesh Ranjan | Skillshare

Step By Step Mastering PowerShell

Mukesh Ranjan, Learn Everything Step By Step

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
12 Lessons (3h 25m)
    • 1. Course Introduction

      3:42
    • 2. PowerShell Introduction

      19:15
    • 3. InLineComment Vs Block Comment

      1:58
    • 4. Variables In PowerShell

      17:20
    • 5. Arrays In PowerShell

      24:01
    • 6. Operators And Flow Control In PowerShell Part I

      24:56
    • 7. Operators And Flow Control In PowerShell Part II

      12:05
    • 8. PowerShell Loops

      19:46
    • 9. Functions In PowerShell

      19:25
    • 10. DotSourcing

      16:48
    • 11. PowerShell Module

      19:04
    • 12. PowerShell Remoting

      26:17

About This Class

In this course you Learn PowerShell tool in a Step By Step Manner. As you know that PowerShell is one of the most Powerful tool which can be used to automate any task from Active Directory Management / Microsoft Azure / Microsoft Office 365 / AWS. In this course I have covered all the basic to Advance concepts of PowerShell . The Topics are Listed Below

PART I : PowerShell Basics

----------------------------------------

A. PowerShell Introduction

  • What is Shell

  • What is PowerShell

  • Why you Need PowerShell

  • Ways to use PowerShell

  • PowerShell Exercises

  • PowerShell Cmdlets

  • PowerShell EcoSystem

B. Comments In PowerShell

  • How To Do Block Comment In PowerShell

  • How To Do InLine Comment In PowerShell

C. Variables In PowerShell

  • What Is Variables

  • How Variables Defined In PowerShell

  • Variable Types

  • Variable DataType

  • Variable Scope

  • PowerShell Variable Examples

D. Arrays In PowerShell

  • Arrays In PowerShell

  • Array List

  • Array Index

  • Multidimensional Arrays

  • Array Exercises

E. Operators And Flow Control In PowerShell

  • Arithmetic Operator

  • Operator Precedence

  • Comparison Operator

  • Logical Operators

  • Flow Controls

  • If Block

  • If Else Block

  • Switch

F. PowerShell Loops

  • What are Loops and Why Do I Need Them

  • Types Of Loops Supported By PowerShell

  • For Loop

  • ForEach Loop

  • ForEach-Object

  • While Loop

  • Do While

  • Do Until Loop

  • Pipeing - Implicity Looping

  • How to Code Loops

PART I I: PowerShell Advance

---------------------------------------------

G. Functions In PowerShell

  • Functions In PowerShell

  • What Are Functions?

  • Why to use Functions

  • Types Of Function In PowerShell

H. Dot Sourcing

  • Dot Sourcing Concepts

  • Reusability

  • Calling PowerShell Scripts Directly and Dot Sourcing

  • Common Parameter Support

  • Pros & Cons Of Dot Sourcing

I. PowerShell Module

  • What are Modules

  • Why Use Them?

  • Module Components

  • Module Types

  • Features of a Script Module

  • Demo Code

  • Keeping Your Functions in Separate Files

  • The Module Manifest

J. PowerShell Remoting

  • What is PowerShell Remoting

  • What Was Prior To PowerShell Remoting

  • Architecture Of PowerShell Remoting

  • Why you need it ?

  • Security Concerns

  • How Do We Enable WinRM

  • Invoke-Command

  • Remote Sessions

  • Demo Exercises

What you’ll learn

  • PowerShell Concepts with Incremental approach
  • How Function Works In PowerShell
  • How Function will be Converted To DotSourcing
  • How DotSourcing Code will be converted To PowerShell Module
  • PowerShell Remoting Concept With Active Directory Project

Are there any course requirements or prerequisites?

  • Computer with Internet Connection

Who this course is for:

  • Who Wants To Learn Programming From Scratch
  • Who Want to learn PowerShell
  • Who Want to Learn Incremental Programming

Transcripts

1. Course Introduction: Hello guys. Welcome to the course. A step by a strip mastering power shell. This is the first course in powers and cities. In this course, we are going to loan from basics off ourselves toe advance concept of partial. So let's jump into the topic. What are the topic we're going to cover in this course step by step. Mastering partial course is divided into two parts. In the first part, we're going to learn about ourselves basic and here we're going to learn about partial introduction. Were my attempt to explain you what ISS sell? What What is power Shell? Why we need partial partial feature. What are the things that is going to be connected? Once we understand that, then you will know about ways to use power shell. Then we will do some experiment with the power shell. We will learn about some command Let's and at last off this partial introduction, we will learn about ecosystem. Once you understand this, then we will understand the world comments in power shall how we can do commenting in Varsha. After that, we will learn about variables. What are the variables? Basics of variable variable types. We will learn about variable scopes and we will also work on some of the examples wants to understand variables. Then we will move further and we will look into the collection variables that is an ari in power shell where we're going to perform all these exercises along with the understanding or collection variables within partial. After that, we will learn about operators and flow controlling power shirt. So here we are having two parts in the part one. We're going to learn a voter automatic operator and operated presidents. We will also look into companies and operators running the part. We will look into logical part and the flow control and the flow control. We will look into E block Evils block and the switches statement. When we have good understanding about this, we will proceed further and we will look into powers and loops. So here we will learn about all the loops types, off loop, supported way, power shell. So all these loops we will discuss about and when in which scenario which loop you should use, we will discuss one way, one with an example. Once we understand the partial basics, we're in a good position to proceed further for partial at one in the parcel at once course , we will learn about functions and sparser where we will look into water function, way to use function, types of functions and power shall We will also look into how to write documentation for function. Then we will look into some of the commanders we will discuss about ease off use. Then we will look into how to apply validations on functions, and at last we will understand about what is the problem with partial function. And then we will look into dot sourcing and within the dart sourcing, we will learn about reusable code Ross and cons off guard sourcing. After learning door sourcing, we will proceed further and looking toe partial models in the partial model, we will learn about water more deals. Way to use the model components. What are the model components? Model types, types of model? We will learn about where we will look into a script model by nearly model manifest model and the dynamic morning. We will also look into features off a script model, want to loan this thing? Then we will proceed further with parcel reporting where we will own about what its partial promoting and what was happening prior to our self promoting. Then we will look into architectural partial promoting. Then we will understand that. Why do we need partial demoting? We will discuss about security concern. We will also look into How do we enable the wind arm? And we will understand all these concept record to you must be asking Who can take this course? This course is for everyone who want to learn power. Shell this course for non programmer as well. So what you are waiting for? Let's jump into the course and let's start the discussion. See you in the course till then buh bye Take care. 2. PowerShell Introduction: Hello, guys. Welcome to the station. So from this isn't onwards, we're going to a start. Our journey impartial. So let's look into the topics which we're going to cover in this session. So in this session we really start our journey with understanding the shell. What is Shell is then, Once we understand the shell, we will proceed further and looking toward his power shell. Why do we need power cell? What are the features off power cell. Then we will look into water. The things you can connect with power shell to automate them. Once you come to know about all those things, then we will proceed. For though I will introduce the ways by which you can use the power shell that is command line interface and integrated scripting environment. That is why you see, once we understand the ways to use power cell, we will proceed for the and gets our hands dirty with some of the commonly used commands. Let's so that you can get some idea about partial environment. By this time you're comfortable with parcel environment and you must be curious about what this parcel common. Let's is so we will discuss this in the next topic of decision, where we will discuss about what is Barschel. Come on, let's so in this aspect, we will discuss about some of the points to remember about partial. Come on, let's and at last we will discuss about parcel ecosystem. So there is prayer toe going into the detail of these topic. One thing I wanted to tell you regarding decision is that this session covers almost 60% of theory and 40% of practical. It is because that I want that you should learn about the power cell in a more logical manner so that it would be easy for you to proceed for the with the power shell course. And once you finish the score so you can apply these knowledge in a more logical manner. So let's start our discussion. So what this cell is so basically, shell is a command prompt to act, which you in took a month's. Historically, the tome shell describes the be off software that sits over an operating systems core functionality with the help of this piece of software that lets you access the functionality provided by the operating system to make you better understand I will open a command prompt from Windows operating system and demo you. So here, I hope in a Windows Command prompt, with the help of this command prompt, you can interact with the operating system. For example, if you write D a. R than it would list older directory, what are the directory of level within the within that location within users Ambridge and four Location. It listed all the directories and the files. So this is one of the example off shell. So with this demo, it has given us a question or say another topic to discuss. That is why do we need power Shell? If this cell is already every level that is our toward topic, we will discuss over what is Power cell next. But first, we will understand that why we need our shell If already Windows Command prompt is available, Soto Ones of your question I will start with an example so that you will better understand that why we need partial r c. What is the benefit off? Using power shell. So, guys, to make your point, why do we need power? Shell were in tow windows over 2012 Arto so suppose that if we want to add a user into this server, so what we need to do We need toe come toe the so go and search for users. And here we will get an upto creating user. So click on that too. Here you will get an option toe, add a user account and you need to fill this form to create an user. So gaze if it is a single user, we don't have any problem. But suppose if it is an enterprise sobo and we have more than thousands, so you can feel that it is very dirt Gary task to create thousands users. So with command prompt, it is not possible toe or toe meet such kind off a scenario where we need to do the repetitive tasks so that the reason Microsoft introduced Windows Power Shell which will help us to automate the repetitive task. This example is one off the example and this is just not limited toe user creation in for the course, we will look in tow various capabilities off power shell, but you will find very interesting and very powerful. So now moving for though so no, you have little idea about what its power shell. So in thirdly example, I have told you that command prompt is doesn't designed toe work with windows, So that means you can't automate any off the windows based administrative tasks. So to cope with this problem, Microsoft completely, really. Then everything with dotnet from book. Along with that, they have also introduced the Windows Power Shell, which is more powerful and more robust. So do the automation for Windows system. So now moving for the we will discuss it were creatures off power. Shell Partial has various features, but some of the major one is it supports traditional shell features like piping. It has the capability to access the hardware in the environment. As I already mentioned that it has, we're eating integration with DOT net and moreover, it has programming capability like it supports for variables, objects, collection areas and has tables. This we're going to see in the for the course. Along with that, we can also use power shelter where mr Add your resources tw it's resources and we can also administer office 3 65 So let's look into one of the interesting diagram of our show so here you will see that power shell has the capability to connect any off the environment. Like it's sequence over SharePoint active directory I areas has or extends over file system . This is not limited to this diagram. It has also capability to connect with eight of Louis as well and also with office 3 65 So you can imagine how powerful it is. So that means if you're learning one tool, you can easily manage any off the listed environments. So no, let's move further and we will look into how many ways we can use power shell. We can use power shell way to with the first way that command line interpreter which I will show you right now. And we will also work with partial with the help off i e. C. That is integrated scripting editor that I will show you as well. So let's look in tow that so this is the first glimpse off command line interpreter or sekem online interface off power shell. So to work with partial. Either you can use this command prompt or said this Seelye who? You can use it. We execute the command like two years so it will less told the directory This CLI is limited to execute the single line command. Let's commanders we will discuss further in this session were discovered endless So no You understand that Command line interface that isi alike to you must wondering Hold away, right? Or program within power shell. So in that scenario, here we will use the second way by which we can use the power shell That is the integrated descriptor D turtle. Let me open that. Integrate to the script editor to open the power shell I You see what you need to do. You need to come here and take on windows this windows keys and here you need toe Taipower shell. Then you will get an option. Power shell I you see? This one is for Windows Power shall command prompt that they see a lie. And if we will take on it, this will open windows, Barcella, you see, you can click right click and run as administrator so that it will provide the access as an administrator and you can execute the the script for execution of the script. I have ah detail topic which we will discuss further in the court. So this is that you see, if you want to rate any script, you can You just need to click on new. And here you can write this script, portable the script which you want toe right. So I will discuss that. What are the construct? Water? The Syntex water. The literal is which we will use to write the script in the further session off the course for the time being. Just understand that we will use a UC rate. This creep that is integrated script editor. The benefit off is that you can run the script or you can also run the command lit from here as well. For example, D a r you know, moving forward. Oh, no. We understand it. The board the ways how we can use power Shell. No, We will proceed further and we will play with power shell. So here we will do some exercises. Let's look into the exercises. First exercise. We will perform the object. There wasn't a partial which wasn't were using. We will also look into how to get the execution policy information. Then we will also look into how to set the execution policy. Then we will perform enabling a script. Then afterwards we were looking toe how to check the alias provider and exercise six We will discuss able more Dilts water models and we will also look into how to download those models. So to play with this exercise let's open windows powers, etc L A So you search for Windows Balsillie And here you will get an option. This one is the Windows Bar cell Cli So you need toe Great click on drone Azad mistreat So no, we're into Power Shell Seelye Common Lane Interpreter Or say command line interface. So here to know that which was and we had using what we need toe, We need to use the in wonderment Variable that is bs Woodson table Don't be s version No in tow. So here it is doing me. The media was in his four. So this is on William it issuing, which is using windows. So we're 2012. So let's second toe the host machine What is the wasn off host machine power shell. So this is my host machine power shell environment. So let's check what is the words? And it has yes words and table dot ps was on enter. So it is. Media was in his five and build is this one and revision it. One egg zero. Fine. So this is the way you can know about which partial worsen is running in. Your machines are moving for the two hour exercise to that is getting the execution policy . So let's do in our host machine windows partial only. So to do that you need to write get my execution, Paul. It's only think it is showing me remote signed toe here. I wanted to give you some information about execution policy details. So for the whenever you are executing any a script Oh, it will be really helpful to execute the partial a script for the time being. Just understand that execution policy is one of the mechanism by which you can manage script execution. But here you must be having a question that how many types off execution policy we have. So to know about this, you need to run, get execution policy, I fund list. So this will list all those policies which you can apply for here. So we have remorse signed. Let's look into the next exercise. So setting the execution policy to all the scripts. So let's look into that. How do we can set up or set the execution policy? So to do that, what we need to do we need to rate set execution policy. And here you need to write the type off quality that is unrestricted and then very funny. Scoop scoop. Here we need toe. Tell that current user and then we can specify force. No present room, you just throwing some memory. And it is telling that set execution policy when this parcel operated your execution policies successfully. But the sitting is a word and by policy, different. At a more specific a scoop. It is telling that they have already updated the execution policy. Let's look in tow that but policy, which is being defined. It doesn't allow, and it will revert back that restricted one where the typo ever confront this so it haven't updated. So this iturbe I'm getting because execution off the script policy is handled at domain level so that the reason it is not allowing me to change the policies at the user level, but I will showcase the same example in our William so that I can prove the point. My host machine is domain control that is part of the enterprise network. So let's jump into the William. So let's stay here. Great to run it with its remote signed Now my will run was said execution policy here. They said they didn't like my foot force. Also, see, you know, we will run it. So here earlier it was remote signed and we have changed it toe unrestricted and it allow us to do that. But in our host machine, if you go back and if you will go here, you will find that it is not allowing us to do the changes. Why? Because it was having the policy at the domain level where I don't have any control. Anyway, The intent is clear that how toe get answered the execution policy. So let's move further. Let's look into other exercise. So the next exercise in enabling it scripting, so it is pretty much a straight forward. So to run any off the script, you must have toe open the power cell Cielo, your power cell. I you see an administrator more so how to do that. That's looking toe this example. So to do that, you need to come through the window, the start button, and here you need to search for our shell and then right click and run as administrator. Then only it will allow us to run the scripting else it will not. Drums with exercise is all about running the power shell editor in Administrator more so let's move further. The fifth exercises checking daily has provided. One thing I wanted to tell you is that being a user, you don't feel you were working on on a new kind of environment, and you are learning new comments toe work with the power shell. Microsoft has provided commonly used commanders and Elia's so that you can feel comfortable while using it. But the actual common, which is running behind the scene, it's very different. So how do we come to know about what are those areas? Are Soto? Check those alien. It's exercise five will help us toe understand those areas. So let's jump into the windows Bar Cell Seeley for stable demo that so here, if we will, Ray d. A r. The d. A. Is not the actual command. It is an alias alias off get iPhone child item. So how do we check that with the falling common? So you need to, Right? Delia and alias Colon intern. So this listed all those command which is running as an alias. But behind the scene these are the common which is executing. For example, we have usedto the area. So here you will find that it is executing Get jail later. So instead of DEA er if you will right, get child later then it will do the same thing. So this way you come to know that. What are they eight years existing? So here you will get all the list off the alias on the commands which is the aliases assigned for You will come to know about this thing. So this is pretty much handy common. You should remember that if we want to check any alias so you can use this is a simple exercise. What it is ready? Important exercise. So no moving photo. Let's look into the Lexus is no exercise. Six. I will take this exercise in for the course Norton decision within the other station when I will introduce the models details so that it will make much sense on that time now proceeding for though we will look into the power shell command. Let's so what is Bar Cellcom? And let's so basically parcel commanders is a light weight common that is used in the Windows Barcella environment. As I already demonstrated some of the parcel Command Let's while performing the exercises in decision. But some of the point you must know about the command late that is commercialised is used to perform acing election. The name of the common link is based upon move and known, separated by your dash. For example, get hyphen execution policy set hype on execution policy. Get hype on Cherry late. Um, all these Come on, let's which we have used earlier. So this is based upon these in texts. So these points, you should remember whenever you were working with command, let's in the fertilization off this course. We will also looking toe hold to create custom command. Let's we will also look in tow the naming convention off these. Come on, let's using the same combination of both best known no moving photo. Let's look in tow Barschel ecosystem. So let's look into that so basically partially ecosystem can be designed in such a way that you can easily use to explore toe configure. To use the existing models along with your new custom models, you can use power shell to add mystery to reward machines designed. The jobs can easily work with providers, and one of the major benefit off partial ecosystem is that it is not emitted toe the existing systems and the models. You can design your own automation tool with the help of programming, which contends advance functions object orientation, object based piping. Along with that, it has also the capability toward tomato or administer the cloud environment. Whether it's a zur or whether it's state of Louis office 3 65 you can easily design the tools with help off power. Shell Partial has also the capability to maintain the state off the servers, whether it's on pretty wasteful war or whether it's a cloud with so you can easily manage those over in an automated fashion with the help of Desire district configuration, we will discuss further in the course, so on these notes, I'm wrapping up the session. I hope you injured the station seeing the next session till then, Bob, I take care 3. InLineComment Vs Block Comment: locates will come to another session in this session, we're going to look into how to rude comments in power shell. It is pretty much a straight forward topic. So basically, we can do commenting in power said with two with. 1st 1 is the online comment. Another one is the block comments who let's jump into the power cell editor and there we can see it in action. So we're in tow. The parcel editor. So to do the inland comment, what you need to do, you need to just put has and then you can write in line comment. So whatever the thing which you want toe But you can put it not one little England coming, you can put that took it. This school is third authored by okay, stringent, so you can write it like this. But the challenge with this kind off commenting is that every time you need to write hash in front off any off the message which you want, Oh, for example, date off off the score. You need to write it every time. Whenever you are introducing her new line, then you need to put hash over there, and this doesn't look nice, but it is really useful sometime. So you just remember that we do in line comment, Use hash, no moving toe. The block coming to do the blood comment. It is pretty much a straight forward porter bracket. Starting record the single break it and put here hash and same way you can close it. Hash. No, this is your block. Comment. Whatever you will write, you can write to it like this gold or say water name and whatever pollution ality details. So you should specify like this. Same way you can expect to fight the date off the school. You can. So no need to put the has every time. So this is the way you can do the commenting in power shell. So that's it gave. This is what I wanted to demonstrate to you in decision theory in the next lesson. Thank you. Take care 4. Variables In PowerShell: delegates. Welcome to another session in this session. We're going to look in tow variables in power shell. So let's look into the topic, which we're going to cover in this session. So the topic which we're going to cover in this station is the variable basics. Within that, we're going to discuss about what is variable, and we will also look into how to define a variable in power shell. Then we will look into variable types where we will discuss able closely type variable, and I strongly variable. Once we understand this, we will proceed further and we will learn this turned the variables scope. Along with that, we will also look into the power shell variable examples where we will get in tow detail. A vocalist variable said. Very well. Get variable print variable, clear, variable and they move very well. So all these topics which we're going to cover. So let's jump in tow the editor and where we will discuss it one by one. So we're into partial edited and here we will discuss the boat Partial variable. So what is power still variable or more nonspecific? What is variables? Basically a variable is a unit of memory in which values are restored, which regionally used to hold the values within a programming. A scoop. Now moving to the another question that is how variables defined in power shell defining a variable with involves Eliza very straightforward process. You just need to write the dollar sign on the name, whatever the name which you want to provide. So here you have defined a valuable called where, Why? It is very well because we have used dollars in power cell the interpreter take where as a variable, Because we have associated or dollars saying and how do we assigned the value toe this variable? So it is pretty much a straight forward. We can put the Nicole to sign and whatever the value which you will assign over here, for example, 10 then the type of this very is the type of the value which you were resigning toe this variable. For example. If you are executing this and to execute this what you need to do, you need to select this. You need to click on this button. No, it has printed the value tent. So we want to know about what is the type of this variable. So to do that, we need to use function corn get type and here we will get the name. And once we get the name, then we will come to know about the type of this. So run this one against elected and press effort or click on this button. So it is returning I NT 32 now again, I talked about whatever the value which you will assign. It will treat it as the same type of variable. So what it means for example now I am going to assign our history in value. So this variable it's string And now again I will run it, cope with this. We will run it selected and run the selection. So here it has returned strength. Now see your earlier when we executed this, it has returned us I NT 32 Now it is returning strength. So here you see that earlier we have a signed are in teacher value than the valuable has become intelligent. I nt 32 Then we have assigned a string than it become his drink. So this type of behavior is called loosely typed. If you remember initially, we have discussed about the valuable types where we're going to discuss about loosely take variable and the strongly type variable. So this behavior which I have showed, you know that is a loosely type valuable were power. Shell takes the decision off valuable types on the basis off the values what values were resigning. This type of flexibility is really good when we were writing a small program. But it will create problems if we're writing longer program and where we have more variables. In that scenario, there might be a chances we will generate some bugs within a program due to lose Lee type variables. So what is the solution for that? So the solution is no. I strongly type variable. So how do we define a strongly variable so that it will take only the interior variable? If we're defining an interior were able, then it will accept only the interior values. And if we're defining the string variable than it will accept on leader string variable. So let's jump in tow the scripting editor again, and we will see all this thing in action. So now to make this variable, aza I nt variable what we need to do we need to? Just to specify I nt within a square bracket And now if we will run it, it will return the 10th. But suppose if we want to use this variable to assign the string than see what will happen just selected and run it See it throws an edit. Why? Because we told that this variable will only accept the anti values And now we're tryingto assigned the string values so that the reason it is throwing the error. So this is called a strongly typed wherever. So this is what I wanted to show you. Now moving for the you can define these number off a strongly typed valuables. These number of data types suppose if we want to create an anti variable, you can use the area with the square bracket. Same with the bullion value, date and time Do I d has table is nothing but their dictionary. In the other programming language has table is referred as dictionary in the power shell. It is therefore does has stable where we have key value pair which we will discuss When we were going to discuss about the area and their dictionary variable, we have seen that I NT we have assigned a 90 in front off variable, so it is accepting on little I NT very intelligent variables. So these number of data types is being supported within the power shell. No moving for the let's discuss about the variable scoop. So what is variable the scope. So basically a scope refers to off the visibility or variables, which means which part off your program can see or they access this variable when program is executing the valuable. A scope in power cell can be either local or global by default of variable has a local a scope. A local variable can be available in a current function or the script, while a global variable is active throughout the current power cell session. So here the question is, how do we define a local variable and a global variable within power shirt? So to answer your question, let's jump into the scripting editor again. So to define a local ready. But you can simply use, however, were defining the variable. So, for example, where is called to so we can put a bad one and put any variable over here like 100 any value can put over here. So this is a local variable. We will discuss more on this when we were discussing the function in the coming session. So for a time being just considered that this is a local variable which is being defined within a function. So how do we define a global variable? So it is pretty much a straight forward. Suppose if we want to make the same variable as a global variable. So what we need to do we need to just put dollar Littlewood remove this one like this so this will consider it as a global variable. We will see much in action when we are going to discuss about functions. On that time, we will see all this thing in action where we will create a local variable on the global variable and we will access those variable while executing the function For a time being just considered that local variable, we can define it like this and global variable. We have to use a global keyword along with the variable name which is being separated by the coal. And you can assign the rally to that variable. No moving for, though now we will look into some of the examples like how to list variable how to set where said Variable we have already seen. But again we will discuss and how to get those variables how to print the variable, how we can clear the variable on how we can remove the variable. So let's again jump into the partial editor and we will do all this thing in action. So how do we list uglier variables which we have used? So it is pretty much a straight forward put ls and then right variable and a strict and selected. So it has listed all those variable which we have used if you remember that we have used that. So this we have used earlier while playing with it. So just I wanted to prove a point over here is that we have used rather earlier so that the reason it is listed out over here. So this is the way by which we can list out all those variables which we have used earlier now moving to another point that is set variables which we have already seen that to set a valuable what we need to do, you need to define a value, for example, where toe And here we can assign some value so 20 around it. So here you can run it under selection and the people looking toe the value I cannot get Run this ls variable so that I can prove the point that it's listing out all those variables. So run this. So we have. So we have a signed over here and that's the reason it is showing 20. So this is the way you can set the variable. So how do we can get the variable? So it is nothing but a listing. Those were able to the same way we air listing does. But there is another way by which we can get all those variables to get the valuable. It'd pretty much a straight forward you need to write get Graddy of and here you need to his beautifying our district. This pipe operator, I will discuss or actually looted. So here you can draw on it and then you can execute it. So this has listed all the variable as well. No moving photo. We will discuss about bring where they belong. Print the variability is pretty much a straight forward again. You need to write, write output and here you can specify which variable you want to print. We have created a variable toe and here you can run it again. So it has printed 20. No, this is about printing the values on the screen. But suppose that if we want toe print the value within the file So how do we do that? Now suppose that if we want to print the variable to write to within the file so it is pretty much a straight forward as well. So what we need to do, we need to grab and then we will use a pipe operator and here we will use our file and then we will provide the part where we want toe push it and here we can tell that the more dot txt and now we will run this selected click on this and let's look into that What it has injected within the mood or text. So here I have opened the demo door Txt victory have generated associate. It has printed the value off whereto within this file. So this is the way by which you can bring the values within the fight. No moving for the Okay. So till know, whatever I have showed you, that is are just our demo. But I want that something meaningful. So let's design something meaningful here. My requirement is to get all the processes with which is running within the system. I can list all those processes on bullshit in tow. CSB Fine. So let's work in tow that So this is my requirement. Get all process and four in towards He is referring. So how we can achieve this thing. So to implement this, what we need to do, we have to create a variable court rock. And then oh, here we will assign a command lit gold get process. And here we will use the pipe operator Brock. And then there is the pipe operator. We have to use a select and then we want to grab the name and the part on what we wanted to do. We wanted toe export CS. We export CIA's we and we wanted to export at the path the demo location and file which filed we wanted to export. We will create a new world. My all process processes dot C s three that's it. So now select both and executed. So it is a still executing. So it has listed down all the processes. Let's look into this file whether it is being generated or not. And if it is being generated, what it has given the information. So see here it has generated this file that is our my all processes dot CS we And here we told that we wanted to get one little name in the path so that the reason it has extracted the value for name and the part. So this is what I wanted to demonstrate over here. Now moving further. No, we have generated the CIA's we fight. Now we want to read the CIA's we fight and push it into a variable. So how do we can do that So toe So that we can be cleared a variable get C s V in four and we want to read this fight. My your process Nazi is we and a sign into the gets he is weaned for So how do we can do that? So there is command plate gold get content and then we will read this fight and then we will execute it. Run! This selection has executed. We need toe output. This use this variable over here on tried toe print this printed So see you. It has read all the values which is being given within the CIA's we filed. And it has pushed that information in tow. This variable So no moving for the no clear. Very well. How do we can clear the valuable? So it is pretty much a straight forward. So you can use another commonly called clear where the evil and then provide them. There is a perimeter core name And then over here you can specify the variable with your food. Want to clear it? So here we will be using get see every information And if we will run it selected and executed No, See that it has any values. If we will run it The cop it for two over here. Select this one. Execute See it all the values gone There is no value in tow them so no moving for them? No. We will look into how to remove the variable so we will remove the same variable. So how to do that again? We will use another commercial it there is called where they will remove variable and we will specify your name and we are going toe. Specify. Don't get CIA's rainfall selected and run. So the difference between clear, valuable and the remove very well it's that remove very will completely remove the variable from the memory but clear well, we will only removes the values which is being assigned within the variable. So this is what I wanted to demonstrate you in decision. No moving for them on. Let's look into the topics which we have discussed now in this session and then we will wrap it up. So in decision, we have discussed all these topics where we have discuss about variable basics variable times, variable scopes and we have also seen the partial variable examples where we have demonstrated all those things We have walked upon the example like list variable, set, variable, get variable. So all these examples which we have done in decision and I hope you are little comfortable with the poverty low. So here are my stopping the station. See you in the next session. Till then, buh bye. Take care 5. Arrays In PowerShell: Hello, Gates. Thanks for joining the session in decision. We're going to learn about Harry's in power shell, so let's look into the topics, the topics which we're going to discuss in decision. So in this session, we're going to learn about what is there is. Once we understand that, then we will look into aerialist how to create Arian Power Shell. We will also discuss about our index and once we're comfortable with these things, then we will look into multi dimensional Larry's where we will look into how to create a multi dimensional ari within power shell. Once we're comfortable with these topics, then we will perform some exercises where we can check that how to create a very variable and then how we can sort it. We can also look into how to add an element to ordinary. We will also check that how to find a relent and fortune. Then we will look into how to remove a night of romance. Then we will also look into how toe check value exist within an area or not under next the site six. We will also look into how to clear and Ari and at last but the North least. We will also look into how to print, adding Who lets to start our discussion with the diagram whenever we're creating an airy within any of the languages and Alec and be represented something like this into the memory where Eric induces represents the position off the elements and airy values can be represented with the number within, the box is now coming to the power cell. When we're creating an area, if you pass the value as comma separated value, then our secretary two dozen Eddie. So let's jump into the powers of the script predator and where we will see all this thing in action. So we're in tow. ARDS Eliska predators who suppose that if you want toe, create an airy so what you need to do, you need to use something like this one common toe from a tree. Then if he will run it here, we will get the type off the variable. Now, if we will select this and run it, then you will come to know the type off this variable. So let's run it. So here it has represented that objectivity. So this symbol is represented as a adding we don't want to print the name. So what we will do? We can again use something like don't get time and we will run it. We will select this one and run. So it has represented that system dot Ari. And the name of this is object, Eric. So this is what I discussing about. Whenever if we're passing the values with the comma separated, then power shall treat this as our Ari. Now we will use the same variable, and we will pass a single value. And, Vince, you select this world, and once you run it, we will also print the get type. We will select this one on drawn it, then here it is, the type off I nt 32. So this is the way by which you can create the loosely type of a variable impartial. So remove this one. No, we will look into how do we can create or strongly typed every variable, even though if we're passing a single value that is being treated as a Harry who let's look into this example toe create and wrongly type very variable what you need to do. You need to market as object with this bracket and the variable which you want to create, for example, out of one. And even though if you're passing a single valley without a comma separated value, you will see the type is become alley toe. Here, we need to get the type and once you will drown it, then you will find that it is a type of area C diaper, even though we're passing a single value. So this way we can ensure that the variable which were creating that is an added variable. Okay, now moving for the So here you will find that we are assigning a value over here. But I want to create an empty every variable in power shell and later point of time. I will use that empty every variable. We will do this as well. So let's look into that. How we will create an empty every variable, impartial. So to create an empty partial variable. What you need to do put on Ari. And here you need to use at the rate off single and with the parent. Now, if you will run this here, we will print the type as well printed travel. No, select this one and run a selection. So here you will find the type it system. Dr Addy. So this is the way by which you can create empty added within partial? No, moving further. One thing you notice that whenever we're creating an area than it is being created with, like an object. But I want to create an intermediary within power. Shit. So hard Awaken do that. So this is also very straightforward. Let's look into that. This example is not a specific for India. You can create it for any data type. But I'm taking here as in teacher type. So suppose that if I want to create an intermediary, so what we need to do, we need to start the bracket. And within that we can mention by NT 32 or I nt as well. And here the A symbol and we can specify the variable name like added three and whichever the value which we want to assign over here so we can pass it like this and we can check the type of this variable three, not get time. No, select this one and runners selection. So no. Here you will find that the type is I NT 32. If we will not specify, then what will happen by default it will create or interior type. And if you provide a comma separated over here, which I have already demonstrated that And if I will remove this one so default it will create an object today. Run it. Then you will find that it is showing me I ain t 30 toe. That is wrong. I will prove this point because I have already any sliced this variable and it is into the memory. So it is not creating it. So to prove my point, what I will do so I can create another valuable which is not being created earlier. And here I will assign one comma too. And again, we need to specify the get type. And now we will select this one. This will create as objectivity nor Di nt 32. So let's run it. See you. It has created object, Ari. And that is off the store. Maritime. So this is what I wanted to tell you. If you want to create an in teacher or any data type of Friday what you need to do, you need to specify it in front. Off that on de specify NT 32. Whichever data tape you goingto idiot as Inari and you should run it. I can run it again. With this, I will put over here and farce a single value. This time we will pass to on drawn it. See you it has created a i N T. 32 weather. So this is what I wanted toe show you over here. No moving for the let's discuss about that list and a list is another way by which you can create an added within power shell. It is really very useful whenever we have a requirement, where were frequently modifying for searching and away, along with adding and removing often item within an airy frequently. So in that scenario, it is really recommended to use a realist. So now the question over the it is how we can create an aerialist variable within power shell. So let's look into that how we will create an aerialist. It is also very a straightforward, just defined no variable over here at its six, and we need to use new object. Come on, let object on which is off type system dot collections, not at a list. So this is the way we can create an aerialist. So run this for here. You can select this one on. Drawn it for this valuable has been created. Not now. Let's check the type of this valuable. So to do that, you already know order at a six. The variable name under get type. Now we will select this one and run a selection. This button, we will click three year it has created at a list and which is off system dot object type. So no moving for, though, let's discuss about at index to discuss about at index I wanted to go to the same diagram which I have showed you at the start of decision. So this is the diagram which I have showed you in the ugly off the station where I already mentioned that adding indexes represented with the sequence seal value which is off 01234 in power shell. It is a start with zero, but in some off the programming language, it will start with one. So basically it is a representation off the element position within the memory. So if you want to access the individual element often. Ari, for example, you want to access the value 30. Then you should have toe excessive royal and induces. So let's look in tow. This example to suppose, if we have an area that is that a seven Onda, we have the element and 2030 for you, and I want to access the value. 13. So how do I can access it so we can access it with their in visits? So I need to provide the name off the variable, and then I need to specify 01 So the position off the dirty value is three. So we need to specify to why? Because it is a starting with zero. Now we can run this and see the output. Sorry, I haven't in a slide, so let's turn it together. So see you, we have access 30. So this is the way by which you can access the individual element. Often. Add a with the help off index. Let's move for the no. Let's discuss about multi dimensional Larry. You can imagine a multi dimensional areas, a terrible but columns and rows. Where is cell has its own index inside a partial environment. So let's do an example so that you can better understand it. So in this example, we're going to perform these three tusk. We will create a multi damaged melody in Portia, and then we will add the values within that multi dimensional laddie and we will print those values. So how to do that? So to create the multi dimensional Larry, what you need to do, you can start with the variable name, multi dimensional are variable. And I have already mentioned that to create an empty air that you can start with at the rate sign and then no, what we will do, we can run this so this will create an empty area running. Know what we will do? We will add the values toe this multi dimensional, adding to do that again, right, empty, Harry. And here I'm going to create toe the element like subjects. So here we need to specify and we can tell that here we can specify a subject one in the name of the subject is that's and then we can specify the value marks for that No same. We will repeat for other subjects of legal copy paste it here. We can specify subject to now we can change it here. We can see what's subject. And here you can own searching you or keep the same value. Okay, so now what we need to do we have toe print the values. So how we can do that So true that I'm going to use the loops Loops? I haven't discussed it. I will discuss in the further section, but I will use it here to print the values. So let's do it now. We will write, like for each. This is the loop and we will printed the value. So how we can do that? We need toe idea rate. These So how do we can do that? We need to write, um deep. And this this is that it And I warned the individual items from this variable. I want toe iterate one by one so I can assign it in one off the values. So here I cannot specify it like this. What I'm telling over here is that together Element one wife one into this variable and then printed. No, I'm telling that printed So here. So if you look in tow, this example forced. We have initialized it and then we have added the values toe this airy and now we're printing it. So select it and now run it. Then you will find that it has rented something like this. So basically to the tabular representation within the memory. But when we're using right output. So it is renting like this. Return straight off that if we will put right host, then if you will run it, then you would see that it is actually a tabular representation. Senior. So this is the subject one. So see, here we have the rules and the columns. So here we have created the multi dimensional area where we have added values as an airy. So if you closely looking toe this and you will find that first we have created an added. And within that again we're creating an ADDI which has these number off elements, and we're offending toe this Saturday. Then afterwards what we're doing, we're printing it. So this is the way you can create multi dimensional laddie within power shell. Now let's move further than let's look into the topic. Porter, The topic remaining now. So so far, we have already seen all this thing. So till now we have completed multi dimensional. Now we will perform all these exercises. So let's jump in tow The partial a liter and where we can perform all these exercises. But let's do the exercise one first What we will do, we will create a variable. And here exercise one on. We will assign some random variable over here like 23 level or 24 78. So I will create a variable. Now I will sort it toe. Do that. What you need to do. You can use the pipe here. We can specify sharp, so select it and we can also assign it into a variable court sorted so that we can print this as well sorted. So no, select this one and run it. So here it has started. No, I wanted toe short it in a descending. How the way can do that? It is also straightforward. What do you need to do? You need to a specifying over here descending no executed again. Then it gets sorted in descending order. So this is the way by which you can sort and ari no moving toe. Do another exercise that is add value to win a race. Who? Let's create an a report. So this time I'm taking an example of fruit area. So here first what we will need to We need to initialize the Saturday with some fruits apple and then we have toe put orange. So I have been a slide this Addy No, to add the values within this Harry, we forced me to make it as an aerialist which I have already mentioned in the session of Leer. So right now, if we will run this, then you will find that it is created as an object. Print the type, now run it. It will run like this one. It is an object. But to modify this at a we need to convert it into a list. So how do we can do that? So to do that, what we need to do we need to create an aerialist, another area like the group list. In this time we will tell that you want toe use it like a realist. Collections are realist at a list. On this time I will assign this fruit Daddy over here fruit added. So now this fruit list has become a realist. Run it. We can also print the time who had a list running toe. Get the tape. I want to check the type off this. So run it again. So it is a type. Add a list. Now I want to add it. So it is pretty much a straight forward now. Soto had value within this list what you need to do. You can use Phuc list and then you'll admit, And here we can pass another proof name that it's going to be on again. We can print it, select this one and see what to showing. So it has added, now moving further. I want to remove our value within the saddle list. So how we can do that? It is also a straightforward, so you can write the name of daring and reuse. Remove method and what value I want to remove. I want to remove apple. It happened, so here you can run it again. So run it, apple gone. So this is the way by which you can add an item and remove an item from a realist moving for though the next exercise is, check the length off binary so we can check the length of the Saturday against how we can do that, which is pretty much a straight forward. You can use the name off this 30 on the London here for a released we use count method so we can use count gone properties. It is not meta gone. Now. You will select this one and run it. It is giving us this swelling three. Why? Because we have three elements inside. No moving further. So this is we have identifying Bill Lentil. Add a list. But I want the length off, Ari. So let's goingto for the example. So we will use the e exercise one addy and check the length off this Saturday. So how we can do that? We can use size one and we can use lent method length property Saudi So now we will select this one and run it Treat assuring me it has five value the length off the areas Five So this is the way by which you can check the length No, no moving further. What is the next exercise? So we have remove item from Maneri list which we have already seen No moving for the we have check value existing Ari. So let's do this exercise. So in this exercise also, I will use exercise one example where we have created a very well exercise one. Now we will use a metal cored contains. So I will check that whether value 11 is exist or not with this and it will returns the true and false value. So let's select this one and execute it. So we do have value 11 within this 30. See you and suppose that if you are checking the valley which is not existing so it will return folds for example to help now again execute it so it will return false earlier it has returned True. No, let's run it So it is returning falls. So this is the way you can check that value exist within Addy or not impartial? No moving further. What is the next Texas A So clear Ready? So I suppose that I have this Saturday and I want to clear it. So how we can do that? So let's do it now. So to clear an area it is pretty much a straight forward as well. We will again use the example one and I want to clear this area. So how we can do that? We can use power Shell variable that is no and assigned toe this Saturday and executed Senior It assigned the value will know you feel will run this You will find that there is no well exist within this valuable So to conform that we can check it We can expect for exercise one and we can use this operate the trump arisen operated and we can check with no very see it will return true Ronit Senior, It has returned true. So this is the way you can clear the Harry within power Shell? No, let's more further the last exercise. But you're the least select this one. So for this exercise I will take the fruit list Example and I want to print it. Print what we need to do. We can specify over here and we can use right output Andranik. So this is the way by which you can bring the area variable. So we have used here by cooperated. I have already demonstrated this in Uglier. Off this station where I have used for each loop loop, I will discuss it next session. For the time being, just considered it as ah, loop is nothing but a way by which you can I read toe the values within an area we will discuss aboard this There are various loops, every level within power shell sort of for timing. Just consider it as one of the mechanism to white Read. Very So this is the way by which you can print it. The values off rather within a scream. Same way if we want toe, bring the values into a file how we can do that? So it is also a straightforward rival. Go with this and here we can use the pipe operated. This is implicit. Look within power shell. So now here we can specify that there is one commonly called out while we can use it And we can specify where we want toe save this value so we can grab this world in here. We can tell that food 50 60. No, if you will run it fruit. If you will sell like this one and run it So it has generated a fruits, not DT. So let's look into that to see year. It's a fruit store txt and it has given about putting toe a file that is orange banana, Pete. So this file with the name called Fruits Torti extreme. So this is the way you can bring the values within a text file in power Shell? No moving further. So let's goto the topic and see what other topics we have covered. And then we will wrap the session. So indecision we have seen that added, what is very aerialist Array index monetary dimensional lattice. And we have also for form all these exercises. Now I feel like you are more comfortable in added within power shells on this. No time wrapping up decision seeing the next session till then, Bob, I take it. 6. Operators And Flow Control In PowerShell Part I: Hello, guys. Thanks for joining the session in this section. We are going to loan about operators and flow can cooling power shell. So let's jump into the topic and let's look into water. The topics were going toe cover in this session. So in this session we're going to loan a vote automatic operators. Then we will also learn about operator presidents. Then we will look into companies and operators. After that, we will look into logical operators and at last we will learn about flu controls. So what are the flow controls which is being supported within power ship? We will look into those. So let's start our discussion with medical operators. What are the medico operators? Is being supported within power shell before going into the de mystery, you know, for political operator, I wanted to give you some information about automatic operators in Barschel. Impartial automatic operators calculate numeric values. We can use one or more or committed corporatist toe, add sub stacked, multiply and divide values. Along with that, we can also calculate the remainder off the reason operation. These all operations, we will look into the demo of decision. No, the greatest power off parcel is that the addition operator and the multiplication operator also operate on the strengths alleys and has table the addition operator con Katyn. It's then put the multiplication operators returns multiple copies off the input. This is not limited to these operations. We can even mix object types in an automatic s treatment. The method that is used to we will wait. The statement is determined by the type off left. Most object in the expression. Don't worry if we're not understanding any of this treatment. Whatever the statement, which I have said, then let's jump into the demo so that you can better understand points which I made. So we're in tow. Partial editor. No, let's do the exercises. To understand the automatic operators in Power shelf exercise one is pretty much straightforward. So let's do it. What we will do we will do for Strad for addition, we can use the plus operator sign and suppose if we're using three plus seven. So this is the way this operator, we are adding two numbers so if he will run it, select this one and run it so it will return the result they tricked on the result seem way if we want to use obstruction so you can use this hyphen sign as a minus and used three. And here you can select this one, so it will return the same way. Multiplication. You can use strict sign and the two numbers you will run it. It will give us toe multiplied value No, for division we will use the symbol and run it through. It returns the value. Now if we want toe do the more the operation that is to get the remainder. So how do we can do that? So we will use force Sent a sign for more operators to run it So it written Want this'd example is pretty much a straight forward No moving for the the example which I'm going toe the mistreat you where I can show you you can use plus operator toe con coordinate toe do its strength Let's do the exercise to so suppose we if we have two very able for example where one will do we have some in strength or power shin on we have another valuable that it's where two and we have something called training. So these two strengths I want to contact in it. How old awaken do that? So impartial? It is pretty much a straight forward. What we need to do We need to use the same operator which I have mentioned for concatenation. That is plus operated. So do that. Where? One plus Where to Now run it! Select all this one and run the selection. So check work the value we got so right Output. We can use this Command lit Brad three here we will run it again. So here we're getting power shell training. This is the concatenation string we are getting. So this operator plus operator, we can use it for concatenation off the string as well in power shell. Let's proceed further and do the exercise three. Now, in this example, we will also do the concatenation off to has table into a single has table. So let's look into that. How we can do the has terrible concatenation. Suppose if we have a valuable cord hash one and we have a has table with three will assign over here so we can use the key value pair like this and then we have another hash table which contents another information and here we put a specifying the key value pair. Now I want to conquer tinny these two and create the single has table. So how we can do that has three I can create and within that I can use the same operator hash one. This plus sign dollar hashed to trade the output. So here we can print output as well. So run it. See that? What? The value we're getting a year. So has three has to a develop it one from hash one and one from Has toe water did it has gone coordinated. That too has table into a single has table. So the intent of this exercise is that just wanted to demonstrate that we can use this plus operator for numeric addition from a string concatenation as well as has table. And we can also do it for Ari concatenation. So let's look into Ari concatenation as well. So I will do certain changes Just a will copy paste the same thing so we can tell that Eric on Carty Nation and here we can use it. The only changes we can go toe create an ari we will use parentis is and in stood off that we will remove this one. We will remove and we will keep one. Same with we can use this one. And here we can use to mention to and we can change the name. Had one ad do and add three at three. So here we can It is better. So here we will remove this parentis is and now we will run it. So, Jane, this one we need to change with this one. Alito. So here. Now, Brenda Harry three. So we will print this one. Now run it. Select this one through some matter. So let's investigate why the centre were getting so it looked like it is not taking this value, whatever the value which we're assigning over here. So let's confirm this how we can confirm their A list variable, which I mentioned that you and use a strict and run it. Then we can find that the value is different. We're passing Ari, and here it has dictionary, so we will create another variable which is not being used. So just given you at a bad one at a where do and then everywhere three at event red and here that no select this one. Try to execute drug in so it can caffeinated to wear. It's so we use the same operator for numeric addition Concatenation off a string has stable concatenation and Eric Concatenation So this is really powerful. So now moving for them now in this exercise what we will do we will try toe understand that how we can use multiply mathematical operator to repeat the string So what it means Let's understand with an example Suppose a scenario if we want to form it an hour or two, we can tell the form it an output where we want to print something like this and we want toe output something like this. And between that, we want toe put some message where I wanted to tell that Barschel training if you will run it so it will give us a formatted output selected So it has given us the formatted output But here the problem is we have we're printing these number off long symbol that I don't want so how we can achieve this? So in power shell we can use something like multiplication sign which we can use poor repetition off the character for example, if I want to print this character 50 times, then I can use it multiplied by 50 and we can write this one as well. And again we can. We warned this one. No, run it. It is not printing as expected. So put a parent. This is over here and then try. So no, let's run it. See you. So this is what I wanted to demonstrate. So it has repeated these symbol with 50 times. So this operator comes very handy. Whenever we are having the requirement to form a the display off, out put a moving photo. Let's look into the topic or topic we have no, no, we have operated presidents. It is pretty much a straight forward topic. So just wanted to let you know that how power shell process the medic operators. So here the basic presidents is is like this. First, it will resolve parentis is than you Nerio operator, that is negative number and at the third level of presidents, it has as trick than the reason then model is that means more multiplication and the reason will be taken care at the third level of presidents is now at last fourth level, It will resolve addition and subtraction. Make it little light so you can see it. No. So this is the order off execution off program. Whenever. If we have any complex form off expression on that time. This 1234 presidents level off. Operation execution takes place. Now moving for the no legs. Look into the competence and operators in parcel we have following types or companies and operators for equality. We will use Haifa. Nick you for not equality. We will use hyphen any for greater than equal toe. We will use high fungi. Same with greater than revalues hyping GT 10 for less than we will use hype in lt and for less than equal. We will use hyphen early. If you want to compare Ormat, we will use like operator formatting And then we have not like as well. We will learn about all these things with an example so that you will be more comfortable. So let's jump in tow the Power Shell editor And there we will perform some exercises. So we're into partially scripting editor. Let's start with exercise one for this. So let's grab it. Forced exercises exercise one compare to numbers, so it is pretty much a straight forward. If you want to compare two numbers, then we will use this Equality operator, for example to equal to on drown it. Then it will return the William Value through our faults to hear it has returned. True because both numbers are equal. And if you want toe check that whether to number, we will provide food different number so it will return the William Value faults around it which has returned falls. Now I suppose that if I want to check who is string so how we can do that for example, B f t is equal to be so if you run it and it will return true because both the strengths are seen. So this way we compare string as well as number as well to check the quality. So BDD was is equal toe bfg run it. It will return Ford's now One thing I wanted to tell you over here Is that supposed that if you haven't Ari and you want to check which are the numbers are equal. For example, if I have a number four comma, five comma six and I want to check. Grab the value which is for so here I will pass it and I will compare it. It will return me the four dwelling for so if you run it through it had returned me the value for because this value exists This four exist within this Addy. So we can use this equality operator as well to check the value or grab the value from the area as well. No moving toe exercise too. And here we will do the same thing for not equal toe. So we will keep the same exercise on if we will paste it over here. But here we will use and not equal to operator instead off equal toe. So for not equal to reuse any now it is reversed the fifties If you will compare this will return false state off truth earlier It has returned true because both are equal and we have used equal operated. But this time it is returning false opposite. Off it on this will don't through cute it So it will just remember that for equal toe reuse hyphen e que And for nautical do we use hi fund and me. So it is pretty much a straight forward. Nothing this complex over here. So no moving for the we have exercised three that it's greater equal and greater than equal . So how we can use it, which operated. We used to. Let's look into that moving further. We have exercise three for greater than equal to or greater than equal toe reuse for greater equal for you, G. So two is greater than equal to two. So running it will return truth because it is checking greater than as well. Let's equality. So, for example, if we want to check that greater greater than only then we use If three is greater than GT is to, then it will return. True because three is greater than to know the next example which I'm going to tell you that is really very interesting. Suppose that if we have an Ari Gordo which is having a value nine comma, a tent comma 11 and here I wanted to grab all the value, which is greater than nine. So how I can do that So we will use hyphen TT that is greater than operator and we will put over here nine. No, we will executed so it will extract all the values which is greater than nine on. It will display that. So run it. So it has given us 10 and 11. So this is the way by which you can extract the value from an addy on the basis off some condition. So here we have used greater than a comparison operator. No moving further exercise for a same like but with the lesson and less equal to operator. So let's look into that. We will use the same example just copy so that we will save our time. But instead off duty, we will use Ellie and here for DT. We will use it. So if you will execute this one, it will return. True because it is less than equal because it is meeting the criteria off to equal toe for less than we can check that it will return fault treat return falls and again here. If we want to extract the value which is lesser than nine so what? It will return. It will return only eight sick executed, so it has returned eight. So this is the way you can use this competence and operator for checking less than and less than equal toe. This is for less than equal to, and this is for less than so. Just remembered it. So moving forward. Now we have another exercise for matching operators, so let's look into that. First, we will take the example off like operator. So let's do this example now. So, like, operator will be used with the wild card. How we can check that. So suppose that if we have ah, the string core power shell and we wanted to check that whether the shell is every level in this world or not, so we can use like so here we will use wildcard character is strict and then we will pass shell and we will run it and we will check that with the shell. This shell world is every level within this world or not, so it will return through over here. So it written true. Why? Because it it is available. The cell word is every level over here. So this is the way you can use the like operator. Now we will use it also for extracting the values from the areas. So how we can do that again? I will take Create one area that is having a power cell and there is something called some value. We can put like a computer. We can put shell also and we want to extract the value. So how we can do that? We can use it extract the value beatable bill value is having shell so it will extract those values So he'll once you run this one Then it will return power shell and sell so executed So it has returned these words So it is also very helpful to extract the world which is having shell. So in our area we have a power shell which is having shell and the shell work so that the reason it returned this for seemed like like we have not like as well So we will use the same example over here So But in ST off like we will use not like are not like so. If you will run it then it will return False And if he will run this one, it will return computer one because we are using high for not like operated so ironic So it has returned computer. So this is the way you can use, not like operator. It is a negation off like so you can use it. No moving for the Let's look into other example. So the next example which we're going to do is the match or not match operator. So let's do this exercise. No, Here I will take the same example. But I will use match operator and we will look into the differences between that. So copy the previous example and here now we will change it toe Matt. So match operator Matt is a string using regular expression and vendor input is a scaler. It populate the dollar matches automatic variable. So let's look into that. So just run it looking toe that poured out Portraitists returning it throws an error No, Sorry, we need to remove this a strict No, we will run it again. So he tripped on True And it has also populated on automatic variable that is called Matt. If you run this then it has direct on this value. So it is a storing it. That means it founded the shell it found in this world. The match operator search only in the strings. They cannot search in Aires off interior or other objects. Now suppose if the input is a collection the match operator and not match operator returned the matching member of that collection. But the operator doesn't populate their dollar matches variable. So let's look into that. So this is a collection we have. This is a list. Or you can say this is an ari and if you will search it, then this dollar match variable will not be populated. So if we will execute this one, it has returned the shell. But if you will run dollar matches over here, then you will find that it is holding the previous value. So let me prove you at this point. Because it is uglier value that the reason we're getting this value. So now what I will do. I will create another collection and we will call it Sunday 40 Tuesday. And then we will use Matt and we will search for sun over here and now we will run it So it returns Sunday. No, look for dollar matters. So see, here it is showing the uglier value. That means it is not a storing. This matches is north distorting the match information from collection. But if you're is touring. But if we're comparing a single, it's drink. Just remove this one or just copy this this one just carpet and remove this to now compared it returns true now if we will run the matters so it written son. So this is the value we have matched. So no, he see this automatic variable is being populated. Same way you can use, not match as well. No moving for the no. We will look into containment operator that its contents operator off partial. So let's look into the exercise now in this example, what we will do, we will check that the string within collection and the Syntex to use this operator is reference value. IPhone contains operator on the test value, so this is also pretty much a straight forward. So let's creator list or saying Ari and here No, we will check that whether this values it contains within this collection or not. So this is your reference values and this is your best value. So let's jacket so it should return true and false as brother condition. If it exists, then it will return True if it doesn't take the people return faults. Run it. So it just took because this really existed. Same way you can use it, not contents. So here you can use, not contain. And it will return faults to run it because it is a negation off contents. So this is it. Pretty much a straight forward. So on this note, we're going back to the topics retail and looking toe water. The topic which is remaining now. So here we have completely mathematical operators, operator, presidents, comparison operators. We have completed these number off operators, all these operators, no logical operators and flow control. We will do it in part to so here I am stopping now so that this session will not go much lending. So on this note, I'm stopping over here, See in the next session off part two of this operator and flew controlling partial till then, Bob, I take care 7. Operators And Flow Control In PowerShell Part II: locates. Welcome to another station in decision. We're going to look in tow, part two off operators and flow controlling power chilled. So the topic which we're going to discuss in this session is logical operators and the flow controls in the logical operators. We will learn about logical operators in power shell. We will do some exercises to understand it better. Once we're comfortable with the logical operators, we will also look into the flow controls within the flow controls. We will look in tow a block if else block and switches treatment. So let's start the discussion on logical operator. So logical operators we have and or not. So these are the logical operators. We need logical operators in conditional statements or in loops were we have, we will wait a certain condition. The evaluation often expression that contains logical operators usually reserved in bullion values that is either true or false. So let's jump into the world's Ellis scripting editor and we will understand all these logical operators with some examples. So we're into power. Jalisco Predator To understand the logical operator, we are going to perform these three exercises. These exercises are pretty much a straight forward exercises. I have Kevin plexus sizes because you will understand it in a simple manner. So let's start with the exercise one. Here we will do the exercise. One didn't exercise one. We have to use the and operator So it is pretty much a straight forward. We will try toe well with two conditions and we will check what the conditions are true so that it will return through. If one off the condition is false, then it will return False for example. If I will check Creek will three And here we will market with parentis is can enclose this with parentis is and then we can use and operated And then we can check the other condition . For example, Why is greater than or so both the conditions are true so it will return troop Let's run it So it returned route to see you. So here it must be true. But the conditions if any of the condition is false. Then it will written for for example, If I change it like three good to we will run it. It will return faults. So see here. So this operator is really very handy whenever we are using if straight men and we want to check to condition or multiple condition at the time. So we will use and operator and logical operate Now proceed further and let's dough that society toe here We will use our operator with the or operator we need toe anyone off The condition must be true So we will take the same example So here if we will use our operator and if you will run it it will return through Why? Because one of the condition is true Run it so it returns true If both the conditions are false then will return falls. So anyone off the condition is being true then it will return through. This is also very handy whenever we're using If block on, we want toe check anyone off. The condition is being true Well, evaluating any expression So at that time it was really very, very useful Known little do exercise three Exercise three We will check that how we can use not operate They're not logical operator So if you will use the same example and if we want to negative, that means whatever the result which will come from this expression and we want to negate it. We can put north, not operator over here. Not so what it will do. It will negate it. For example, if it will return falls, then it will make it through. So for this scenario, if we will run in, then it will return through the year. So first, what it does it check with the condition if any of the condition is fault than it returned ? True. But in this case, it is returning falls for both the expressions on that last it applied north operation. So it make. If you apply Norton faults, then it will return through. So this is the way you can use logical operator. This is really very useful. When we are using Ive blown on, let's move further and let's discuss about flu controls. So in this topic, we're going to discuss about three kind of flow control. 1st 1 is the IV blocked, and we will also look into e fells block, and along with that, we will also look into switches treatment. Now let's jump into the parcel a script editor and do some exercises to understand it better. So we're in tow, partially script predator and here we are going to perform these four exercises to understand flow controls. So the first exercise which we're going to perform where we will check that whether North parent application is running within the system or not. So in this exercise, we're going to look into whether northward application is running or not. So currently there is one instance off north Paddy's running. So let's look into that. How we can do that. So to do that, we will use a commonly called get processed. So here we will check that you get process. Name, note, pad. Then it will print a note pad is running. So here we will print. That part is running now Run. If you run this, then it will print this one. So North Pad is running because we're running it now. What I will do, we will understand the else block as far So here we will introduce the ends block that is our exercise toe. So within exercise to what we will do, we will introduce the else. So let's do that. So I will copy this one, and here we will use the same exercise so that you will better understand it. And here we will use L's Onda. We will output that if it is not running than we've allowed for that North bad is not running no bad ISS, no crowning. So no word or what I will do. I will close this application and try to execute it. So it is telling that North Bad is not running. Cannot trying the process with the name? No, because I haven't running yet. So let's confirm it again. What? I will go. I will again run the Northman application. So no patent application came. No, no, I will execute the program again. Let's look into that. Warned out. What? We're getting so executed. So it is returning north practice running. So this is the way we can use if lock as well as the else block No moving toe. The exercise. Three. Exercise three. We're going to create a program which will do the thermal logic on for a night of scale and where we will looking toe if else and Elsie block in action. So let's write a program for this. To do that, we can any slay the variable called temperature. We will assign up values over here? No. We will start writing or even block where we will check that. Whether the temperature, it's less than equal toe 32. Then we will tell that whether it's freezing and we can tell the right are put or put over here and we will tell that it's freezing. So I will use the same blocking or that I will write less. And here we will part tell that it is an else if block and we can tell that if the temperature is less than equal to 50 then the weather it school same way we can check for If it is, listen then 70. Then the weather is warm. Else block we really use so else block we will go as is no need to face to anything. So here approval rate I'll put as hard heart now run this program. So here what we're doing, we are any slicing a variable core temperature and that temperature variable. We're checking that if it is lesser than the cool toe. 32 the noticed telling that it is freezing than we're checking that whether it is 50 for a night or skill than it is called we agree Newsreels of block, where we will check that whether the temperature is less than equal to 70. If it is then that then it is warm else it is hot. So let's look in tow that what is out? What we're getting. So select this one runners selection. So it is hot. Why? Because we have any sliced it with 19. So change the value. For example, you can use 40 check water thought what we're getting through, it is cooled. So this way you can use the else if ladder So this is called Elsie Flatter where we have multiple lt blow and we have else as well. So this is what I wanted to demonstrate over here. Now moving forward, let's look into another exercise. So the exercise for create the same program using switches treatment. So whatever the program which we have created in exercise three, we will do the same program with switches statement. So let's do that. No, In this exercise, we're going to perform the same thing what we have done in exercise three, but with the help of switches state. So here we are going to define our temperature variable and where we need to refine 30. And now we will use the street statement to use the switches statement we will need to use . He would switch on within that we will need to pass the temperature valuable than rest of the start. And here we need to make sure that we will be using forced to default. And then we will write the condition. This is the way how I prefer so that our Syntex would be correct. So see, you know there is no odor. So by default we will put heart. No, we will start giving the condition. So here there is one intrinsic variable. Is there that is dollar underscored which can be used whatever the value which we will get over here that is being is stored in this intrinsic variable To make sure that you will be using this. And with the comparison operator which I have discussed earlier in here, we can pass it and no, we need to have specifying their values over here. So we will use right output and then we need to print it. We will tell that we low freezing and know what we will do. We will copy plays the same thing so that we will utilize the time. So here, so three condition. We will check in fritters 50 less than 15 years less than equal to 50. Change value over your 50 and we can market as world. So here to mention cool over here and here for 70 we will tell it as a wall. So this is the way you can use the switcher statements. No, Run it and check what the value it is printing. So it has printed all the valuable. Why? Because we forgot to mention break because it will execute all the statement. If you will not use break over here. So this is the one off the important great area to use creature statement. If you will not use break, it will execute all the conditions and it will print all the or it will perform all the thing which is being mentioned within this A statement. Now only one a statement. It will run. So let's run it again. So we have past 30 and it is telling that it is below freezing so that the reason it is now if we will change it. For example If you mentioned 70 then it will print Walt. So let's run it. If we need to change less than equal to now, run it again so it will print war to hear it has printed walk because we have used less than equal. So this is the way by which you can use switches Street. So let's jump into the topic and let's look into the topic. What are the things which we have covered? And then we will wrap. So here we have covered the logical operators in the session and we have seen the examples of friend or no. This north is the same, like North operated, so I haven't covered it, but you can use it instead of hyper not you can use this operator as well. So it is equivalent and we have performed exercises for that. These are the three exercises which we have performed, and then we have seen each block you felt block and the switches statement told, This is all about operators and flow controlling power. So I hope you are comfortable with this topic. No. So I'm wrapping of decision over here. So in the next test, until then, Bob, I take care 8. PowerShell Loops: Hello, guys. Thanks for joining the session in this session. We're going to look into partial loops, so let's look into the topic. What are the topics which we're going to discuss in this session. So in this session, we're going to discuss about water loops and why do we need it? Then we will learn about types, off loop, supported way parcel. Then we will look into how toe hold, Lou. So we're going to cover all these kind off loops in this session. And once we will understand that, then we will also discuss a vote. And what scenario? Each of these tape of loops can be used. So we will discuss the each of them. Once we understand that, then we will proceed further. And we will also look in tow, interrupting a loop because it is pretty much required sometime in certain scenarios where we required to interrupt the loop. So let's jump into the parcel. A scripting editor and where we will all this topic with an example. So we're into Parcel editor now, let's understand water loops and why do we need it? Loops can be used to repeat execution off court rather than duplicate the coop. Understand this? A statement. Let's look in tow. This example Suppose that if we have an addi with the value called 50 30 44 16 80. And now I want to bring this value with their indexes. So we have to with the first way what we will do. We will use right output, right output and we will print it. Supposed to print the first value, We will print it like this. Now, for the second value, we can copy pastry to let me do it now. So here I have created these court. So where what we are doing? We are printing the first element. The 2nd 3rd 4th 5th and their values No, select this one and let's run it. So it is printing like this. But the problem with this thing is that we need to repeat each of the element one way one So that is not very efficient programming. So the better raise to use the loo. So let's write it. No. So I'm going to use the for loop. So how we can write it we can use for And here we can specify your valuable. That is I equal to zero I And here we need to specify that the competence and operator which we have seen in the realization and here less than five I plus plus And within the curly braces we will use the same statement only a single time. You can cooperate street over here and instead off first what we will do. We will remove that on Dhere. Begin a specify a dollar. I remove that and then we can specify you over here. I'd alright, variable so we can use dollar now Let's run it. Let's look into the values. What the value it is printing. That's running. So we did a mistake over here. We need to use the dollar value. Sorry for that. Now again. Try to run it. So it has printed the same. You can handle this four second and all this thing. Third, with the help of conditioning with the condition, you can check that. So I haven't handled right over here So you can design it like that way as well. What? The problem here we're printing first value and we're starting it to handle this with the same output like this you can use plus one so that we can get the our put like this. So let's run it against me. Run it like this. So here you can use dollar Jay cool to dollar I plus one and instead off. Why you can use dollars j so that you we can get the incriminated value over here. So let's run it. So we are getting the same value. I hope now you understand that water loops and why do we need it? No, proceed for the Let's Look into the topic. So the next topic is types off loop supported a power shell. So we have four look, which we have seen now for each loop for each object. Why look, do I do want to look and piping? That is an implicit looping. So let's look into the example one by one. So, no, we will discuss all these three topics. Types of groups supported way partial how toe called loops, and each day off Luke went to use it. So we will discuss all these in an example, within partially scripting every total solar. It's jump into partially scripting editor and let's discuss about each loop one by one, and why we use these loops and went to use it. So we're into partially scripting editor. And here we have already seen the example for four look like this we have used earlier the four Loop. So let's understand that went to use for look for Lopez really good when we have numbers to use to limit the Ludo. In that scenario, four loop is really, really handy. In this example. We have used where we have to repeat the index number and here we need to limit the number . So see your were limiting over here and taking that whether the value of Phi is less than five or not. So this scenario is perfectly suited. Will pour for Luke. Now let's look into the forties loop example and then we will discuss in Watson. Are you? You can use it, so let's do the court for for it's you. So suppose if we have users and we want to I trade these users. So how we can do that? Suppose we have these values than we have for so I want to iterate these value how we can do that. So this is a collection and I want way to read this so we can use for its loop over here. So it is really very handy United rating the collection. And so here we can use user in all users and then we will print it. We can do it anything. We can create these users with an active directory when we can you create these users in office. 3 65 years will in a zoo. Also ate of Lewis also. So whatever logic you want to play for the time being, I'm just printing these values. So let's write it so we can use right output user and here you can pretty print user. So that's it. So we have a collection and we want to wait to rate it. So let's run it select all on run the selection So it has printed all the values you can perform any actions whichever you want. If you want to create user inactive director, you can do that as well. So here you come toe know that why we use 40 So for each is very handy when we have collections and we want way to read those collections data than on that thing we can you for each loop now proceeding further. So the next loop which we're going to discuss is the four each object Look, So this slope is very handy when we're using pipe operative. So let's look into this example so that you can better understand that. But prior to that, I wanted to tell you that whenever we want toe, get the information about the files water, the fights exist within the directory. So we use either d a r or get child item command. Let toe both are equivalent. Basically Dia is the alias for get by item. So in this example, I'm going to use get yelled item on. I will get all the information about the vials which existing this location. Then I will extract the full name off those files and print it over here. So this is my exercise for this. So let me write in words so that you can better understand it. Then I will write the program. So here the exercises get all the files from this location you can use, use whatever you have. You can choose any of the location for this example. I have used this location where I have kept their day most. So here you can read the names of the files or say you can get the detail off the file on bring the full name of those winds to let's do it. So, as I said you were going to use get child item and we will use the pipe operator what it is doing. The pipe operator, I wanted to tell you the output off this command or whatever the commander at which we're using here. It will work as an input for building which is reside after this pipe. It can be anything for this example. This half is the Getchell item and output. Whatever the values that we will get, it will be used as an input of or for each object. And then we will grab the full name from it. So let's do it. You know what we need to do? We need toe print it right output and we will grab the name right. Or why is Onda? We will use the plus operator give us space. And here another thing which I wanted to tell that the dollar underscore is representing current information. You can consider it like a this operator. If you ever worked with any off the programming language like bite on C plus plus start met . There is something called this operators. We it is equivalent like that. So consider it so this operator off our shell, which represent the current record and from there we can grab the full name. Now run it. So this is our complete example. Let's run it and see what the output. We're getting the full name. So now I want only the name. Instead of full name, we can use based names. So let's run it so it will return one leader name of the file instead off location. Currently it is returning the location as well in the full name. So if you run it so you will get one leader name of the file. So this is what I wanted to demonstrate it. So right going into other Lou, I wanted to tell that when we can use body to object whenever we are using the pipe operator. So on that scenario, it is really very handy to use for each object. Lupul. Let's proceed further and let's look into another type of look. So the another type of loop is why. Look, this loop it's pretty much a straight forward. So went to use this loop. You can use this loop for general use. You tie treats only when a wildly specified condition is true. Let me write an example for you. Suppose that if we want to print a number from 1 to 10 so how do we can do that? So we can use why Luke while and here we can What? Oh, number is less than less than equal student and here we can print it So you can right over here, right out. And we can right now And we can most we will in its lays it also now number equal toe one. We will slide it with one and here we can use no glass. Plus so that it getting clean too. No, what? Our requirement is to print the values from one Putin. So to rue that it is a general use. So we're using while Luke until the time the condition is true. So this loop will execute. So let's run it. But now it has printed from 1 to 10. So it is really handy when we have a general use and it looks very clean, so you can use this while loop as well and stood up for love. Now moving for the Let's look into other Look. Now let's discuss about another look that is, Do I looked through? A loop is almost same. Like why Lo fi trait one. Lee, while a specified condition is true so when to use it, use this loop when you want to execute the loop at once and then check the condition. So let's write an example so that you can better understand it. Suppose if we have a number equal to zero on DWI. Want toe executed at least once so we can use do. And here we can use while something like that and we born that less than equal to 10. We can increasing number plus plus, and then we can write the output of the same example we have taken over here on we can print out. So let's run it and see thou de Gortari. Sorry for that. That is the typo. So let's run it again. They did the same thing. So the difference is the loopy is executing at least once over here. That means this Lupin executing first and then the condition is checking. So what will happen? Suppose if you will market as tend to It will run at least once. But this is not the case with the while loop. If it the condition it met, it will not execute. But this loop will execute ones who see this example If we had any slicing it with 10. But here it will print it at least once. So let's run it. So it has printed the value 11 and then later it has checked the value. But this is not the case with this wild look. I suppose if you will in its lies a 10 so it will not print any value. Now try to execute it. It will not go inside the loop. So let's run it out to see here. It haven't printed any value because it is not meeting the this condition that the reason it is not going inside the look. But here the condition checking is happening after execution after at least one execution that the reason it is executing event though it is less than if you will use less than equal toe so it will execute two times. Now moving further. Let's look into another type of fluke. Now another type of Plouffe we are having is doing to look you want to look the same like do while so went to use do want to look It is really good when you want to focus on terminating the condition. So let's look into the example now So again we're going to use the same example. But instead of that why Look, we're going to use until so what we will do. We will grab it this example only and then stood off while we will use until so here until now Run it. Did you notice that the loop is executing in an infra night manner? I have a strawberry with control. See why? Because it is not getting this condition and this condition will never come. Why? Because we have bean initializing this loop with them. So what? It is happening that it is going there implementing it the value become 11 and it is checking that when the value comes to 10 and it will never happen because the loop is going on and on on incriminating those values and that the reason here. Rental 6 to 95 Then I have a stop to it, Control. See, you hear? You can understand that whenever we want toe terminate anything on dark scenario you can use until conditions. So that means this loop will execute until these number of times. So that is very handy. I would suggest that. Or I can recommend you toe right all these scripts by your own so that you can get a better feel over. And you can understand the significance off each off the loops. No, let me correct this bug. So remove this. No, Run it again. So it will stop back then because it will get their 10 in this range to run it. No, this time it friend only wants. Did you notice that? Why? Because it is a nature off or until a statement where we're telling that you will run until you're getting the value which is lesser than 10. And it is getting the value one that is lesser than 10. And the moment it finds this value, it distorted toe print the value from 1 to 10 using until we need to change it to greater than then we will are able to print the value from 1 to 10. So now run it. So now it has printed it. It has printed till 11 because it is a nature off. This the do part will execute forced. And then the condition will be checked where it last when it is running so that the reason it is incriminating the value from 10 to 11. So no moving for the let's look in tow The other loop. So the another kind off loop is the piping that is implicit looping. So went to use this loop whenever you want to avoid cording on explicit Luke along with that, you want to also a word the potential bugs. In that scenario, you can use piping, so let's look into an example so that you can return to stand it. So here what you need to do, we're going toe grab all the processes which is executing now and then we can print the name off and the idea of those processes. So there is a commander cord select object, and here we can grab the property. Which property we're going to grab the I D Then we need to grab the process name and see peels. So let's run it without foot. Words are put. We're getting over here. So this is the output which we got over here. So these are the processes and their idea. Whenever you want to avoid writing the explicit corn for Lupin in that scenario, you can use pipe operated. It's pipe operator. I already explained you when I was explaining the four objects loop on that time I explained you how the are put off this. Come on, let's can be used within this command lit as an in force. So this is the way you can use piping that is also called implicit looping. So let's go back to the topic and wrap decision and understand that what we have learned so in decision. So in this session we have looked into water loops. Where do we need it Tapes off loop, which we have discussed for for each loop for each object Wide Luke, Do I want to look piping implicit, looping. We also look into the example so we know that how toe hold all these loops and we have also discuss about each of the loops and we have understand that went to use it. So the last topic which is remaining over here is that interrupting Galoob? So let's discuss that as well. So let me write a program. Then I will explain that program. It is similar toe whatever we have written earlier. But to save the time I can write it and then I will explain you. So let's jump into the scripting editor once again. So I have returned it over here. So I have used the same example where we're printing from value from one Putin. But here I have used a condition where we're checking if the value is going toe we ate on that time it will exit from the loot that this might come in your future work whenever you're doing something in certain scenario, where you want toe interrupt the loop. So how do we can do that? We can do it with the breaking street. So just remember that so far no missing are you? I have used that I wanted toe executed 10 times, but I want to stop the work tried toe that So here I am, a stopping the loop at eight number. So let's run it. So it has printed till eight. And then it has a starts of anybody. If we wanted toe interrupt the loop, you can use break its treatment. So let's go to the topic to here. Now we have understand that interrupting a look. So no year I'm wrapping the station. I hope you in your decision, See in the next session till then, Bob, I take it. 9. Functions In PowerShell: Hello, guys. Thanks for joining the session in decision. We are going to look in tow functions in partial. So let's look into the topic. What are the topics which we're going to cover in this session? So in this session we're going toe cover water functions. Why? To use function. Then we will look into types of functions impartial. Then we will also learn about how to write documentations for function. Then we will learn about our shall functions naming convention. Once we understand that naming convention with impartial then we can proceed further. And we were looking to ease off youth where we will discuss about some of the helpful command leg And then afterwards we will also look into so common for a do instant here I can demonstrate that whenever you write any function, how we can call it in tow a graphical user interface. Then we will proceed further and we were looking toe how we can apply validations on functions. This is really very important topic to write effective and efficient function within Power cell. Once we understand that, then we will look in tow. What is the problem with partial function and what is the best solution to resolve that problem. Let's jump into partially scripting editor and where we can understand that water function and why to use functions. So we're in tow power. Selous, scripting editor And here. No, we will understand that what is functions in parcel A functioning partial is a grouping off ward that has an optional input and output. It's a way of collecting up a bunch off court to perform one or many different time by just calling it instead of duplicating it. So let's understand the function with an example so that you can understand it better. If you remember in our last session, we have used an example of printing values from 1 to 10. We're going to use the same example over here to explain you the function. So let me write the program, and then we will discuss further. So we have used numb equal to zero, and then we have used widely. So here we're keeping the while loop again on it, less than equal to tell. And then we will incriminate the variable over here and now right out. And let's print it So it has printed. The value is printing till 11 because we have used less than equal to. That's fine. So the intention over here is that so? Suppose if we want to execute the program till 20 and we want to keep this program as well . So what we need to do we need to write it again on We've need to execute it'll 20 times. So, CEO, what is happening? We need to repeat the court again and again. So this is not pretty much efficient. So how do we can resolve this issue? And suppose a scenario in one off your project you want to execute till 30 again, you need to keep the same copy or it and executed 30. There is no harm on it, but this is not efficient programming. I have taken very simple example over here because I wanted to tell you the concept off function on the same concept will be applied to any off the complex example or any of the complex functionality. So to resolve this issue lead to some modification within this program. So let's delete this one. Just select this one and deleted and write a function over here function, and we are going to give a name which is pretty much a stranger than power shell We will use over and I even wore user different function identically use UDF and then the name of the function that is known. We call it as you leave number what it will do It will bring all the numbers which we will pass in the para me to let me write the function over here and then I will explain you so have returned the function over here. So here we're passing the range on. We are hydrating until this rain on donated are put those values So the benefit out of it is that we just need to call this function how many times we wanted to pray. For example earlier I have showed you how to print from 1 to 10. And then I have also Soto print from 1 to 20. We have copy pasted the court but now it is not required to do so. Let's use this function now. Let's call it to call this function. We have to write something like this. Now let's run it. If you want to execute till 10 10 times, then you can call it like that it has printed. And now if you want to print it for 20 times, you can call the same function it will print for 2010 30 time and however a number of times you want to call it to see if we have saved with repetition off court. So, no, you can easily answer water function schools that can be reused except perimeters to see your it is accepting parameters. It will be executed only when we will call it to see your We're calling it impartial. We have various command. Let's if you will look over here. So these are all the common. Let a specific to the particular models. So these are nothing but the functions itself within it. And in later part of the courts, we will look into models where we will use functions to design models off power shell. That is really very powerful, no moving further. So we have understand water function and why to use function. It helps us to say from duplication off the court, no moving for, though we will look into types of function in power shell. So we have basically basic functions and advance function so basic function we have already seen in the example which I have shown you. So this example is the basic function, and this is not the right way to write the function within power Shelf. Why it is not right with because you can pass any value and function. For example, you can pass over here any string than it dysfunction will fail. If you will run it, it will feel the year, so we have to provide validation as well. We have to also provide perimeter types as well. I can show you when we use it once funk. So no, let's discuss devoted ones function how it is different from basic function and let's writer at once function so that you can understand it better. So let's jump into partially scripting a return now. So now let's convert the basic function into advance function. So just copy this one so that we can convert it as a advance function. So what we need to do we need to specify that I'm think or commanded binding toe this Annable common perimeters, So let it right it like a man let binding and then we need to specify the perimeters. So what perimeter we're going to pass over here on. We can remove from here and let's right the perimeter over here where, um And within that we can specify the perimeter, which we're going to send and the type off the perimeter rated pretty much important. We're going passes. And, you know, we have converted a basic function into advance function with marking dysfunction as in command, late binding. You can think it off as commander. Bindings are especially attribute classes that we can use to define partial behavior, which actually makes this function as an advance function with command capabilities. Like currently we're printing the output. But suppose that if we want to use for debugging under the time of debugging, we can print, the world goes messages. Suppose if you pass the verbose black while calling this function so it will print that Mrs . So how we can handle that. So here I have used a message right, verbose on. It's a simple message I have provided without passing. The world bows black. This message will not print one league. This message will be printing, so let's call this function. So let's select this one and load it into the memory, so select and run a selection. Now you will run this. Select this one and run it so we will use it with world wars. If you will run it, then it will print this message as well. So see you. We got this message. So this capability give us so much off Power toe design the function as we want. Whenever your user want to rework the function and what kind of information we want to pass , we can saw a special information, whichever we wanted to show X. I can show you with an example. So let's proceed further to design another example with advance function. So no, let's design an advance function that will add two numbers Functionality wise, this function is pretty much simple. But But over here we're going to learn so many techniques to design and advanced function. We will learn that how we can document a function. We can also see that how we can pass more than one perimeters Then we can also look in tow how we can add for votes functionality so that we can provide the information whenever user invoked this function with the perv owes for debugging. So how were going toe? Handle that thing? We can look into this example where those are put should be for mated with new line and tab . We will look into back take in this example In this example, we will cover these topic as well. We will see how to read documentation for function and we will also discuss about naming convention. I have already been discussed this thing So I rely to rate the same we are going to use were well known combination. We will also look into how to get woops The valid ropes or approved works within power Shell knowns can be more flexible. However you want to use the name you can provide that jobs. We can choose it very specifically. I will show that as well. So let's jump into the porcelain return on So here to save the time What I will do I will write the court and I will explain line by line so that we will Don't waste time in writing the court. You can take the copy of the court from the resource section and run it letters. No, I have written the function So within this function I have done the documentation. Documentation can be done with the help of these things. So where we need to specify the synopsis description where dysfunction is doing and we can also specify the parameters if we're using any parameters within the function, we can specify those and why we are using it so that it would be really helpful to the user who is using it. We will also mention that how we are going to use this function and if we have any north, we can specify those no. Then afterwards, you can specify that command alert binding because it is pretty much required whenever we're writing any advance function. And here we are specifying that whenever dysfunction is being caught, we need to pass two parameters over here. And then we have also provided the right word was right where roses guard whenever user is passing over both plaque that will be really helpful when the user will do their debugging on this output. Will we print every time Whenever user call this function and what it is doing, it is just doing the addition off two numbers, so it is pretty much simple, but the intent off telling all this thing with a simple example because I want that you can understand that how an ad ones function is different from the basic function and how to do documentation. How we can pass more than one perimeter and how to use werewolves. Functionality. There is something called new liner Newtown here we have used back tick with and backed equipe that is the representation off the new line and the tab. So if you want to do the format, then you can use this thing. So let's run this program so that you can understand it. So just Lord, this program forced into the memory and then we will run one way one worker would exercises which we have done. So just run it now how to check their documentation when users want to see the documentation off this function. So we need to call there is a commander core get commands and within that we have show commanding four and here we need to pass the name of the function. So let's run it. So here you will find that with the help of this, get command so commanding for it is providing all the detailed information. What is the name, ordeal, name and the documentation as well. It is printing the documentation as well, which were documentation which we have provided over here. So it is really very handy whenever any user want to know what your function is doing. And it will also print all those detail, whichever the detail which we have, how it is being designed. So all this will come over here and it will also give you the information about the perimeter set. So documentation is really very important. Now let's call this function. We will take this and just based it over here and run it all. Let's run it. There is some type of So let's remove it. Just go with this one and based it again and try and try to run it. So it has printed 15 and it has also printed Thanks for calling, which is coming from this right off. But do you see it? Is this right? Were voices nor entered. Now, how do we can print it? Suppose that if anybody want to debug your function so they can call this world views and then on that time it will be printed. So let's run it again. With the World wars flags off, you run it now Then it has printed thes information where it is telling that number one is five number, twist and and see year. It has also printed the new line and the tabs. Let's proceed for the one thing you must be noticed that how do I come to know that this wolf is recommended? Well from power shell known You can keep anything you can. You use anything. But it is a recommendation from Microsoft to use that word so that it is more informative. Toe the user. How do we can get that? So there is a commander cord Get work and if you will run it, then it will give us all the wolves and their purpose. For example, like card which is belongs to common. Clear, close. You can use anything from here and what is the purpose off your function And as per your purpose off your function, you can apply over here, so choose anyone, whichever you are supposed that if you're writing any custom copping based, then you can use move kind of thing. We have used involved. You want toe? Add something we can use ad as well. So this is the way you can get to know that all to choose work. Now let's proceed further and see the topic. But of the topics remaining So we have seen the documentation for function we have also discuss about well known for men. We have also seen how to get the valid World. And here now we have also seen some of the helpful command we have used. Get comment, get we'll get help. So let's look into this command licked. What actually does this will also give us the clue why documentation is really important. So let's jump into partial scripting editor once again. And here we will, right? Get help and the name of the matter. Copy and enter. See how beautiful it is. It has given the information about the functions which we have provided over here like synopsis description. So it is telling all those information. So the user, or say it is giving all those information about the function with user wants. So it is really very important to make sure that you will be writing documentation for your function whenever you're writing any production level of function within Power Shell. This will give us our complete information about the functionality or this function the year it has also given us some of the information. If we warned the complete information, we can use this full flag and run it in your water. It is giving. It has given us the complete description. 40 is required. Where do if any required validation is there or not? What is the perimeter position? All these information it has given. So this is really helpful command now moving for the there is other commander called show common, which will also used to invoke the function. But through doing so, let's goto the parcel scripting it to know So let's type show commando common and then the name of the function year We will run this one. So this is the geo graphical user interface to invoking that function. You can pass any value for example 12 24 Andranik So it has given without so This is one of the way by which you can call the function within power moving further. So another topic which we're having is how to apply validation on function. It is pretty much very important supposed that if you want to apply some valuation rule on some para meters off function, so how we can do that? For example, I want to provide a range for Vera meter one so that it will calculate only their value within the range off 1 200 same for number two. So that means it will do the addition between 1 200 only would the number. So how we can do that? So let's look into that. We apply validation. We will use validate range, a tribute on top off this. So there is an attribute gold validate range Tohir Bradley Range and within that we're goingto tell that it should be 1 200 only. Same for the number two second perimeter. So this way we can provide the validation. If you pass any value more than 100 then it will throw an error to let's look in tow that prior to that, let's Lord dysfunction into memory and run it Now. Call this function Soto calling this function. We can use this. This will work perfectly fine, but if suppose if we're going toe past one toe, 105 and 107. So no try to run this 13 throws an error by because we have provided the validation on it. This function will work only within the range off 1 200 So this is just a dummy example. So the intent off this example is that you can understand that how we can apply validation on function. No, let's proceed for the now we have seen that how to apply validation on function. So no, we will discuss about problem with partial function. So what is the problem with partial function? So let's look into that. The problem with the partial function is it is difficult to maintain largest group model. All of the model must be updated for any change, and the source scored. Management's what it means. So let's understand with an example, suppose that this is our model. I will discuss the model in later part of the session, but considered that this is a model file and it has to function. One is so UTF number and another oneness. Another one is invoke. You do You've had two numbers and suppose I have done some changes within this function, and there might be some bug within this function. And because of that, what will happen that it will show the bug within this model and that will affect the working function as well. So it is really very problem mystic to maintain the court off separation. And not only that, suppose if your client required another functionality within this model. Then again, you are coming back toe this file and doing the changes and that changes will increases. The chances are introducing the world within the file. That is really not recommended. So what is the solution for this? So the solution is to keep each model function in a separatist script file unknown import, have the mortal dynamically Lord, this script file on how we can achieve this. That is our discussion point, often accession. That is dark sourcing. So we will discuss the dot sourcing in next session. So I'm stopping this session over here. I hope you in your decision Syrian the next station. Till then Baba, I take care 10. DotSourcing: Hello, guys. Thanks for joining the session in this session. We're going to discuss about dot Sourcing. This is really very important topic in power shell. As in the last session, I have told you the problem off multiple functions within a single file. Then it is really very difficult to manage. So in this session I will demonstrate you. What is the problem you are going to face if you are keeping the multiple function And we will also look into the solution which we will get with the help of outsourcing concept off Power cell to let jump into the parcel is scripting editor, where we will force design some function. And then we will intense religion rates some error. And after that we will work with the solution which will help us to design a better solution with the DOT sourcing. So we're into Parcel is scripting editor. But prior to writing any code, I wanted to show you the data which we're going to use for this demonstration. So let's look into that. So we have off CSB file called User and full. So let's look in tow that So here we have some information like user name and the email off that used what we're going to do. We're going toe designed to function. One will read this year's we find, and after reading that another function will print the user name and the email off that user. That's it. Simple program. We're going toe design, which will have two functions. First, what we will do. We will write those scripts within a single point, and I will generate some mirror within that point so that I can showcase that. What is the problem with such kind of approach? Will design the solution. And then I will showcase the better way with the help of DOT sourcing. So let's close this and jump into a partially scripting editor. But prior to that, let's create a folder called Scripts over Here where we can keep those scripts. No jumping toe, the partially scripting editor. So let's save this file first and then So now just given name. We will give it all in one, not PS one so that we're keeping all the function in single piece. Why so save it. So we have saved the file. Let's start writing the program first function. We're going to write, which is called function. Get UT of users in four. We will give a name like this and then this function we're going to rate it like advance function, which I have mentioned earlier to. If you have any doubt, you can report in the function section last session and here we can provide the perimeter. We're going to pass the part off the CSB file, which we're going to use. We will give it the name dollars, years we file. This is the perimeter name. And then we're telling that return and read those files so we're directly returning after reading it. It's a very simple function. We're going to read this with the help of import sees. Be more different, right? Yes. We find whatever the file which we will pass over here that will be read and that will we're done now. We will design another function which will get this data and print those data by iterating it. Let's write it. So there is another function we will call it as so user defined function users. And here we will specify again, make it advance function. We can use common alert binding and here we will use stratum and we will use it on the user information. The file which we have read over here. Onda, we are passing with the help of perimeter over here, users and four. And then we are right aerating those information how we're treating it. We had using forage. This is the loop. We're going to use it. And here what we will tell Grab user in from users Inform as we are having the user detail over there and we're going to print those valley with health right out. And now we will tell that user and we were grabbed all our user dot user name. It will print the user name on the email for this user is the $1,000,000 user dot email. Well, this is pretty much a straight forward function. So here we are, reading the CSB file, which I assure you, and then in this function were grabbing the red data and we're renting as an output you can use it for active directory user creation as well. Office 3 65 years of creation as well. But here in this example, I'm just using So what we're going to do, we are going to generate a bug over here, but practice generating the books. Let's execute this a script and seed out, Put word out. But we're going to get so to execute. Let's open, partial prompt. So how we can execute the script. So to execute this script, we need to load it into the memory. Or we need to design another function which will work as an interface that will call both the function, and we can directly call that descript. So let's try with this technique where we're going to design another function which will be calling these two functions one by one. And here we will execute that script by calling the script file names who let's go back to the scripting editor once again and here designed another function that discord called me, and here we will call these to function one by one so that we will look into how it is executing. Go toe, call it, just get the name and the sea is we filed, which were going toe pass. Over here is we have seen that the CSP file, which is inside there dot sourcing demo and the name of the file is and user info, and that is going to a store within the variable that is called C is we data. And this data, we will pass to the second function. That is our show user UDF users just call it and running. And here you need to pass the CIA's we data once it is being done. That said, we again need to go back to the power shell prompt. Let's go back. And here we will call that. So to execute it, you need toe write something like this Power shell command Ondo operator. Then we have produced this curly braces start and we need to specify the location off the script Over here. That is our drive to you to really than power shell and which is inside demo. And we have the dart sourcing their more older And within that we have a scripts than we have I'll name called All in one door be years one in the name of the function which we're going to call that we have created the function name Waas called me to this. Come on, you need to write Barschel hype in command and then you have to specify the location and here you have to specify the name of the function from this A script? No. Try to execute it. So it has given us doubt. So what we have written, just go back and let's look into that. If you remember that we have written to function, one is getting the data from sea is refiled and then we are renting it with the formatted output. So that is what it is doing. But this is not the right way. I warned my my third. So we have a level within the memory. So here, Lord servicing comes into picture and that will ease our work. So how it will ease our work first ofall how we can achieve darts or singing powers. Let's understand, to make this a script every level into the memory, what we have to do we have to do the following thing first clear it. And here we need to use dot this dot we need to specifically and then we need to specify the location on the location which we're going to specify the dark sourcing M o here scripts and here all in one. So this dot is nothing but her dot sourcing. With the help of this dot what will happen the entire function will be every level within the memory. So let's run it. So now you try to access the function which we have created the function which we have created over here it get utf users in four n Here we have created another show. I finally if users so both the function if we want to use or we want to call this call me that is also being available. So let's try to do that. So let's go back and here you need to specify get high fun UDF see, we have beauty if users in four and now you can fast you can pass in tow a variable or you can use it as is But here we are returning the value so we can use a variable over here. So what we will do? We can use a variable data for later. Were you going to use D? And here we need to specify the location on the location for the CIA's veers dots or think . Now I have provided the location for the seas we know, executed or looking toe what it contains in dollars. So it it's containing the seas. We pile into the memory. Now we will call another function that is our show. And here you re a users. And here we need toe past this dollar D and run it to see year It has executed it. Why it is executed it because we have used darts sourcing No moving for the So Now, with the help of dot sourcing, we are getting all the functions within the memory. We can increase the power of this with the help office plating the court in different different files so that we will get the modularity and then if any changes lined is requesting. So we need to introduce a new file within the folder instead of changing the complete file in a one. Go to what I mean to say I can explain you again. Suppose here client has requested the third functionality where it is calling these two functions together. But this time, maybe problem is taking a real time scenario. If I'm introducing a new function and that will generate some issues, for example, I have given wrong function name while calling. So just give it and run it. So what will happen that because of that these two functions are working perfectly fine. But what we did in the new function which we have introduced, we have given some wrong information or some but we have introduced which we don't know. So what will happen that it will impact the entire functionality off the applications? Who lets run it? It will give us an error because we have given a wrong function name over here just to replicate the scenario. But now again, Lord er scripting toe the memory and this time we will call this new function and let's see what will happen to let's go to power shell prompt. And this time, what we are going to do, we're again going toe Call this descriptor dot sourcing so that it will lower the data or lowered the functions within the memory. Run it So it loaded. Now, this time we're going to call the new function That is the call me Frank. So to do that year, we just need toe come here balmy and inter CEO. This we have generated the error and it is throwing that era. So is really very problem. Mystic. So how we can resolve it. So to make this application more robust, let's do some design changes in this application. So their design changes, which we are going to do in this we're going toe separate the functions. All these three functions into three separate files. So let's do it. No, let's create a file called Breed sees. We'd give it a name over here, and we're going to give it a name called Reid sees we dot obvious one and copy this. And now we stick to this 1st 1 functionality we have put in tow this for No. Let's create another file. That discord soc is three data. This is just a dummy example Who? Let's save it and call it as a college as sure CS we data not be. It's one. And now we will copy this functionality and placed it over there. So here, just copy it and paste it over here. So now we have to functionality into different point and again let it be like this way. Call me. We will use it later. Another thing which we will do now. We will change the location off all in one dot ps one file because we are going toe Lord, those functionality which is going to reside in tow this script folder So we will keep only those Well, which we want to Lord remaining file, which is not required were not going to keep in tow that let me remove that file from that location. So here I heard this on Good it over here. So now the next step is we will Lord the entire script folder into the memory on which will have a functionality for ritzy is we and soc is re data into the memory. And then we can use that to let's jump into the power shell Command prompt. And from where we can execute one command that will Lord the entire script Wilder in tow, the memory. And then we will use it. So let's clear and use our learning in the realization. Whatever we have loaned, we're going to use the get child item. I hope you remember that this is an equivalent command or the area. And here we need We're going toe past the part and the part. You remember that where we have kept up the script, we can tell that outsourcing the motor, sourcing their move. And here we're going toe tell scripts we're going to load into the memory. So to Lord that no, what we need to do, we will use the pipe operator and we will use for each for each object. And then here, the curly brace it on the dot sourcing operator, then use dollars again over here. Within that we are going to use dollar underscore. If you remember, that dollar underscored this represent the current object name. So now if you will run it, it will Lord all this crypt which reside in this location script. So let's do it. So let's run it. No, If you will check, we have something called Get you b f user info To confirm this earlier I have used the example You might be thinking that it is coming from that. So let's do one thing. Let's change the name off this and do it again. What we are going to do, we are going to give it a name user in 41 so that we can test it as well. So it is doing the same thing. And here beauty If users want. So let's do it now and again. We will run it. And here we will execute the same comer And now again, try to run a toe here, get UDF user in for once or let's run it. And here did equal to this one and the CSB file name over here darts or think they move. And here the sea is we user in fourth and let's run it now we will call the show in photo Do that So hi for you, dear Users one and then we will pass the BD Let's run it! So see you it has executed it. So what we did we have segregated the functionality wise script and we have keeping those a scripting toe afford it and we are loading with their daughter Sing over here using for each object. Luke No. Suppose your client asking for call me kind of her requirement to introduce a new functionality called Call me which is calling these two functions together. So if you're introducing that and it is containing any bulk and that scenario, it will not hamper the application. Who let's do it will just save a file over here or call me PS one. Call me and here we're going to introduce a new functionality on give it the name. Whatever the name you want to give. You can use a standard at once partial function but for demonstration purpose I have used basic function over here. So here we're going to use it and we have bug exists now also. But that is fine. So no, we have introduced the new functionality. This file will not affect, if any error which is containing it in this file that will not affect the other functionality off the application, for example, it is containing a wrong function. Me, we will run it. Let's around it. Let's load it again in this time again run it and try to call me function. Call me. Let's call it is throwing an error. But that is not affecting the existing functionality to let's rectify the center so that we can complete the demonstration. So now we have rectified the error and this time we're going to use user and for one because we're using users and for one over here and one. So now let's run it again. Go back to common from Lord it and gold calm. Is it executed? So this way you can design a robust application within power ship. In the next session, we're going toe. Discuss about more deal. We will use the same functionality and we will convert it into a model so that every time we don't need toe call this function like get real item for each object to lord the information into the memory instead off that we will convert it into a model on that will be have a level within power shell environment so that you can use any time and that we will achieve through power. Still model. I hope you enjoyed decision See in the next session till then, Bob, I take care. 11. PowerShell Module: Hello, guys. Thanks for joining the session in decision we're going toe loan about or shell models. This topic is really very important to work with Power Shell in the last session we have launched about dot sourcing that enable us to write the court in a more modular manner. But the problem with that every time we need to learn, though, get child item with the pipe operator and we need to wait radar folders where we have kept the script. There is nothing harm on it, but it is not very efficient and north a standard way. Who designed the production level application within portions to make it more restrained? Erred social application which we can easily distribute. And whenever we opened a power shell environment, whether it's ah yes, see integrity, rescript, predator or power shell from your custom model will be a level within the environment so that we can directly use the functionality which you have designed or say the application which you have designed, how we can achieve this thing toe Here come the partial models. So let's look into the topics. What are the topics we're going to discuss in this session so in this section, we will discuss about water models. Why we use them. Then we will also look into model confidence, learning the model components. We will also discuss about model types. Well, we will discuss about how many types of models we have and here after we're going to discuss about script model time, that is our main point of focus for this session. We will use the same Democrat which we have used the dot sourcing. But this time we will convert it as a power shell model to In this aspect, we will use the same court to design the power shell model, and after designing it, we have to also looking toe the way how we can use the custom designed models. When this aspect he's all points are mentioned over here keeping your function in separate files and there is something called model manifesto, these old topics we're going to discuss in the upcoming discussion. But prior to going into in detail discussion, I wanted to show you one diagram which will give you a holistic view off our shell model, and then you can easily understand the concept off partial models. So let's jump into the diagram when you install power cell or whenever you get a power shell environment by using Windows 10 then you will get some more more dill installed within the partial environment. We don't have any other model of level within the environment so that we can manage any other resources apart from the system resources. So to provide the additional functionality for automating any off the environment, we need to install that model. And that model is basically designed for that particular task. For example, if you want toward to meet the environment off either blue, it's with the help of Windows Powers. Then you need to install eight of Louis Model in the same aspect. We won't tour to meet off history 65. Then you need to install office 3 65 model. Same is the case with Azure, our model azure armaments, azure resource manager supposed that If you want toe automate active directory than you have to install active directory models or such kind off architectural windows, partial makes it very powerful toe to automate anything. So that means if you loan power shell, then it will be a Swiss knife for you. Another presentation off this diagram I have showed you in the very beginning which will look something like this. So it is representing the same information, but with different diagram. Now let's go back to the topic and we will start our formal discussions. So far, we have seen that water model. We can say that our model is a set off related windows partial functionality that is grouped together as a convenient unit. Usually, we saved in a single directory by defining a set off related script files, assemblies and related resources. As a model, you can reference load, persist and share your court much easier than any other way. As I already mentioned about this, the sole purpose of model is to allow the model a radiation that enable us to reuse the court along with maintaining the abstraction. So here I wanted to tell you one thing, Once you install the model, so how our shell involvement come to know about this model is every level and you can use it and this will be done through environment variable off power shell. So how do we come to know about which part belongs to that particular environment? So to answer your question. Let's jump to the windows. Partial prompt Soto know about Reacher. The models is goingto be loaded within the memory from the given locate, we will use Bs model, part environment, variable. So how we can access that variable. So let's look into them to access it. What we need to do, we need to rate dollar e and we and they're the column on something called PS model used tab. So it will give us this thing just entered. Then you will find that it provided us this semicolon separated semi colon separated means these are there different, different part whenever we're launching, whether Windows Power Cell Command prompt or Windows integrated descriptor deter on that time, whatever the models, which is available in this part that will be loaded into the memory. So let's verify one off them. So let's look in tow This So let me open this one. So here you can see that we have these number of model seven level, which is being loaded into the memory, and let's go in tow, the windows partial integrated, a script editor and these are the functionality you will find over here like a Zarar. Um, so all these things are coming from these locations, so let's move further. No, let's discuss about why we use them to know. You can easily answer this question. Why we use partial model? Yes, exactly. It helps us to save the time. You just need to write it only once, and you can use it many times. The other benefit, which we will get from partial model. We just need to maintain the useful code in one place. One of the major benefit of partial model is you can easily extend and modify your function and all the script that use it immediately. Get the new features. Partial model Makes the Calling a Script More Readable One of the major benefit, which I feel like with partial model you can easily put your cord and share your court. So now let's discuss about more do components to hold us. This model is made up off. Basically, a model is made up for full basic component. 1st 1 is good finds were actually we rate the logic, and the second component is the additional assembly's health files or some of the descriptor file, which actually supports the main board file. The third component is the manifest find that actually keeps the information about meta data like who has offered this court fight? What is the world's? A number off the model. Worsening information is also kept in this manifest. Well, on the food component is a directory where all these components will reside. One thing I can tell you over here is that these components are ideal way to design a module, but it is not required. You can convert any screw ups one file to a model by just simply saving it as a PSM one file. Once you save with PSM one file, then it will be considered as model file. No, let's proceed folder and let's discuss of own model types. Basically, we have poor types of model, which we can design within Power ship. One of the mostly created model what I've built script model. Basically, a script model is a while that is a stored as dot B s, um 15 It basically contains valley windows. Partial called this type of model contained, basically functions variable pitch, actually actual building block off our shell model. And in this session, we're going toe majorly work with the script models. The second type of model is a binary model that is basically based upon dotnet framework assemblies that is dot deal. The binary model actually contains compiled cold off C sharp. If you compare with binary module with the script model, the command it created with a use off binary module is faster than compared toa commander it created with the user script model. This is one off the benefit. Another benefit off walking with binary model is If you're planning to design multi threaded commonly, then you must opt for binary models. Soto design or so to implement binary model, you must know not in a programming are proceeding for the no. We have manifest models, which is pretty much a straight for order. My nearest model is a model that uses a manifest fight to describe all of its company but doesn't have any sort off assembly or rescript where we can design our application level of logical. What type of model is dynamic model? So a dynamic model is a model that is not loaded from or saved to a file. Instead, what happened there created dynamically by your script using new model commander. The dynamic model enables a script to create a model on demand that doesn't need Toby loaded or saved toe Persistent storage as we do basically with the script model Binali model manifest models. That is not the case with the dynamic models. You can create it dynamically whenever you required. So, guys, enough off talks. Now, Now it's time to make our hand dirty and design some model with the help of the script models. So to make it very simple, what I'm going to do now, I will take the earlier example where we have designed to function. One is toe import the CS we and get the data from C S V and then another function which is taking that red data and giving us the formatted output. So this time I will take both this script and I will convert both the script as a model and we will use it to achieve the same functionality. Whatever we have at you with the help of functions dot sourcing. And now we're going to do the same thing with our shell model so that you can relate how all these concepts are related with each other, and that will give you a complete prospective work with partial these three points you can automatically come to know after finishing the demo. So, no, let's jump into the ourselves Scripting editors over here in tow. Arcila scripting editor and we're in tow the same function which we have designed in dot sourcing. So what we're going to do, we're going toe first, convert it into model file and to convert it to the model file, what we need to do, we need to save it as b A someone file. So let's do it now I'll save us. And here we need to specify BS someone. So that's it, then, for the same we can do with show See, is we data ps one find while say, with for this one also we can do the same thing. So we have created now model file. So how we can import it one little gene which I want to do here Is that so that we will confirm that it is loading from the model Just put I m over here am Yulia and just remove one about the same. We can do this one so Now we have converted. Appears one file to model file by saving it as not peace m one file. So not a question over here is how we're going to use this model so we can use this model by two ways. So let's look into first way and then we will discuss the second way. So to use this model legs jumping toe, the windows power shall command prompt. So we're into partial prompt. So know what we have to do. We can use a command lit gold import model and here we need to specify the location off the model. That is our tutorial in here. We're having power Shell demo. And within that we have dart sourcing. And within that we have a script over here and we need to import, read, sees we piece m one. Now we will use verbose so that become toe Know that how it has loaded. So just run it. So it has loaded get, um utf user in four. So it is into the memory. So let's use it. So get, um, Yuria user in four. And here we need to specify the part of the same part. We're going to you. Still here, grab the CSB. Do you remember that? And here we need to specify the seas we fight. Let's run it. Wait. Returned us this one. We can restore it into a variable. Let's store it in a valuable call toe gs three data on Copy this one so that we can use it with other models. So let's run it again. Check. See, is very ditto. So we have user names and email. So now import other models. So let's use the same one. And here this time we will use. So let's run it now. So it have imported show CIA's data? No, let's use it. So to use it, we can you show m u T A user defined function More deal user, different functions users And here we need to specify the variable which we really have a store. The data CSP data you You must be a real with this thing because we're using this from the function session and we have used the same thing in north sourcing so that you can understand the concept. Let's run it. So now here we have entered the formatted output. So it is working perfectly fine. There is no issue with it, but this is again. We need to write these number of command to install orsato. Would the custom command late into the memory Then only we are able to use this command linked in this way off importing. We need to specify the complete part that I don't think which is required. So it is better we can just call import hyphen model and the name of the model, then partial will import that model. So how we can achieve this. So here it comes the second way by which we can load the model into the memory. But prior to that, we need to creator directly with NPS mortal part location. If you remember that I have showed you the part or models where the actually script files for the model is residing. So let's look into that again. That is a variable cord environment. And we have PS model part if you run it so it will give us this What? What we need to do We need to create or directly within this location and where we need to keep the same name or their directory. Whichever the file name we're having for the model. For example, we need to create two folders. 1st 1 is read CS We, which will contain this fire rate, sees we don't be a someone on another folder we need to create with the name ups. Show these we data. And once we created this directory, we need Toe copy and Paste Thies to file in their respective folder. And then just we need to import model with the name of that folder. That's it. So let's do this now. So I'm into documents, Windows, partial model And here we will create two folder, the first folder we will create Read CSB where we can keep the model not be a someone file No, create another folder that is our show. CSB Data No, Let's copy the North Bs Someone final Let's copy and paste it over here. Nor do the same thing with show CSB data model Grab this one, copy it and paste it over here Now goto partial prompts or let's clear and no, let's straight to import the model would more dealing here. We need to you reach CS we This is our module name, so let's run it with the world war So it has loaded the same get em utf users. And for now we can import other model And he this time we will you show See is very data you can use verbose as well Let's run it So did the same thing I'll try toe execute the model again It will give us the same old So this time we're going to use get Amud of user in four and gravity no valuables Mediator And here we need to A specifying Fardart sourcing And this trying user info don't see Isra So we have this one. No show CS three date Honest. We need to show a Mulia And here we need to proceed later again running So it has given us this out to see you. This is what I wanted to demonstrate you over here. No, we don't need to specify the part because it is getting the information from the environment variable off partial And there we have kept to the model. So this is the location where more delis existing One thing you make sure that whenever you are creating or directory it must have the name off this file order with the filing With your keeping you can keep the same name then only it will. Looks like we have used reads he is we don't be a someone fight So the same directory will be created with the same name Same with the kids with you'll see as we data are moving for the So now we have seen the demo So we have also discussed a vault script model where we have learned about script Montealto script model We know that it is written in martial court We can write multiple function within this cripple But we have written only one and we have the script file as a moderate PSM one file extension And we have also performed this exercise where we have restored peace in one file with the same name as like directory . Or you can say that you have kept the same name for the directory Whatever the file name which you have used for model. Now the last point is over here is the model manifest which I wanted to show you one of the core demo. Actually you can say that that is a property file off models. So let's look in tow that So here I have created a manifest file model Manifest extension is dark PSD one file and this file contains information about modern. So let's just have a look what kind of information it contains. So the manifest file will look something like this. It contains information. Who is another? What is the company name the cooperate information and what this actually model will do. All these information you can maintain in the model manifest If you work with any manifest file Manifest file is nothing but metadata Information holder where we will maintain the information about models. So here you are also telling that which model it is being associated with that the reason you it is but the flying over here route model So we are using it for lead CS three Don't be s m one fine. So let's move further. So let's wrap the session now So we have understand water models way we use them. We have seen model components Then we have discussed about model type. We have also worked with the script models that is majorly of our shall we to design a custom model and at last we have seen more deal manifest where we have seen how we can maintain the property or the models. So I hope you enjoyed decisions in the next session till then, buh bye. Take care. 12. PowerShell Remoting: Hello, guys. Thanks for joining the session in this session. We're going to learn about partial Ra moting. Partial promoting is one of the important topic. So let's look into the topic. What are the topics we're going to discuss over here in this session? We're going to discuss about what? Its power. Shalrie Moting. Why do we need it? What is the security concern? How do we enable green arm? That is for Ramo Ting. Then we will directly jump in tow the exercises where we will perform these exercises. And with the help of these exercises, we will learn about how to invoke a man toe the remote machine. And then we will also learn about lessons within partial re moting. So let's to start our discussion now, but practice starting or former discussion. I wanted to ask you one question. Over here Suppose you are working for a growing business or say growing company as a system admin and currently we're managing only a single sober for that company. So to maintain the solo, the task is really very easy for you because you are managing a single sober where you need toe perform maintenance activities on a single soul, you know, suppose your company grows and the employees and the client off the companies also grown uto that the number of services also get increased. Now the number of silver is tell No, you tell me how you were going to manage tense over together. And you are the only sys admin whose responsibility is to maintain these tents overs. So you can imagine that suppose any patch update came for an operating system, Then you need to manually logging into each of the sober and judo pattern. Astonish. Isn't it really good if we have a mechanism by which we can connect programmatically through each of the sobo and run the patches? Yes. This is where Partial removing coming toe picture. So powers you're promoting enable us toe access remote machine across a network and retrieve data are execute code on one or many removed computers Here. I wanted to tell you one thing accessing remote computer is not a new thing. We were accessing the remote computer uglier as well. But the protocol which we were using was different, and that is not very efficient. Clear. We were using remote procedure call that is RPC for remote interaction on The problem with that is it has many different ports, and it is really very hard toe configure or no firewall so slowly. Microsoft is also moving away from our PC. That is remote procedure call. So you must be wondering, or you must be asking how this magic is happening now. So this is our next point of discussion that is architectural partial, removing Soto make you understand the architectural partially moting. I wanted to show you one diagram and then we will do their discussion there. So this is the current architecture off power shell promoting. If you closely look into the diagram, then you will find that at the bottom of the figure is your computer or more properly, you can see your point. This is where you physical is it and where you will in here, most off your promoting activities. Now there is a big arrow that is called the bluest man. Your computer will communicate via the bluest man protocol. This is an STP in STT PS based protocol that can encapsulate a variety of different communications. No one. The remote computer that is so bow windows, remote managements always Strunz. This service is configured toe have one or more listeners each. Listeners wait for incoming ws man traffic on a specific port, which is born toe a specific protocol that is STD pure as TPS and on a specific I P addresses Win. Artem uses a steep report 5985 and STT PS uses 5986 It doesn't use port eight to your four for three so that it will be not conflicting with other application. After that, when a listener receives traffic, the winner, Adams, always look to see which endpoint the traffic it meant for for our purposes. And then Point will use really be launching an instance of Windows Power Shell, impartial tome. And then point is also called a session configuration. This is because, in addition to launching partial, it can auto load the scripts and models, place restriction upon what can be done by the connecting users and apply additional session unspecific settings not mentioned here. So this is the way by which partial promoting will work. So no moving for the no. We understand that architecture of partial promoting so far, whatever the discussion, which we had no you can easily answer this question. Why do we need power? Shell remote? Yes, exactly. Power Shalrie Moting enables us to access remote machines so that we can execute cord on one or many remote computers. We will see all this in demo. Know enough of talk. Now let's jump into the partially scripting editor where we will learn about how to enable re moting and perform their demo exercises to learn about invoke common remote stations along with other aspects of our shell reporting. We're into Windows Integrated. The scripting editor? No, But prior to starting or demo, I just wanted to tell you about the set up of the machines for this demo. So for this demo, I'm using two computers. One is my host machine and another one is virtual sober. My host machine is having Windows 10 Enterprise Edition, and the virtues over is having windows over 2012 are to data center. So we will be performing all the exercises on this set up. So how do we enable promoting within the machine by default? It is enabled for windows over 2012 so it is enable for this machine. But if it is not enable. Then we need to use a commander cord enable I fund ps remote Things would just run the command. Enable be it's promoting around it and then press Yes, over here. So here. That's what it is telling that it is already being enabled for this machine. So it is asking You will hear that selected use remotely run windows partial command on this computer. So we will tell that Yes, over here So that we can pass the command toe this machine from the host machine? No, it is again asking for other type of operation that this power shell dot workflow So for this also we can mention Yes, you can limit that as well. It will again us And this time for partial 32. So we can tell years on this time It is asking for windows, not solar Manager will close. Just market. Yes, So that's it. So it is being enabled? No, we will go back toe the host machine And from there we will send the command which will run in tow This machine. But wait a minute. How do my host machine recognized this or say trust this machine so we must have to build a trust within the host machine. So let's grab Die people that so that we reduced this I p and we will build the trust. So clear it first on Ben Run I pecan freak. So it has given us this I p Let's grab this one. Just write it down or copy and let's go back to the host machine to do the configuration toe proof you the point without building the trust. You can't execute any command toe the remote machine. So let's try to execute a program which will get the event log from the remote machine. Let's write it. So we will do this with the help of command called Invoke Amant. And here we need to specify the computer name on the computer name is the I B, which we have grabbed toe piece that I p. And then afterwards we need toe execute something called script block and then we will run the command and here we will ask this command to get the event law so that will Veysel even information. Whatever, though event awkward for security, we're going to use the security and then we will select the forced tens will select object in here. We need to specify forced 10. So this command will run on Give us a thought. An event log for security. So let's run it this field. Why? Because the bluest man protocol doesn't trust toe this i p So we must have to build the trust between host and remote computer to execute any off the A script or say, cord toe the remote computer from the host computer. So let's do it now to build the trust we need to rate for Lincoln Man, but prayer toe setting of the trust I wanted to introduce a one concept of power cells that this piece, Dre partial, has various logical grave. If you will, I get Typhon Piers drive. Then it will give you various tape of grapes, which it is being distilled over here. Within that, we have a drive called the Lewis Man. So basically this try what it has. Let's look into that. So to check what it has, we need to write a less ws man and cologne and intern. So it returns a local host. So this is the location. You can try. Try this one. So now you can list like this local host and what it contends Check in tow that it has contained these informations. We're here. We need to go into the client. So what? It contends there. So it has contained something called frustrate hosts. So let's look in tow. That what? It has trusted hosts. So here, the trusted host value is nothing. So this is the place where we need to make an entry for remote machine. So how we can do that? We can use a command lit called set item, and then we need to specify appears drive on. Which location? Local host, client trusted host. And the value which we want to pass is the I p on the I p. I need to cooperate, cooperate it and placed it. No, here. We need to a specify the i p. And now press enter is telling Yes, no, Check that with it. This value came or not, we don't need to go with like this. We can directly use get item on the location off this one. So let's copy it. Free Street over here and run. So no. And in order to execute the command, which we have tried earlier. But it throws another. So let's straight will run that command as well. So this command, we have ran clear. And it's true that no pray to execute it. Now it feels again Why? Because we trusted the remote computer toe the host. But on with credence chill, This command will execute on remote machine. Soto make it working. We need to ask the credential as well. So to pass the credential, we need to create an object off. Get credentials. So credit equal toe, get credential. And now run it so it will ask for credential information. We need to specify the yes, training the domain name. This is the domain name. And here we need toe. Specify Administrator. This is they count which will execute the command. And here we need to specify the password now. Okay, Now past described Insel with the command. So here we need to specify there is something called credential, and we need to pause this object now, try to run it. So it has given us the top 10 log event for security from the remote machine. No, we can easily perform all these exercises so Let's do it one way. One. So in the first example, we have used the same thing to make it to order. Understandable. So let's lose some changes into the command which we have executed. So let's look into the command word, the command which we have written. If you were looking into this, then you will find that we are using a commander called Invoked Common that is being used to run the command within remote machine. And then we're specifying the computer name. Here we are desperate supplying the I P. And then we're passing the credential and they skip block, which we want to run. So this is the solution for exercise three. So how it is being solution First, I will describe the problem what the problem we were having. So if you will remove this curly braces and from here and put it over here so it will change the entire meaning off the command. So it is telling invoca Murn will goto this machine with this credential and it will execute the event log, whichever is having security and get all the data toe this machine. The data will come toe the host machine and then it will really filtering talk then. So this is the problem which is actually exercised to, and if you will run it, then it will take so much of time to see you. It is still executing and it haven't returned back over here, so it is still running. One thing you notice over here that the connection is being interrupted. Power cell actually give you flexibility to connect to the interrupted connection till four minutes. So that means it will keep trying till four minutes for making the Arce for establishing the connection. So you understand that what is the problem? So that is actually describing the exercise too. So that means the execution time is really high. So how we can resolve it, Execute this set off command, toe the remote machine and we will get the output that is stopped in records. So let's run it. So see you. How quick it Wasit returned. The talked and record very quickly compared toa what we have executed earlier. Why is it so? Because we are getting only the data back on all the execution happened. So the remote machine Why is it so? Because the communication which is happening within the machines is happening with the help of serial ideation and BC realization which is in maximal form. So that means date a c realizing toe facsimil when sent back Then d c realized back to the object in the local session moving toe the exercise for toehold You we can get all the process which is running on the remote computer. So it is pretty much a straight forward. We will use again the involved common and this time what? We're going to rule. So we need to write another commander called get process Andi executed. So it has given all the processes details which is running on remote machine. No moving toe the exercise five. So how do you come to know that how much time command is taking while execute? For example, home was tying our earlier exercise command has taken for execution. So to know that we can use there is a command let called maser common command and then we will run it Let's do it, run it so it will return the execution time information This is really very handy when you're working with production environment. No, let's proceed further and discuss about be assessing but tried to learning. PSS run organizations in partnership We have to understand that What is the problem with invoked? Come on. So to understand the problem of invoke Come on, I will write her invoke. Come on, State Mental that I will make you understand What is the problem within? Whoa, Come on. So let me write that. Better leverage the earlier this treatment and hear what we will do. We can remove everything to know for script block Here we will assign a variable Let's do it Will 200 Let's remove this measure. Command no running So it executed? No, if I will run this one So you must be thinking that it will return very value to us. Let's run it. It haven't returned that Really? Why? Because invoke common opens the connection or say open the session and execute the command and wants to finish the execution It will close decision. So that means if you try toe access the variable information which you have used in the earlier execution that it doesn't retain. So this is the problem off invoke common. So how do we can resolve this issue so to resolve this issue here, the PS session comes into the picture. So let's create a P a session. We will create the position with the help of new iPhone. Be a session. Come on, let's let's do it. We will create a variable gold I'm session and here we will specify your commonly called PS session and then we will need to specify the computer name. So we will take this entirely on, creased it over here now press center and this will create taxation variable and we will use with invoke amount. So let's write it again. So we will write it in work and then we need to a specify session. And here we need to specify the variable which we have created for session jam session and then we need toe bars again. We have created very equal 200. It's running now. Check that. Whether it is retaining the value or not, just remove it from the get go see year. It is returning 100. So that means it is resolving the issue which we have faced with invoked common, and we can resolve it with the session which we have created with PSS in decision Variable is not limited to executing the command. We can even import the model, which is not existing within the most machine. For example, our host machine doesn't have active directory installed over here. So if you try to run like import module and then you want toe add active directory than it will through error because it is not in start there. But our virtual machine is a domain controller machine and it has the active directly. And if he will pass the session, then it will have the capability to import the model off active director. So let's look into that. How we can do that import model. We can use the same, and this time we will pass the session variable year session on the variable, which we have created. I'm session. Let's run it. It is executing a year. It is loading active directory model. So getting all the command so it has included active director border. Let's confirm it. So get models get model Inter CEO, so it has included active directory. No, let's look into the amounts off these model water. The commands available. Get command now model active directory, Run it so it has given all the command we need. Toe work with active directory. See you. So let's try to execute some common trait toe get 80 user. So let's get a user. We will filter all on get member run it Throw their sorry for that Make you to run market So it has given us method information Were not the method being a have a level within this Commonly get high funny the user So we have all these method which is being every level within these commanded one thing you naughty fear I told you that whenever we are executing So it is using maximal cereal addition where the data is being serialized when it is being sent on When the output is coming it is being dcd late how it is conforming So see you It is mentioned that d c realized dot Microsoft not active directory Taut management not 80 user So it is a returned information from the virtual sober or remorse over where we are executing this command. Now let's do something interesting If you remember that we have performed the exercises in the Odier session Well, we were using or user in forced sees. We find that contained the information about users and their email, the same exercise we have followed in the function session start sourcing session as well as the modernisation. So we will use the same exercise and take it forward with promoting station as well. And here this time we will use the model which we have designed in our previous decision to read. The see is we fight for users and then we will create those users in the active directory within domain controller machine. Let's do that exercise. So we have designed a model called Reef Sees Be in our realization. Let's import that import more deal And here we need to call real disease we, which we have used created in order realization no use the method which we have created. So for that we will create a variable called CS Free data and here we will use the function which we have created. If you remember that it's our Amud, a user in four and here we need toe past the CIA's we fire information door that is coming from dart sourcing demo, and it contains this user in full. Dorsey is we? Let's run it. Now if we will see that sees we data, then we have uses name and email. No, we will create all these users in active directory off domain controller. So let's do it now. So how we can do that call the same thing which we have done Not lier. So let's right the court block. Let's copy this one way street over here and we will right here only. So let's right the completed script which we have already done. This one. So let's include this one control of me. And this is the sea is very data. Just control. See control. Now we need to write the script. So here what we need to do we need toe I to read the CS three data and create the new EDI users. So to do that, we will use for each group And here we will read the user on from the Isra data, then commanded Guard new 80 user And from here we will get the user that is users name which we are having this column. So we will lie to read that And there is other perimeter which we need to pause that is other attributes. And here we built Pastor meal, which is our dollar user dot email. So this will create users within active directly. So let's run it, save it. Let's run it, see what it is doing executed. So it is running. It's done the execution. So let's look into that whether it has created a user or not. To do that, we can get need to use this session or pit. And here we have specify, get your the user and executed. We need to specify all it haven't created the user. So I got that. What is happening over here? We are entering into a session and we're trying to access the variable, which is within the local host within this host computer, which it is not recognizing that then the reason it is telling that it is an empty value. So how we can fix that? So, first off, all we need to get rid off this thing the session, and instead we will use computer name. And here we need to pass the I p off that computer. So let's go pay it. And then we need to a specify the credentials. So let's get the object, president. And then here toe pause The local variable toe the remote session. We use an automatic variable cord E r G s. This is our automatic variable within power shell. So how we can pass the value within it, so we will pass it with argument list. And here we need to specify See, years we data which actually contains the value off the CSB point. And now we need to white to rate it. Let's also bring back the properties which we have removed earlier. So here, no trade to execute it and let's see whether it is creating users or not. So let's do it. Let's run it. So now it executed it. So let's look into that whether it created the 80 user or not. So let's run it past the old filter. So here, if we will check here, it has created user Johnny, which was in Mundi Max Sammy Elvis within our active directory. So if he will run this one CSP later than you will file Elvis, Sammy, Max Burundi. Johnny Same You were getting over here. Gianni Morandi, Max, Sammy and Elvis. So see how beautiful it is You can automate anything with help off re moting. So this is what I wanted to demonstrate in this remote ing station. I hope you in your decisions. I'm a stopping the station over here saying next session. Tilden Bob, I take here.