I recently spoke at a conference in Miami. During that conference, I was again reminded of just how deep the rabbit hole goes for PowerShell. The number of things you can learn, and or forget over the years is astounding. So, if you had to pick things to always remember about PowerShell, what would you choose to remember? I tell people there are only three things in PowerShell you really need to memorize. If you can memorize those three things you're doing well. >[!Important] You should memorize these > - Get-Help > - Get-Command > - Get-Member # Get-Help PowerShell relies heavily on documenting code. I know, every developers worst nightmare, undocumented, code. One of the earliest parts of the PowerShell focus was to set the expectation that everything should have some type of help information for a function on HOW the function was supposed to be used. The Get-Help cmdlet was then built to read that information and display it back to you, the user. ```powershell Get-Help Get-ChildItem ``` ![[Get-HelpExample.png]] Sometimes, the help information is out of date, and sometimes it difficult, especially if you aren't used to reading documentation on code, to understand the purpose of the documentation. Fear not, there is a way to get some better info. ## Params PowerShell is always built on parameters. Someone I used to work with, used to say "if you don't have to replace the tab key on your keyboard every 6 months, you aren't doing PowerShell right". It's very easy to forget to cycle through the different options to learn more. Here are some of my favorite forgotten parameters for the Get-Help cmdlet. ### Online ```powershell Get-Help Get-ChildItem -Online ``` The "online" param, uses the "url" property in the structure of a PowerShell function/cmdlet to look up the online documentation of a function. Hypothetically, this should always be the most up to date, and current version of the documentation. I find myself using this the most often, as it also is just easier to read. ### Examples ```powershell Get-Help Get-ChildItem -Examples ``` ![[Get-HelpExamples.png]] If you're someone who learns by seeing how someone else does something, then the examples parameter is for you. Using -examples will show you examples of how to use the cmdlet and it's different parameters. ### Full ```powershell Get-Help Get-ChildItem -Full ``` Finally the "full" option. If you're on a machine where you can't get on the internet or you just like to read everything in console. You can use the "Full" option to display all of the help information that is available in the cmdlet. # Get-Command Get-Command will tell you all of the ***currently available*** commands in memory. I cannot highlight this enough. It get's all of the commands/cmdlets from the currently loaded modules in the session. If the module is not loaded you will not see the commands. This cmdlet is really useful if you have an "idea" of what you want to do, but you aren't sure what the command for the thing you want to do is called. Because PowerShell uses "Verb-Noun" styling, and there is an approved list of verbs. You should be able to use the verbs, and the module origin as a great filter to "guess" at what you want to do. However, the "list" of available cmdlets can be very daunting. ## Params Here are some common parameters for the Get-Command cmdlet that are frequently over looked. Use these to "filter" the list of available commonds. ### Verb ```PowerShell Get-Command -Verb Get ``` ![[Get-CommandVerbGet.png]] Because of it's "verb-noun" nature and the approved verb list. You can usually filter based on the action you want to take. In the example above, this would return all of the PowerShell Cmdlets that utilize the "Get" verb in their structure. If you just wanted to "get" some data, you would be likely to use the "Get" verb. >[!Note] Get-Verb - Approved List of verbs >You can get a list of the PowerShell approved verbs using the `Get-Verb` this is helpful when building your own personal cmdlets. ### Module ```PowerShell Get-Command -Module BitLocker ``` ![[Get-BitlockerModule.png]] If you know you are working with a specific module (say ConfigurationManager or bitlocker) you can filter the list of functions/cmdlets by using the -Module parameter. This will help you find things a LOT faster. When searching for specific commands. Especially when combined together with the verb keyword. ```PowerShell Get-Command -Module Bitlocker -verb Get ``` ![[Get-CommandBitlockerExample.png]] # Get-Member PowerShell is by design an object oriented language. This means that everything behaves in a very specific way. Things by default will have what are called properties and methods. In order to know what options are available to you you can use either the PSReadline module (natively built-in, and use Ctrl+Space) or you can simply pipe something to Get-Member. This will then let you know what "things" you can access/use on the object. ```PowerShell $fileObjecs = Get-ChildItem $fileObjects | Get-Member ``` ![[Get-MemberExample.png]] Because I have both folders and files in here, it will show all of the properties, of all of the types of things I returned. # Conclusion You don't have to memorize everything in PowerShell just a few little things. As always I hope this was helpful.