Need Tips for Powershell practice 2016

SneakywafflesSneakywaffles Registered Users Posts: 5 ■■■□□□□□□□
Does anyone have good material or tips of powershell in preperation for 70-740?

Comments

  • Neil86Neil86 Member Posts: 182 ■■■■□□□□□□
  • SneakywafflesSneakywaffles Registered Users Posts: 5 ■■■□□□□□□□
  • poolmanjimpoolmanjim Member Posts: 285 ■■■□□□□□□□
    When figuring out Powershell for any given Microsoft test the best thing you can do is look at the cmdlets associated with the technology being tested over.

    Warning and Apologies: Wall of Text Incoming...



    For example, 70-740 includes a lot of Hyper-V. Specifically there is a task to "Add or remove memory in a running VM". You could, of course, google this and find a lot of information but what I like to do is to figure out what all commands apply to Hyper-V. This can be done with the Powershell cmdlet "Get-Command".


    You can search by name (Get-Command *VM*) which will return anything that matches that name (the asterisks are wildcards and in my example return anything with VM in it). This will return Cmdlets, functions, aliases, etc.; basically everything.


    You can also search by noun, the right hand portion of a command (Get-Command -Noun VM). This returns anything that has that noun. If you include wildcards, it works very similar to the -Name switch.


    There is also the verb search (Get-Command -Verb "Get"). This one is less useful on its own than the other two. It searches for a command based on the verb, or the left portion of the command. The reason it is less useful is there are going to be hundreds, or thousands of instances of that verb because powershell restricts what verbs may be used (Get-Verb command shows the different verbs available in powershell).


    However, there is one more piece to point out. You can also search by Module. Module is the package that the powershell commands come in. Unfortunately the commands you need may not always show in the same module. When you do any of the Get-Command cmdlets to find the cmdlet you are interested in you also get the module that command is in. If you search by the module (Get-Command -Module "Hyper-V") you see every command in that module.


    So in the case of our our exam objective "Add or remove memory in a running VM". We can assume that it is in Hyper-V, if we didn't know the module we could try "Get-Command -Name *VM*" which would give us a bunch of commands from all over (several different modules come back). We would see in the list that a lot of those come from Hyper-V so you could then narrow it down by doing "Get-Command -Module Hyper-V". We need to adjust the running memory so you could try "Get-Command -Noun *Memory* -Module "Hyper-V" which gives us Get-VMMemory and Set-VMMemory. If we are wanting to adjust something, Set is more likely to be our verb of choice than Get. So Set-VMMemoory can be used to Add or Remove memory in a running VM.


    Its a convoluted process but you will learn a about how Powershell is laid out and how to find new cmdlets.
    2019 Goals: Security+
    2020 Goals: 70-744, Azure
    Completed: MCSA 2012 (01/2016), MCSE: Cloud Platform and Infrastructure (07/2017), MCSA 2017 (09/2017)
    Future Goals: CISSP, CCENT
Sign In or Register to comment.