So the main reason I want to start doing labs is because I want to become really good with powershell and in order to be really good, you actually need to do stuff, so as I am writing this I am also doing at the same same time. What I mean about labs is basically just launch powershell.
There are Different ways to launch powershell but if you are using windows type on the search bar powershell. when you see the little blue symbol pop up, just click and open powershell and let the fun begin.
The Way I like to do things that you can learn how to research too is by doing so as I come up with something just stop what you doing go to the Powershell console and just do it. If you can’t find answers from the console, use Google.
First Task: How would you find the powershell version that it is currently install?
Answer: I just go straight to google and you want to ask the correct questions, in my case I am using the Startpage search engine. question I asked was how do i find the powershell version. You will see different results, some people would go with the microsoft results, my opinion is that go with what ever works for you. So looking at the result if you were to type $PSVersionTable
you would get an output in the console. You might ask, why did it do that? well that’s because that’s an environment variable and by default programmers added a certain amount of instruction so whenever you type that $PSVersionTable
commandlet what is going to do is grab some information that was already stored somewhere in memory and output it out to you. What you are going to learn is that some commands output stuff to you, some commands or commadlets do not output anything, and if you type something you are not supposed to type you are going to get an error. Errors teach you a lot! I mean!! Alot, By studying errors you understand what you are doing wrong and then go about the best possible way to get the best possible solution. for example of errors type aaaa
The error is basically the computer saying, hey there! I don’t know what aaaa means.
aaaa : The term ‘aaaa’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- aaaa
- ~~~~
- CategoryInfo : ObjectNotFound: (aaaa:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
Again, looking at Errors you can learn a lot!
Second Task: Once you figure out how to find the version, next is how do you update powershell? ha! this might be a hard one and you might need to do it with the CMD or command line and follow instructions watching videos, reading or if you can come up with a way to install it using powershell through powershell, please let me know on linkedin. I am going to give you a hint: https://blog.ironmansoftware.com/daily-powershell/powershell-download-github/
If you fail to update powershell, keep driving on, if you have windows 10 you should be fine.
Third Task: How do you see all the services going on within the system? To make this simple when you want to see any kind of information you always tell the computer computer get shit. so you probably going to be doing something like get-service computer.
You have to remember that you can use tab as you are typing the cmdlets when you do that the shell automatically complete the cmdlet for you. Another thing that you are going to notice as you are doing this labs is that majority of the cmdlet start with a verb follow by a noun. so Get-Service, Stop-Service, Start Service, etc…
Task Number 4 Once you get to see all the services, try to figure out how to stop the spooler service. Hint hint… all Cmdlets have what I call properties one of the properties might be the -Name.
Task Number 5 Start the spooler Service back on.
Task Number 6: How do you send output to another folder? Once you figured that out Complete create a folder in the desktop called myAwesomeFolder, once you create that folder create a file inside of the folder called mybeautyfile.txt You can not do this with the GUI, all this must be done in powershell. You are only allow to look stuff and eventually the labs going to get to the point that we might even look up stuff through the shell. reason why is because you might run into a headless system and you never know. it makes you focus in powershell. Once you complete the folder and the file in the folder what is command equivalent to ipconfig in powershell. send the OUTPUT of that command to the file mybeautyfile.txt
This is all for now, I would say this is just a warm up round, I will try to keep my blog updated because I need to do this myself and teach myself more powershell.
My Goal is to become really good, help others learn and at the same time just maintain my brain busy,
When in doubt! Get-Help <Commandname> research get-help
some of my references:
https://www.pdq.com/blog/what-is-the-powershell-equivalent-of-ipconfig/
https://learn.microsoft.com/en-us/shows/tabs-vs-spaces/windows-package-manager-winget-v10
https://learn.microsoft.com/en-us/powershell/module/powershellget/update-module?view=powershell-7.3