for uh who are looking the job who are part of the system administrator and it would it would uh help you to know get the job to have the multi skills. Today agenda is we will talk about the what is powershell why we need it and where we need to use a powershell and windows powershell command and syntax. I'll make you two very simple lemon uh simple lemon language and to easy to understand. Basically, you would need to understand the concept of the PowerShell and uh the formula of the PowerShell, the logic of the PowerShell. You need to understand
it. You don't need to have anything programming skill or any you know uh other uh scripting knowledge you don't require. Just we need to know that how we need. Okay guys, can you go in mute please? uh okay so guys please go and mute if you have any question you can uh please feel free to raise your hand then you can ask the questions and uh yeah so basically it's the most important to understand this powershell when you know the fundamental of the powershell you can manage for anything automation can be managed uh Azure can be managed window server can be managed office 65 anything can be done right so we will talk about a couple of demo session and PowerShell script and use cases. We would also talk
about the comparison with other automation tool called Python, Anible and PowerShell. All right. So basically you know that we need a PowerShell. Why we need a PowerShell right? PowerShell is a command line command line shell and scripting language. Right? Primarily it
is designed for system administrator in Windows environment. It provides a command line interface where users can execute the command perform administrative task and automated task. Usually we are using for the PowerShell for all the repetitive job reduce the manual work right the reporting part so very much needed it's a mandatory have a skills for every administrator to manage our environment automate the things wherever we needed right when we talk about the automation powershell allows the automations of a repetitive task making it easier to manage and maintain system scripts can be created to perform tasks such as system configuration file management anything you wanted to have the reporting quickly, it will be give a you know one single line command let command uh script you would be able to you know help for make things faster right and uh reporting part we would need ultimately the goal is to saving a time and reduce reducing the human error so first most important it is we are using that powershell everywhere right in a most of the cases windows platform right Microsoft windows platform. So it's extensively used for the various scenarios especially within Windowscentric and where is the Microsoft product right we have the uh windows servers active diretory 65 cloud services secm networking database VMware most of the cases 90% of the powershell would be using for the all the windows product which is Microsoft you can use the SQL database right you can use for the office 65 exchange environment wherever uh we are doing for the manual work we are uh you know check getting more uh time taking time then we we need to have the powershell scripting to things to make automate so every administrator must use a powershell yes it is required for the automation no matter what administrator we are backup administrator server administrator VMware active directory security cloud database things to make automate we would need for the powershell and uh we need to make things to automate for all the environment right but once you understood the powershell you can make anything any of the technology we can make automate so you don't need to have a specifically learn for the azure powershell or cloud powershell or activator powershell no you need to understand the powershell first then this will be applicable for the everywhere that's the logic right so basically we need to understand that is in say for example Now we need to to understand this of the PowerShell the terminology we can say this commandlet right the powershell we're using we we know that everyone using the command prompts right in powershell we are using for commandlet we call as a commandlet right in this commandlet we have the default operating system commandlet we have the by default commandlet in our operating system, right? And this commandlet has the verb and non format. It's a very simple non format. What do you mean by word by non format? Here for example, it's a get hyphen command, right? This is a command, right? Get is a verb and command is non format and we need to use for always a commanded for the hyphen. So you need to
connect between these two word by non format with hyphen. So first most important we need to know that is in commandlet and once a commandlet understood what is a commandlet it is getting then each command l each command l we have a default parameter we have a default default parameter. So what you mean by this? We need to understand this logic. What is that logic here? Simple method. First any requirement is come to you. Find the
commandlet and second one is find the relevant parameter. So what you mean by parameter here? To understand this parameter again we can ask the powershell help right. the PowerShell can can ask the help. So every each commandlet each commandlet to get full information full information we can ask we can ask help to powershell. So how do you ask the PowerShell to help these two things is very much important. If you are not
getting the full information. If we are not getting full information of commandlet then we need to update our help. The commandlet use called as update help. So before we talk
about this commandlet basically we have the four type of console. Four type of powershell console. Number one is PowerShell direct console which is x86 and 64bit. Number two, PowerShell direct
console. It's a 64-bit, right? And uh third one is PowerShell is integrated script extension. It is 32bit which is x86 and fourth one is same powershell IC console it's a 64bit if you see uh go to the start you can open your scroll down you have the powershell folder here right you would be able to see these four type of console one is direct console which is 64-bit x86 This is a 32-bit. Both are direct console. It is 64-bit ISC integrated script extension and it is 32-bit x86. So if you open the direct
console first most if I need to find the commandlet right if is as I said it is a myshell command. If I wanted to see this how many commandlet are there is a word by non format you can find how many commandlet are there in my default operating system the commandlet called as a get- command okay so if you type in your operating system also you would get these kind of commandlets by default it would be differ depends on the operating system versions maybe windows 10 windows 11 or server operating system you would be able to get these many commandlet list of the command you will get it right included if any additional modules installed in your operating system those are also it will be updated here. So if I ask to powershell how many total command are there how many commandlet count are there you can also check it and maybe you can also parallely check in your uh operating system type get hyphen command you can able to find you know how many commandlets are there these are all default uh operating system commandlet in my operating system I have installed couple of modules along with that you would be getting these if I ask my powershell uh how many commandlet are there default in my operating system. If I ask count okay around 8,266 command L in my operating system right included I have installed a couple of modules those commandlets also be available here. The first step you need to understand how many command are there. So take one example. If I need to find
in my operating system, I need to get the service related service related commandlet. I don't know the commandlet. How do I find it? How do I find it? I'm very new to the PowerShell and uh I need to get the service related commandlet. So what we need to do the simple method we have already command get hyphen command right and we can search when you talk about search we would be using in a powershell wild card entry wild card which is you are using for the star right so this star indicate we call as a wild card for searching it means I am searching in this command which is the what we are looking service related. You just ask the PowerShell service and star. So there will be different
methodology or different uh uh criteria for wild card you are going to use. If you use the both the side star it would give you the design everything wherever it is find the service it would give the result. If you give that initial meaning you know you know in beginning with the star and text and uh text with the end star there's a different meaning as you're using for that is in both the side star it is a wild card process right it's a end with start with and containing everything so now I wanted to find it service related command I don't know the command right always you need to go with this process ask get- command all the command are there in this I wanted to find the right command for this right so if I ask the powershell here get hyphen command it's all the command askshell use this wild card which is star and service right you would be getting for the many things so there is a relevant command that you can use that is in uh which is common with the get one right get star services you see the get hyphen services is a command We got it.
As I said, once you identify the commandlet, we need to get the full information of this commandlet. How do I start? How do I use it? To understand this, we need to ask PowerShell to help, right? So for that you would be using get hyphen help and get hyphen service. So why we need to know this? Because we need to make a a frame it. We need to ask PowerShell uh if any of the service specific get that is in uh you know get the win rm service status right how it's what it is status win rm service I need to check it how do I use it always the format is commandlet and a parameter command let parameter to find this we need to ask powershell gety- help and get- command so I need to get this full information get- help and get hyphen service. So you see here the most
important the heart of the powershell 70% of powershell you would be able to understanding in this once you know this concept of getting information of help when you type get- help and get service is a relevant command you would get a full information this is called as a full information what do you mean by full information you would get that synapsis what is this definition of this and most important syntax. Here is the completely your PowerShell commandlet to how to use it. Always you see this commandlet there is a start with hyphen. This is called as a parameter and this is called as a parameter. This is called as a parameter. This is called as a
parameter. So always it is a relevant each commandlet it would give you the information what and how you need to be frame it this powershell along with the syntax it would give the description and some related links some example also if you're not getting this kind of information it is not getting a full information then it must be update in your powershell you should update the your repository powershell console to run this command which is called update hyphen help. This two things need very much important to run this beginning. Remember this point anything you wanted to begin with the PowerShell your console your PowerShell console must be up to date because we need to get the full information of any command that you ask the PowerShell it should give this complete syntax. Syntax means what? All the the parameter default parameter you it would give the details.
So if you are typing in your parallel in your system please check get hyphen help and get hyphen service. If it is not giving the full information this error you can ignore it. Uh it is a known issues ultimately I have already updated and I'm getting this full information. So if you're not getting the full information you have to type your update help. So once you run this
update hyphen help your commandlet should give this full information which is now always remember every commandlet it would give that default parameter so now that default parameter get service hyphen name and the reason when I'm talking about winrm so another important each parameter each parameter it's It's demanding to demanding to enter the values and those values are different type of values. Different type of values. Values means what? It's a data type. You call as data type. So these data type are different. Number one is might be it is asking you data type is string value and this data type might be value is asking for the integer and this data type might be asking for date and time. What do you mean by this? Here the
PowerShell itself is giving us what you need to enter. You see commandlet parameter system dot string there is this parameter demanding to enter the string value you need to enter the string computer name right hyphen display name system dot string right and hyphen name system dot string which is get hyphen service command let hyphen name is the parameter and I'm asking for the win rm I need this is my string value so what you looking it should be match with the parameter values what it's asking now see this it's giving you here and same things every command let every command let it would give you every command let every command it will give the result result along with the header. Along with the header header means what? You see here status name and display name. Now I wanted to find I need to another goal if you talk about if you see get hyphen service here get hyphen service only one command it would give that all the services information right it will give the all the service information. Now the requirement is I would like to check I would like to check services whichever display name start with Windows. Right. The requirement is goal is get the service display name display name start with Windows. Now here most important as
I said any requirement you get it first find the command find the parameter then frame it. So very simple we know that is in we are talking about the services there's a command called as a get hyphen service and we are talking about the display name does that display name has a parameter default parameter get hyphen help get hyphen service we have the display name right so remember display name we are using we should use for the when we talk about the start width we should Use the wild card, right? This is end with. When you use the star beginning, it would be end with. This is start with start with and it is a contain just some formula we need to just understand this here contain. So we
are asking here start with how do I use it parameters? What is the display name? And I need to frame it. Get hyphen service hyphen display name. And I ask the start with. So I should use for the star windows, right? Windows star start with let's see I'm getting result or not. Get hyphen service is a service is a uh commandlet hyphen display name is my parameter and wild card you can say windows star can I get it here display name all start with window you see this start with windows very simple right always we need to make it formula what is our requirement you need to frame you need to get the commandlet you need to find the relevant parameter and this parameter is demanding to enter the string value you are getting the windows now same things if I wanted to get get the another goal is third we need to get uh windows system event log we need to get the system event log Right. How do you get what would be the command L? How do I get for my event log? Anyone has any question? Someone raise help.
Uh yes sir. Uh sir uh actually I want to ask like uh uh you mentioned the parameter right like display name. So is it case sensitive like uh you have got the name? You can you can directly type when you type the type the tab automatically it will be corrected. So when you type here normally say for example it is not a case and just you can say I'm getting uh small letter the moment you press the tab automatically get corrected. See this right and you can make it very simple the ultimately that parameter is there you just type automatically press the tab you will be getting this right and type here whatever you need is not you can set you can you will get it. Okay. All right sir. So is it the part of bash like uh
in Unix or Linux uh we use bash no no no this is separate powershell some of the command it won't work that is it's not a batch okay okay all okay okay yeah thank you sir so now another requirement you so anyone can frame it okay I would need windows system event log I would need windows system event log this is event viewer I don't want to go uh manually check the event log I would need for there is event log called as a system event lock. So find the commandlet and find the parameter and frame it. How do you do that? Now to find the event log, you know that already. How do I find it? Get
hyphen command. I would ask the powershell event log. Correct? Event log. Please provide me the right commandlet. Can I get the event log?
Here you can see this. I'm getting the event log. The command is get hyphen event log. Correct. Now we got the commandlet here. Now how do I find the
parameter? Get - help and my commandlet. Now get hyphen help and get hyphen event log. Now what is my requirement here? As I asked here get the windows log name is log name called system event log. Now how do I frame it? Now can you find it here? My relevant parameters there here. My relevant parameters there. Get
hyphen event log. What would be the parameter? What would be the parameter? Computer name. No, I would need I would need Windows log name called system event log. Please think and answer. There is information already available here. There is a command. What would be the parameter relevant parameter? Please read the syntax. Log
name. Perfect. Log name. Log name. I'm looking for the system. What is it demanding here? String value. So I should be using system very simple. I'm getting this all the system log. Now I would
need I would need system log need only error log only error log. Can I see this information available for the parameter? Do we have the relevant parameter and uh I can get the only error log. First you need to read the syntax. Always you need to read the syntax. I have the get - event
log commandlet parameter log name and I type the system entry type would be the end we will mention error. Perfect. So my commandlet is entry type entry type and I'm looking for the error. That's it. See this I'm getting all the error
log here. Now I would need I would need for this error log latest 20 log. I don't need all the logs latest 20 log. Same things just see this can able to find it my relevant parameter in my get - event log can you frame it get event log we will use uh the newest command I think perfect log name system hyphen entry type error and hyphen newest that's it hyphen newest and you see Here as I said every parameter it's demanding to enter the value what type of data type is asking and where is the newest here it's a newest what is the demanding here it's asking integer integer right it means you need to enter the value that is number only you cannot enter the string value and here it is asking you to the string value you cannot enter the number here so that is the that is important here wherever this parameter demanding to asking you to enter the string. You have to enter the string and wherever this parameter demanding the it will give you it will give the hint. It will give the it will asking you to you need to enter the this kind of data type only right now see you would be getting latest 20 now see this latest 20 you got it same event log system entry type is error and I'm getting type I'm getting for only 20 logs and again I would need for specific date mentioned specific date I would need for the log latest 20 log from last week to till today last week what would be the date here last week is uh 13th right 13th April I would need the log okay specific date the date is uh 13th April 20252 till today. It
means you need to mention the date, right? So, do you have the date parameter here? Do you have the date here? Do you have the parameter relevant parameter? You have the Yes. Before after you see this, it is this parameter demanding to enter the date. This parameter entering to the data types is date. Now I have this all I'm looking for this after what was the date here mm this date format is taking you uh 04 uh 13 2025 and before parameter and today's date which is 04 mm dd y 20 2025 correct now see this we're getting the date here. So the understanding here command let parameter it's demanding the string value parameter demanding the string value parameter demanding the integer value parameter date values. So this is
the first step to understand to begin your journey any commandlet you wanted to find that relevant parameter you should ask the help and you should get it. Is that easy method? Yes or no? Yeah one question. Yeah go ahead. Yeah that in parameter if
you go to the command how about the newest from where you got that newest parameter? newest parameter here only you see here newest parameter here and it's asking you integer okay suppose if you want uh the uh we don't need the newest one we need okay older one means then we have to give before yeah no no date now newest means what I asked that number of how many logs you would need it so newest is it's not a date if you don't want is and you wanted to have only dates previous date till today you would be getting all the information you're not mentioning first 202 I would need only first five then it would give only five logs this was asking for the only latest 20 I asked latest 20 means only first latest 20 log it would give you that's how yeah if you want the last 20 logs means huh that's the last 20 locks only last 20 minutes means you can you can uh you you need for the older one you're saying correct correct from from below from bottom 20 right now you would be getting for the date right so you would be getting the latest log but you do not have that is in old log but old log you want to find out you can mention the date which date you wanted to be looking for older date which date sorry which date you are you are getting older date you can mention it hyphen You don't have the parameter called old like how you have the newest like this same you don't see this hyphen old right correct correct that that parameter won't there but now same things I would ask here same continue with this you see this get hyphen service right get hyphen service now what would be the result you are getting here get hyphen service we are getting I would need Whatever services are running, whatever services are running, those informations I need it right goal is goal is please get the all the services which are only running. How do I frame it? How do I frame it? You know the what is the command L? Find the command L. Correct. What is the command L? You know that already. Get hyphen service, right? And what would be the relevant parameter? Find the parameter and frame it. Anyone try with
this? It's uh hyphen status running. Okay. Get hyphen service hyphen status running is it right one star. Okay. Your star where you using here
star both the side say star first one first starting right. Okay. Remember always when you use a star if I said something start with end with or contain then you would use the star. If I tell you something start with, end with or contain something I said then if the requirement getting like that then you would use a star but anyway you are saying that star both the side. How about others? Is that right? Is that right? Commandlet in the last one. And only last. Only last. Okay. Okay.
Okay. Is that right? Shall I enter? Yes, please. Let's see. Please read this red color comment. Red color error carefully.
Parameter is status not found. Parameter is wrong. Status. So after reading this you understood this is not right. Does this status is a part of parameter? No it is not actually.
How do I check it? Get help get service command. Can I see the status here? Can I see the status parameter here? Computer name is there. Display name is there. Exclude is there. Include is there. Computer name exclude. Right? Name is there. No.
Right. Remember one more important if requirement requirement the required parameter is not part of under default parameter. So we need to find that. So we must use we must use pipeline operator. Okay. We must choose a pipeline operator. Then how to find how to find all the default all the how to find each command each command all the properties or header or parameter to know that is in what is the relevant header then you should use get hyphen service pipeline operator format at list to find the relevant one right format list some of this default parameter it is not there I wanted to find the all the properties you need to ask this command get hyphen service and I would ask for the format list with a star it would give this is all the information now we are looking for the status right do we have the status Here do we have the status? Yes, we have the status here. Right? So, how
do we use it? As I said, certain parameter is not part of under the default parameter. We would use a pipeline. So we'll talk about next when you guys are admit you know registered uh the course registered this would be using like this get hyphen service pipeline operator where hyphen object okay dollar dot we'll talk about you know this more detail equal to running we'll discuss this and I'll I'll make you to I'll explain you that piece by piece we'll divide this all the information and I'll make you to understand how it works.
Okay, you can just copy paste it here. Get hyphen service pipeline operator where hyphen object dollar dot status equal to running. We are looking for the only running services. series you're getting all the running services right there are many logic we need to understand these are the logic you would need it right so we would be talking about towards our journey the syllabus is in under our website you can just go through here uh if you courses if you go to this automation windows powershell and you would be able to see this I'm making sure you that is after four classes you would be able to write a script guaranteed right you would be able to write the script. We need to understand
the how the pipeline works, how the syntax works, right? Variables, data types and looping statement and uh what are the security remote management and uh looping statement for each uh if else statement function module and error handling all these things. Ultimately this course is make you to understand to begin your journey with the PowerShell.
2025-04-26 18:30