In the last view days I had to deal a lot with Windows PowerShell. I think it is hard to find a good starters guide, so here I go to fix this.
Get-Command: With this command you can display all available PowerShell-Cmdlets and PowerShell-Functions.
Get-Command -Module ModulName: For example with “Get-Command -Module Hyper-V” you get a list with all available commands from the Hyper-V module.

Get-Help: To lern more about a command simply type “Get-Help Command e. g. Get-Help Stop-VM”, this will show you the name, its syntax and if available an alias.
If you know Perl you also know the basics for PowerShell programming. This is how a variable could look like $VMList = Get-VM. If you type now echo $VMList you will get a lot of informations. If you only want to know what’s the state of your VM is you can do this with the following script.
$VMList = Get-VM
$VMName = ‘TheNameofyourVM’
$VMState = ($VMList | Where-Object {$_.Name -eq $VMName}).State
As you can see you can’t do a simple grep, you have to do this with the “Where-Object” command. The “.State” indicates the value from the object state. It’s important that you use the brackets, otherwise it doesn’t work.


