Windows PowerShell
- This topic has 4 replies, 4 voices, and was last updated 4 years, 6 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
HOME › Forums › Technology › Windows PowerShell
Learning Windows Powershell for my cert iii in IT any funky pointers before I start?
You should probably use the Windows Terminal which wraps Powershell with a couple of essential features like easy clipboard access and full Unicode support.
here are some tips for every-day tricks.
1. Learn how to use Get-Member
So let’s say you set a thing to some stuff. Like $thing = get().Stuff
Then you type:
$thing | Get-Member
and look if there’s stuff inside of thing.
also just type $thing and hit enter to see if it’s a variable or whatever
2. calling a value inside of a variable doesn’t always work like normal
so let’s say $thing has three values in it. We’ll call them stuff1, stuff2, and stuff3
so you want stuff3. You would think that you can do this:
$thing.stuff3
but that doesn’t always work. sometimes you have to do this:
$($thing.stuff4)
3. this tip works for ALL programming languages
-learn how to create and use arrays.
-then learn how to use “for i =” and “for each” loops.
“for each” is the easy way, quick to code. but not as robust as a “for i =” loop.
– say $thing.stuff2 you got has this when you do get member {bla bla bla}, there’s probably and array in there. you can do foreach $bla in $thing.stuff2, but you couldn’t say.. have ANOTHER array you are referencing at the same time.
like… so:
$customList[i] = $thing.stuff2[i]
this last one is kinda vague and doesn’t have immediate purpose, but when you start learning it, treat it like the super awesome funky candy it is.
wow, that’s a lot of text.
idek what this is.
Wow that’s so awesome!! thank you so much!!!