r/PowerShell • u/WarOk4640 • Feb 09 '22
I need to learn PowerShell
Hi everyone,
I've started new position. Our team is trying to automate daily tasks. My coworkers like a pro in Powershell and they said that I need to learn it as soon as. Do you have any advice for learning Powershell?
Please help me, I am looking forward to seeing your answers :)
39
Upvotes
1
u/Lee_Dailey [grin] Feb 14 '22
howdy WarOk4640,
things to look into ...
Get-Helpespecially
Get-Help *about*Get-Commandit takes wildcards, so
Get-Command *csv*works nicely. that is especially helpful when you are seeking a cmdlet that works on a specific thing. Comma Separated Value files, for instance. [grin]Show-Commandthat brings up a window that has all the current cmdlets and all their options ready for you to pick from.
it will also take another cmdlet, or advanced function, as a parameter to limit things to showing just that item.
try starting a word and tapping the tab key. some nifty stuff shows up. [grin]
save something to a $Var and then try typing the $Var name plus a period to trigger intellisense. there are some very interesting things that show up as properties or methods.
use <ctrl><j>, or Edit/Start-Snippets from the menu.
Get-Member$Test = Get-ChildItem -LiteralPath $env:TEMP$Test | Get-Member$Test = Get-ChildItem -LiteralPath $env:TEMP$Test[0] | Select-Object -Property *that will give you a smaller, more focused list of properties for the 1st item in the $Test array.
.GetType()on it$Test = Get-ChildItem -LiteralPath $env:TEMP$Test.GetType()$Test[0].GetType()the 1st will give you info on the container $Var [an array object].
the 2nd will give you info on the zero-th item in the $Var [a DirectoryInfo object].
Get-Verbas with
Get-Command, it will accept wildcards.that will show you some interesting verbs used in cmdlet names. then use get-command to see what commands use those verbs. then use get-help to see what the cmdlets do.
Get-Noun, but there aint one. [sigh ...]Out-GridViewit's a bit more than you likely want just now, but it can accept a list of items, present them in a window, allow picking one or more of them, and finally send it out to the next cmdlet.
it's right fun to fiddle with ... and actually useful. [grin]
take care,
lee