Using Cmdlet Help

Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

You can use standard Windows PowerShell cmdlets together with System Center Virtual Machine Manager (VMM) cmdlets. For example, you can use the Windows PowerShell Get-Help cmdlet to get help about VMM cmdlets and Windows PowerShell cmdlets. This topic contains sample commands that you can use to get Help in the Windows PowerShell – Virtual Machine Manager command shell or in Windows PowerShell.

Using the Get-Help and Get-Command cmdlets

Two Windows PowerShell cmdlets that you will find helpful are Get-Help and Get-Command. The Get-Help cmdlet displays cmdlet Help. The Get-Command cmdlet lists all the cmdlets for all the snap-ins that are installed.

To display the basic information that is provided by Get-Help and Get-Command

  1. Type the following command, and then review its output:

    Get-Help Get-Help

  2. In another command-shell window, type the following command, and then review its output:

    Get-Command

You can use the wildcard character (*) together with Get-Help and Get-Command.

To use wildcard characters with Get-Help and Get-Command

  1. Type the following command, and then review its output:

    Get-Help *virtualcom*

  2. In another command-shell window, type the following command, and then review its output:

    Get-Command *virtualcom*

    This command displays the Get-VirtualCOMPort and Set-VirtualCOMPort cmdlets.

  3. Confirm that the output for step 1 displays the name, category, and synopsis for the Get-VirtualCOMPort and Set-VirtualCOMPort cmdlets. Confirm that the output for step 2 displays the command type, name, and definition of the Get-VirtualCOMPort and Set-VirtualCOMPort cmdlets.

You must use a different command to display information about the common parameters because this set of parameters is shared by most Windows PowerShell and VMM cmdlets.

To display information about the common parameters

  • Type the following command, and then review its output.

    Get-Help about_CommonParameters

Using Parameters with the Get-Help Cmdlet

You can use the following parameters together with Get-Help to change how Help is displayed in Windows PowerShell and in the VMM command shell:

  • Detailed

  • Full

  • Example

  • Syntax

  • Property

  • Parameter

When you use the Detailed parameter, Help displays a description for each parameter but excludes other parameter details.

To use the Detailed parameter

  • Type the following command, and then review its output:

    Get-Help Get-Help -detailed

When you use the Full parameter, Help displays all the available parameter details.

To use the Full parameter

  • Type the following command, and then review its output:

    Get-Help Get-Command -full

When you use the Example parameter, Help displays only the "Synopsis" section and the set of examples for that cmdlet.

To use the Example parameter

  • Type the following command, and then review its output:

    Get-Help Get-Command -example

When you use the Syntax parameter, Help displays only the "Syntax" section of the cmdlet Help topic.

To use the Syntax parameter

  • Type the following command, and then review its output:

    Get-Command Get-Help -syntax

When you use the Property parameter, Help displays only the properties you are interested in for a particular cmdlet.

To use the Property parameter

  • Type the following command, and then review its output:

    Get-Help *vmhost | Format-List -property Name, Synopsis

When you use the Parameter parameter, Help displays only the description of the parameter that you specify.

To use the Parameter parameter

  • Type the following command, and then review its output:

    Get-Help Add-VMHost -parameter Reassociate

Working with the Virtual Machine Manager Snap-in

You can list all the VMM cmdlets that are included in the VMM snap-in by using the Get-Command cmdlet.

To list all the VMM cmdlets

  1. Use one of the following methods:

    • Type the following command, and then review its output:

      Get-Command -PSSnapin Microsoft.SystemCenter.VirtualMachineManager

    • Type the following command to list the cmdlets in a table:

      Get-Command -PSSnapin Microsoft.SystemCenter.VirtualMachineManager | Sort-Object Noun | Format-Table -Group Noun

  2. Confirm that you see a list of cmdlets that includes the VMM cmdlets, such as Add-VMHost, Get-VM, or Update-VMMManagedComputer.

The Get-Command cmdlet returns all the cmdlets. However, you can return a subset of cmdlets, such as the cmdlets that contain the Get verb.

