Learn PowerShell From Scratch | Activate Windows PowerShell | Powershell Zero To hero 2024 |
so everyone know that you know Powershell how important this Powershell is a made uh for administrator it's a it's a specifically dedicated for administrator from the Microsoft tool is a Powershell command line shell and scripting language primarily designed for the system administrators we have the day-to-day operations activity right for the reporting part repeatedly uh we are doing the manual work right so we are spending lot of money uh sorry lot of time on that which is uh spending repeated work right so we would think about to potentially effectively how put our effort in our current you know working on project so everyone are thinking about the same how effectively working so out of the box we need to think about how we can plan for the automation so when we do the automation we must have a knowledge on the specific Microsoft product this poers shell is a Microsoft product right so how if you know the Microsoft product called mic Powershell you can think about wherever we need we need to implement an automation right so is a primary designed for system administrator in Windows environment it provides a command line interface where users can execute commands perform administrative task and automate task using script right small small command light you can make you know multiple lines that is called a script we would be talking about some practically in the couple of minutes so when we talk about automation right Powershell allows the automations of repeated task yes as I said if you think about in a project if manually putting effort which is taking long time and you doing the same work yes it is Implement by automations right making it easier to manage and maintain systems script can be created to perform such as in a system configuration file management user management reporting suddenly if you are running in a P1 ticket and people are asking for in the call in a bridge call okay I need a one single folder specific name on a 100 machine we can't go and log in individual machine 100 machine create a fold in the next 5 minute not possible but this powerwell automation yes next 2 minute can create a folder on all 100 machines which is ultimately goal is Saving Time and reducing the human error right how we want it it is no matter which technology you are but when we talk about automation you have to learn these Technologies if you are demanding a more package you are expecting to change your know career path currently what you're working and uh growing your career yes this profal is very much needed it's a mandatory to have a additional skill with every it employees and it it uh who are working on it it it is a mandatory right it is it's a uh we need to have our career path then only you can expect more package then we will be think about okay how we can do our day-to-day work with the easier manner so Powers shell is extensively used for the various scenarios right especially within Windows Centric environment is it's more earlier it it was made for the windows environment actually for the Microsoft product now Microsoft is also be crossplatform it can be run from the you know cross Opera system cross platform you call as you can run this Powershell Mac uh operating system you can run this Powershell on Unix Linux operating system as well so earlier it was not that much of compatible now they have made for the 7.1 with the crossplatform so as I said this would be a supporting system administration which is who are windows servers active directory office 65 cloud services Microsoft Azure deployment configuration secm networking database VMR so what else no matter what technology you are working in terms of when you come to the automation yes you would need Powershell right every administrator must use Powershell for automation yes you are backup Administration yes you need a Powershell server Administration you need a PO shell VMR admin active territory security admin Cloud admin database ad storage admin no matter how many administrator you are and what technology are supporting the centralized power shell is needed is a mandatory for automation right so where we need to use a Powershell right it's all it's inbuilt Powershell tool operative system Microsoft operating system is inbuilt inbuilt inbuilt uh console we can have uh you know existing operative system have a console right you have the direct console and uh ISC console which is integrated script uh extension so there you can uh uh know create a script so when you talk about the use cases as I said you want to create a folder in multiple server you want to change some register setting something you deploy the patch due to that patch it's uh know few servers went uh uh turn up because of the reg setting is made changes so that time you want to reward back immediately identified that is that was done that was you know due to this patch is impacted my servers and all are went turn off and I need to implement immediately manually it is highly impossible again it just take longer time production impact we can reduce with the help of the automation remove disabled users from specific groups is also part of the active territory move disabled users in OU create a VM you know you can also talk about aure Cloud environment you know one of the region right so when you talk about the begin journey of this power shell these are till we discussed about till not discussed about what are the importance of the powers shell right so actually want to start my journey to on power shell what do I think about I'm totally fresher or I'm totally new to this environment how do I start how do I begin it so first most important you need to know that you know this Powers shell is a a command L structure right so command structure means what when you go to the powers shell for example as I said uh when you click on the Powershell you see this there are four console okay uh you can go with the like that you can click on the Windows icon then go to the Powershell folder Windows Powershell you see this there are four console 1 2 3 4 so first and three is first and second is a direct console and first first is a 64bit second is a 32bit x x86 indicate is a 32bit so both are direct console second one is window third one is Windows Powershell ISC and windows Powershell ISC x86 so they Microsoft they put still in a 32-bit console because it started PO is a 2.0 1.0 version so it means it's a 32-bit operative system if we have a script 32-bit operating system then you wanted to check now that compatibilities must be needed so hence Microsoft is keeping the still 32-bit uh you know architecture of a script mechanism you wanted to support Depo so usually currently we are using for 64bit direct console 64bit in a ISC ISC is a script mode if I click on this Windows Powers shell console direct console it would come the direct console okay so when you type any Command right it will execute it immediately you don't have any options to edit it when you executed that's all so you wanted to do something say for example get hyphen command then when you hit enter it's executed you don't have any options to go back and edit for this it's a direct same things uh if you go to the ISC console which is integrated script it is a script console okay so Powershell this is a integrated script we can also exchange a you can you can also call as a environment integrated script environment see this it will help to know write the Powershell script if you know the Familiar of this script you know one by one line line and you can put your console here in the top to bottom we can we call as a script pain right this is uh script pain top bottom and you can see this left right you can see the full screen and it will be how you wanted to be have a you know comfort you can you can plan it right so you will have the line by line right say I have the get hyphen Command right and get hyphen Services right and uh get Hy process it will execute it so you wanted to do some some changes yes you can do it here so if you know the multiple lines of the command L you can execute as a script right if you see executed and all you can also select one by one so you can click on the cursor you can use this selection right use selection it will going to execute it for the first one only so like that you can go to check your script one by one so that is a benefit for the ISC for the learner can use for direct console right so this would be helping to the people right now see this now second one also you can go and check it it will be going to run here right there is a first most important here console right in a Powershell you have the four type of let's have a 4 0 to 24 okay so in Powershell you can the first you have that is four type of console okay so number one is direct console which is 64bit by default second one is second one is also direct console this is 64bit this is 32bit and uh third one is ISC Powershell ISC console integrated script this is 64bit and fourth one is Parell ISC which is x86 okay when I talk about 32 it shows as x86 okay x86 this is first very basic L you should understand that now when you open the console right how do I start my journey in Powers shell I don't know anything about it right so first most important we called in a Powershell in Powershell the terminology called as command let okay remember the terminology called as a command Le always in I think you know that is in command prompt we call as a commands right you have used for our day-to-day operations activity something services.msc ip config like that right in Powershell we call as a command light so always this command light in a warb known format or by non format so what do you mean by the war by non format it should be say for example I need to see that I need to check how many commands are commands are there in Powershell the default command would be get hyphen command okay the get is a verb and command is a noun format okay always it's a pair okay oh now when you find this always you need to remember each requ requirement first most find what is the command L you need to find the what is the command l once you got to know the command L each command L you have parameter okay remember this is how we need to learn this is how we need to understand that the commandlet you can identify and once you identify the command l you can find that is in what are the parameters and we will talk about how do you find the parameter okay how to find it to find it you can ask Powershell ask Powershell which is called as a help right so that is command called as a get hyphen help so you can ask for one of the command L if you're talking about services like that so before you going to begin with this the first most important again your Powershell console must up to date or you can update up to date to do that you have to run for command called as a update hyphen help so you wanted to see the full information of commandlet so why we need to run the update hyphen help because we need to see we need to see that full information of full information of each command l so I don't know that anything but I need you to have a more detail on that what are the parameter information means what information means so what is it for this command it what are the command what are the parameters are there right and and uh some examples this this details has to be provided by help right this is a very very very basic things very very first step to be identified no matter you are a script writer going to be in a you know few after few days once you class started but these are the begins always remember you need to find the you got the requirement find the command L what is the command l each command L you need to find that what are the parameters how to find it you can ask the help but how to do that okay so now as I said I need to find the example if you take I need uh okay Services Information Services information of my laptop or my system so I don't know that command L I don't know the command L of services how do I find it so the the the first one is what you need to do go to the Powershell just find the get hyphen command this is the firstmost command once you run this Command right it will give the all the commands all the command let right but in this command let how what is my related command it here how do I find it to find what you can do get hyphen command is already there right in this I wanted to check I needed to find y my related so very simple you can say star service star service so you know the star is a star is a wild card in a Powers shell right Wild Card why we are using this wild card you know that in whenever you want to search our files and folder on a particular folder we use this star you might have remember right so it means there is again star indicate with the uh different uh you know parameter or you can say star is Define a type of way if you put text start with start with the text right start with the text it means it is end you are finding the text in end right and uh with the text end you can finding the text is text is start with okay start with it is end with and this is start with there is a defined role actually right and if you go with the both the star text then it is finding wherever okay wherever no matter where wherever it is it should get your result right so these are the three way to you can find the text right like that I wanted to find my command related service how do I find it now we got to know that how many commands are command letter are there in my system to find out to find out you can uh go to the into the bracket and just type here do count right do count you can also check it prior who are already in this you know session you wanted to check from your uh console Powershell console you can Planet see this how many uh command letter are there it will be a depends on what are the modules you have installed I have installed multiple modules on my system it shows as a 10,760 you might see that is in very less because you not installed uh multiple modules because I have installed Cloud related hyperv related I have installed it so that's what it shows 10,760 this is a simple example I have a these many command leg so in this I wanted to check my service related I need to check my service related command L how do I find it I don't know the command L to find get hyphen Ser get hyphen command and I wanted to find service in on that command L right it's a very simple if I hit enter it will give you that is this many more Command right but still I don't want to search again in this it's a little more smarter way I need to find it so you can search way this way get hyphen command get is a common always right you can put service right and star so it's a very simple see here get hyphen service get hyphen command get hyphen command get is a common star service with star right see this you got the command relevant now this is my command I found it get hyphen service perfect see now guy got this detail right but I wanted to find the command you got it for what is the command you are going to use it now get hyphen get hyphen service get service this is a command let right but I wanted to check uh winrm service status service status how do I use it I don't know okay what are the parameters and uh how do I find the parameters as just said you need to find the ask the powers shell to the help to do that you need to run this update hyphen help to update your repository I have already ran my uh poal console here this is already up to date but you can directly check with us so this is a command L I don't know the command L of the helper right so how do I find it get hyphen command I can say get star help I don't know that is in command let see I got the right information right command L now I got the get hyphen help so get hyphen help and geten service I am asking to the Powershell give me the full information of power of this getan service I wanted to do something I wanted to check my vrm services status right I'm very much begins I don't know anything about later I wanted to know that couple of things on command letter right if you see it will give the is full information as I said full information of the command letter the help see this is the most important whenever whenever you run this getif help and command it will give you your service related information what is it name synapsis get the service on local or remote computer the most of important heart of the poers shell you must learn in the syntax syntax it will give you the complete information of parameter where you see this in hyphen computer name hyphen dependency Services hyphen display name iph exclude wherever you see The Hyphen that is called parameter your parameter find under the syntax right so when you are asking help asking help to the Powershell the command is get hyphen help geten help and get hyphen service now same things if it give the full information right full information in this the most important is syntax syntax it will tell us it will give us information information the parameter right parameter the wherever you see this parameter with this parameter is okay the indicate with the hyphen so wherever you see this indicate The Hyphen you can find that is in parameter again each parameter each parameter demanding to supply the value demanding the value Supply the value value Supply the input input what your requirement it means your parameter is a hyphen computer name what is the what is the input is demanding right it will might be ask you a string it might be ask in a integer it might be asking in a date and time what do you mean by this if it is your parameter it says a string then it is asking you either text or word the relevant you cannot enter with with without this right integer means it's a always number and date and time specifically date and time how do I find it these how do I find it this every parameter it will give you the information see this get hyphen service hyphen computer name parameter and system do string it means it's it's demanding to enter the value which is string you can you can provide your computer name hyphen dependency service is a parameter hyphen display name again it a demanding the string right always remember parameter each parameter it is asking you to enter the input that input what kind of value this will tell you string means that depends on what is that relevant display name text or word it information right and some of the parameter demands for the number some of the some of the parameters are demands for the uh number means integer right and some of the parameter demands for the date and time how we can check it same things can I get and again you can see this Rel related links information right and some remarks which is example I don't know that what are those if you go and check it this is the purpose you need for the help right if I go to the get hyphen help and get and services and with example it will give you the with example right so see this the example is giving you how you wanted to type what you need to do right see this so slowly you can start learning here right so I wanted to find the network related uh display name Network related see this I wanted to find that is in specific win related right as I said the star they put into the end it means it means start with Windows and exclude winrm apart from this I need these all information so these are all it will help you to understand how I can use it get high hyphen computer name the computer name right so begin with this the formula is first most important first most important based on the requirement first get the command let command let ask help to get information get more information of command onlet how to do that which is get hyphen help get hyphen service example and uh in this find the in syntax where we can see the parameter and each parameter identified we start with hyphen and each parameter give giving information each parameter need okay need you need to enter the input enter the input the inputs are required some values it's a demanding values what are those values it might be a string it might be a integer it might be a date and time this is a very very basic things we need a formula of a commanded I mean Powers shell so now if I talk about if I need to check with another use cases uh okay let me just save this file it is January February okay demo session you can say demo notes okay so now I need event log need to find all event log Event Viewer logs we were logs how do I find it what is the command let I don't know that uh command let first get hyphen command command right and inside that very simple you can use a wild card right Smart Way get start Event Event log right just see can be able to find it or not CS get hyphen command Star first you can use a get star get I can use for event log correct see I got the command L what is the command L here the command L is get hyphen event log then I need to find the parameter to find the parameter what do we do that we can ask the power shell to help yes get iph help and get hyphen Event Viewer event log see now it is giving result when you ask the help you must concentrate on syntax so in this syntax you see this get hyphen event log hyphen log name is a parameter it's demanding the supply the value is string now here you can see hyphen instance ID is a parameter system. integer see here it means it is demanding a number it is not uh demanding a string see this when you supply the value as a string it won't take it it must it is mandat to enter the number only and here you can see that hyphen off is a parameter and it is demanding date and time right hyphen uh before this is demanding for the date and time and one more again computer name is demanding to the string right entry type these are all default values name okay this parameter of the error log again you see this integer 32 number right so seeing this all by syntax help need it now I need I need just see the event log what are the event log you are getting event get hyphen event log get hyphen event log event log now what is the parameter here you're looking here the log name so take the example now I need I need to I need to check all the system log details I'm saying system log details when you open the Event Viewer right Event Viewer in your system right and if you go to the Event Viewer you need you will not be opening directly to the Event Viewer logs right you need to go to the windows lock first then you can select the system then you can see the locks details right you see this all the information about here correct same things I wanted to check from Powershell how it is going to be you need to tell get hyen event log log name is hyphen log name is system you need to type the system hyphen log name is the value the string value is either you can type uh security either you can type application it is you need to provide the input as a value as a system say for example now get hyon event log get hyon event log get hyphen event log log how do you how do you got to know that you can just find it get hyphen help get hyphen Ser uh event log right that is a command L event log now we got to know these are the parameters right see this get hyphen event log hyphen log name and I need to supply the value string so system is a my string value get hyphen event log when you press the tab automatically your command let get detected okay log name is my parameter then I need a system log this is my I'm supplying the value I'm supplying the input right this is the string value so hit enter see this these many logs I'm getting from my event W log but now these many logs I don't need then when you when you see this I need I need to check all the system log same things with the latest 20 newest 20 okay with latest or you can say newest 20 log right how do I find It ultimately you need to check what is the parameter right so we got to know that get hyen event log event log log name is a system right and I I said that is in latest 20 l which is the relevant parameter can you find anyone here you can go and check the syntax syntax can anyone find and text me it is relevant parameter let me give you this syntax get hyphen hell get hyphen event log can anyone tell me that what would be the relevant parameter I would need for I don't need for all the logs information I would need for only uh latest 20 which is a relevant parameter someone is texted me perfect see this perfect you got the parameter so very simple get hyphen event log hyphen log name name system and hyphen newest then 20 perfect see you got to know that your parameter you got to know the your command light you got to know your parameter you understood what is the input you need to enter it here that's called as a value and one more parameter you got it that the the newest what was that is Supply is asking you the parameter parameter New West is that giving you string here where is that newest see this newest it is asking you to enter the system int 32 int 32 means what the value is number already always right the int 32 or int 64 means it's always number so I have entered the value here number see very simple right now same things I need all this information right I need only see this there is entry type are there in the entry type I need only error log right same continue with that continue with this in this 20 log okay with latest log only needed only error log can anyone tell me that is how do I find it what is relevant parameter you can take this help syntax which one is relevant I need only error log anyone text me perfect Perfect see this iph entry type you got to know that so very simple right you can use it same simple entry type is a parameter and I'm I'm entering the value called error I'm looking for the only error see this only error log how Beauty right so that's all this is called Powershell now you wanted to this is a very begin end to understanding our journey in Powershell first most you need to understand this your command L find it and you need to find for the log name and you need to find for what what is the parameter is asking you what kind of value and how to use it and take one more example get high fund service I wanted to check I wanted to check winrm services started or not I wanted to check vrm service status example vrm service status second one second take example another use cases in the service win RM status what is this is a started or stopped right now this is a winrm is a name of the service how do I find it first you know that already I got to know this command light but I wanted to give you result for get help okay get iph help get hyen services so you know that is in get hyphen service name and I can type it get hyphen service name hyphen name and the name is vrm so I got to know this correct status it is stopped right I name so same things get hyen Services same in this Services you see that I looking for the stopped running I wanted to check I need to check only I need to check in my system only running Services running Services can anyone tell me how do we find it anyone text me this is a get help geten service okay and this is also result of get service so anyone tell me that is in how do I find my service is only start only running you see this in the status you have that is in stopped running all I need only running status so get Ian service name running it will work so this running is not under the name right it is a different one status right so let's try with this can be work or not copy others also can try with this I would need for specific how many service how many how many how many contr C copy this or you can say get typh some someone say this right get iph service name is set running right it won't work so where is that get H service get Ty service okay where is that status and running it should be under status right see this status ah see do you do you look into that status hyphen status just come back here get hyphen Services status running do I get a result remember as of now you discussed till now the default parameter right do you see the status under the parameter geten help geten service do you see this parameter status as a parameter in our my syntax can anyone read it do you see that parameter status called status in that my syntax yes or no I don't see is a computer name dependent Services display name I don't see anywhere in the status correct so what is next how do we if some of the know parameter or always you know any command that you executed that also be called as a header the result is coming with the header right or properties so name is also there in my parameter display name is in a available in parameter but status is not there right these header and these properties as a part of my part of my under the default parameter where you see The Hyphen name and also you see the display name then I can use it directly directly get hyphen Services hyphen name I can use the geyen services hyphen display name But whichever the property or header is not part of the parameter how do we use it that time we must use called pip plane operator if the header or properties property are not part of under default parameter parameter then we use pipeline operator how do I know what it mean by pipeline I don't know that right just see get hyph Services Under This I use the pipeline operator right I'm going to use open and close flower bracket which is dollar core underscore dot status and you can also use for the where object whereon object okay to find the dollcore status
2024-02-09 23:28