SCVMM Part8 (PowerShell)


If you know a bit about PowerShell this post wont enlighten you further, so you might stop reading here.  However if you're new to PowerShell or specifically PowerShell with System Centre Virtual Machine Manager (SCVMM) then the command GET-COMMAND will be useful.



Get-Command



Type this command to get a list of all the possible commands (cmdlets) available.


This extensive list is a good place to start when you need to investigate what PowerShell can do for you, however you may need to filter the data to make it more specific to you.  To do this you can use a wildcard search perhaps to see just the major SCVMM  commands, an example of this is:



get-command *-vm*



This command only shows those CmdLets with "-vm" in their names and returns when run on a SCVMM server the following data (sorry I know the right side of this has been truncated, but you should be able to read enough detail):



CommandType     Name                                           Definition
-----------     ----                                           ----------
Cmdlet          add-vmhost                                     add-vmhost [-VMHostGroup <HostGroup>] -Serv.
Cmdlet          add-vmhostnetworkadapter                       add-vmhostnetworkadapter -VirtualNetwork <V.
Cmdlet          discardsavedstate-vm                           discardsavedstate-vm -VM <VM> [-Reason <Str.
Cmdlet          discover-vmhost                                discover-vmhost -Server <ServerConnection> .
Cmdlet          Get-VM                                         Get-VM -Server <ServerConnection> [-Verbose.
Cmdlet          Get-vmcheckpoint                               Get-vmcheckpoint [[-Vm] <VM>] -Server <Serv.
Cmdlet          get-vmhost                                     get-vmhost -Server <ServerConnection> [-Com.
Cmdlet          Get-VMHostGroup                                Get-VMHostGroup -Server <ServerConnection> .
Cmdlet          get-vmhostnetworkadapter                       get-vmhostnetworkadapter -Server <ServerCon.
Cmdlet          Get-VMHostRating                               Get-VMHostRating -VmHosts <Host[]> -VM <VM>.
Cmdlet          get-vmhostvolume                               get-vmhostvolume -VMHost <Host> [-Verbose] .
Cmdlet          Move-VM                                        Move-VM -VM <VM> -VMHost <Host> [-StartVMOn.
Cmdlet          Move-VMHost                                    Move-VMHost -VMHost <Host> -NewParentHostGr.
Cmdlet          Move-VMHostGroup                               Move-VMHostGroup -VMHostGroup <HostGroup> -.
Cmdlet          New-VM                                         New-VM -Template <Template> -Name <String> .
Cmdlet          New-vmcheckpoint                               New-vmcheckpoint [-Vm] <VM> [-Description <.
Cmdlet          New-VMHostGroup                                New-VMHostGroup -Server <ServerConnection> .
Cmdlet          refresh-vm                                     refresh-vm -VM <VM> [-Verbose] [-Debug] [-E.
Cmdlet          refresh-vmhost                                 refresh-vmhost -VMHost <Host> [-Verbose] [-.
Cmdlet          Remove-VM                                      Remove-VM -VM <VM> [-Delete] [-Reason <Stri.
Cmdlet          Remove-vmcheckpoint                            Remove-vmcheckpoint -VMCheckpoint <VMCheckp.
Cmdlet          remove-vmhost                                  remove-vmhost -VMHost <Host> [-Reason <Stri.
Cmdlet          Remove-VMHostGroup                             Remove-VMHostGroup -VMHostGroup <HostGroup>.
Cmdlet          remove-vmhostnetworkadapter                    remove-vmhostnetworkadapter -VirtualNetwork.
Cmdlet          restart-vm                                     restart-vm -VM <VM> [-Reason <String>] [-Ru.
Cmdlet          Restore-vmcheckpoint                           Restore-vmcheckpoint -VMCheckpoint <VMCheck.
Cmdlet          resume-vm                                      resume-vm -VM <VM> [-Reason <String>] [-Run.
Cmdlet          savestate-vm                                   savestate-vm -VM <VM> [-Reason <String>] [-.
Cmdlet          Set-VM                                         Set-VM -VM <VM> [-Owner <String>] [-Operati.
Cmdlet          set-vmhost                                     set-vmhost -VMHost <Host> [-MaintenanceHost.
Cmdlet          Set-VMHostGroup                                Set-VMHostGroup -VMHostGroup <HostGroup> [-.
Cmdlet          shutdown-vm                                    shutdown-vm -VM <VM> [-Reason <String>] [-R.
Cmdlet          start-vm                                       start-vm -VM <VM> [-Reason <String>] [-RunA.
Cmdlet          stop-vm                                        stop-vm -VM <VM> [-Reason <String>] [-RunAs.
Cmdlet          Store-VM                                       Store-VM -VM <VM> -VMLibrary <LibraryServer.
Cmdlet          suspend-vm                                     suspend-vm -VM <VM> [-Reason <String>] [-Ru.


Many of the information commands that you can use with PowerShell and this is also true of PowerShell in SCVMM start with "GET" something, so you could use the following command to list just those:



get-command *get-*


I think this probably lists most of the SCVMM commands (but I don't know that for sure), I've had a play with a few but will be spending most of my time in the GUI from now on (whilst testing Beta1).


 


When you have found a cmlet that interests you you can then use the GET-HELP command to get more information, so if you wanted to know more about get-process then you would type:



get-help get-process


It was whilst looking at the get-help command that I realized that SCVMM doesn't have any help functionality (it errors on my machine at least) so you can't in this build type for instance get-help get-vm

Comments (1)

  1. Anonymous says:

    Clive Watson has been testing the new System Center Virtual Machine Manager Beta 1 and he has posted…

Skip to main content