To list only the VMM cmdlets that begin with the Get verb

  • Type the following command, and then review its output:

    Get-Command -PSSnapin Microsoft.SystemCenter.VirtualMachineManager –Verb Get

You can discover which snap-in a cmdlet is found in by viewing the properties of the cmdlet.

To list the snap-in of a cmdlet

  • Type the following command, and then review its output:

    Get-Command Get-VMMServer | Format-List -property implementingtype, pssnapin

Displaying Cmdlet Help Topics

When you use the Get-Help cmdlet, the entire Help topic is displayed. You can display the Help topic one screen at a time by using the Help command.

To display a Help topic one screen at a time

  1. Type the following command to display the Help topic for Get-Command one screen at a time:

    Help Get-Command -full

  2. Press the SPACEBAR to display the next screen, or press ENTER to display one additional line at a time.

Searching Cmdlet Help Topics

You can search VMM cmdlet Help topics in the command shell by using the Findstr command.

To search the VMM cmdlet Help files

  1. Type the following command to change to the directory where the VMM Help files are stored:

    cd <C>:\'Program Files'\'Microsoft System Center Virtual Machine Manager 2008'\bin

    Note

    Replace the <C> placeholder with the letter of the drive on which your VMM files are installed. Confirm that the path in the command prompt changes to the VMM Bin directory.

  2. Type the following command to search the VMM Help topics for the "library server" string:

    findstr /I /C:"library server" *.xml, *.txt

Saving Help Topics

You can save Help topics for individual commands or for all VMM cmdlets.

To save a single Help topic to a text file

  1. Change to the directory in which you want to save the text file. For example, type a command that resembles the following command:

    cd <c>:\Users\<username>\documents

    Note

    Replace the <c> placeholder with the drive on which your operating system is installed. Replace the <username> with the user name of the account you are logged in to.

  2. Type the following command to save the contents of the Help topic for the Get-VMHostRating cmdlet to a text file:

    Get-Help Get-VMHostRating -detailed | Out-File Get-VMHostRating.txt

    Or, use the redirection operator:

    Get-Help Get-VMHostRating -detailed > Get-VMHostRating.txt

  3. Start a text editor, and then open the Get-VMHostRating.txt file to confirm that the text file contains the Help topic for Get-VMHostRating. To open the file in Notepad, type the following command from the folder in which you stored the file:

    notepad Get-VMHostRating.txt

To save all the Help topics for every VMM cmdlet to a text file

  1. Type the following command, and then review its output:

    Get-Command -PSSnapin Microsoft.SystemCenter.VirtualMachineManager | Get-Help -detailed | Out-File <C>:\<FolderName>\VMMHelpTopics.txt

    Note

    Replace the <C> placeholder with the letter of the drive on which you want to store the VMMHelpTopics.txt file. And, replace the <FolderName> placeholder with the name of the folder in which you want to store the file.

    Note

    If you receive an error message that indicates that a Help topic for one or more cmdlets could not be found, the command should still copy all the existing cmdlet Help topics into the VMMHelpTopics.txt file.

  2. Confirm that the text file contains the Help topics for all the VMM cmdlets. To do this, start a text editor, and then open the VMMHelpTopics.txt file. To open the file in Notepad, type the following command from the folder in which you saved the file:

    notepad VMMHelpTopics.txt

For More Information

Conceptual Help topics are available with the VMM cmdlet Help. To display one of the following topics, type Get-Help about_<TopicName> at the command prompt:

  • about_VMM

  • about_VMM_2008_Disk_and_DVD_Enhancements

  • about_VMM_2008_Failover_Clusters

  • about_VMM_2008_Library_Enhancements

  • about_VMM_2008_Multiple_Host_Platforms

  • about_VMM_2008_OpsMgr_Integration

  • about_VMM_2008_Renamed_Cmdlets_and_Parameters

  • about_VMM_2008_Role_Based_Security

  • about_VMM_2008_Virtual_Networking

  • about_VMM_Scripting

  • about_VMM_Tutorial

For more information about VMM, see the following Microsoft Web sites: